Sign up
const url = 'https://api.emite.cr/v1/auth/signup';const options = { method: 'POST', headers: { cookie: 'example', 'accept-language': 'example', 'Content-Type': 'application/json' }, body: '{"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..."}]}}'};
try { const response = await fetch(url, options); const data = await response.json(); console.log(data);} catch (error) { console.error(error);}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.
Parameters
Section titled “Parameters”Header Parameters
Section titled “Header Parameters”Request Bodyrequired
Section titled “Request Bodyrequired”object
Email of the new account: the verification code goes there, and the person signs in with it.
Example
ventas@emite.crPassword 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.
Example
café lluvia tortugaName of the person: 2 characters or more.
Example
María SolísThe 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
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.
object
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).
Example
terminos-y-condicionesThe 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.
Example
3.0The 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.
Example
sha256:abcdef0123456789...Responses
Section titled “Responses”The signup waits for its code; the same answer for an email with an account.
object
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.
Example
{ "email": "ventas@emite.cr"}