Skip to content

Sign up

POST
/v1/auth/signup
curl --request POST \
--url https://api.emite.cr/v1/auth/signup \
--header 'Content-Type: application/json' \
--header 'accept-language: example' \
--header 'cookie: example' \
--cookie example \
--data '{ "email": "ventas@emite.cr", "password": "café lluvia tortuga", "name": "María Solís", "legal": { "acceptances": [ { "documentType": "terminos-y-condiciones", "documentVersion": "3.0", "documentHash": "sha256:abcdef0123456789..." } ] } }'

Self-service signup: sends a 6-digit verification code to the email, valid for 15 minutes. The account is created only when that code is verified at POST /v1/auth/signup/verify, together with the acceptance of the legal documents the request carries in legal (required, and checked before any code goes out). Signing up again with the same email replaces the pending signup and its code. Answers 202 whether or not the email already has an account: an existing account gets an email saying someone tried to sign up with it (at most once an hour) instead of a code. The code email and the new account take their language from the web app’s NEXT_LOCALE cookie or, without it, the first of es or en in Accept-Language (es by default). A new code for the same email at most every 60 seconds (429 EMAIL_VERIFICATION_COOLDOWN); 503 EMAIL_DELIVERY_FAILED when the email could not be sent.

cookie
required
string
accept-language
required
string
Media typeapplication/json
object
email
required

Email of the new account: the verification code goes there, and the person signs in with it.

string
Example
ventas@emite.cr
password
required

Password of the new account. A password the person chooses: 12 to 72 characters, not built on the name or the email of the account, and hard to guess (no common or leaked password, sequence, keyboard pattern or date; the same estimator the app shows under the field). Upper case, digits and symbols are neither required nor refused. Refused with 400 PASSWORD_TOO_WEAK, whose params.reason is too_short, too_long, personal_info or too_guessable. Passwords set before this rule keep working to sign in.

string
>= 12 characters <= 72 characters
Example
café lluvia tortuga
name
required

Name of the person: 2 characters or more.

string
Example
María Solís
legal
required

The person's acceptance of the served Terms and Privacy Policy (version + hash of each text). Required: 400 LEGAL_SIGNUP_ACCEPTANCE_REQUIRED without it, 400 LEGAL_ACCEPTANCE_INCOMPLETE when a required document is missing, 409 OUTDATED_VERSION / HASH_MISMATCH for a stale text.

object
acceptances
required

One entry per document, at most 10. Every document the catalog requires at signup must be present (400 LEGAL_ACCEPTANCE_INCOMPLETE names the missing ones); an empty list is 400 LEGAL_SIGNUP_ACCEPTANCE_REQUIRED. Recorded as the person's own acceptance, with the IP, browser and instant of this request, in the same transaction that creates the account.

Array<object>
object
documentType
required

Slug of the legal document accepted, as GET /v1/legal/required-for-signup lists it: today terminos-y-condiciones (Terms and Conditions) and politica-de-privacidad (Privacy Policy). An unknown slug is 400 UNKNOWN_DOCUMENT; the Cookie Policy (politica-de-cookies) is only announced, never accepted (400 LEGAL_DOCUMENT_NOT_REQUIRED).

string
Example
terminos-y-condiciones
documentVersion
required

The version of the document the API serves today (its version), up to 32 characters. Any other version is 409 OUTDATED_VERSION: fetch the documents again and show the current text.

string
Example
3.0
documentHash
required

The SHA-256 of the exact Markdown text shown to the person: sha256: followed by 64 hex digits, copied verbatim from the hash the API serves with the document. It is the proof of which text was accepted; one that differs from the served text is 409 HASH_MISMATCH.

string
Example
sha256:abcdef0123456789...

The signup waits for its code; the same answer for an email with an account.

Media typeapplication/json
object
email
required

The email the request named, echoed back. The answer is the same whether or not it already belongs to an account, so it reveals nothing; for a new signup, the 6-digit verification code went there.

string
Example
{
"email": "ventas@emite.cr"
}