Reset the password
const url = 'https://api.emite.cr/v1/auth/reset-password';const options = { method: 'POST', headers: {'Content-Type': 'application/json'}, body: '{"email":"ventas@emite.cr","code":"482913","newPassword":"café lluvia tortuga"}'};
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/reset-password \ --header 'Content-Type: application/json' \ --data '{ "email": "ventas@emite.cr", "code": "482913", "newPassword": "café lluvia tortuga" }'Verifies the code sent by POST /v1/auth/forgot-password and sets the new password. Every open session of the person is closed, on any device, and their WhatsApp number is unlinked. Without two-factor authentication it then signs the person in: a session token (JWT) in the body and in the X-Session-Token header, carrying the company when the person belongs to exactly one. With two-factor authentication it returns { passwordReset: true, mfaRequired: true } and no token: sign in with the new password at POST /v1/auth/login and complete the MFA challenge. 400 INVALID_CODE, 400 CODE_EXPIRED, and 429 TOO_MANY_ATTEMPTS after five attempts on the same code.
Request Bodyrequired
Section titled “Request Bodyrequired”object
Email of the account, the same one sent to POST /v1/auth/forgot-password.
Example
ventas@emite.crThe 6-digit code from the password-reset email, valid for 15 minutes. A wrong code answers 400 INVALID_CODE and an expired one 400 CODE_EXPIRED; after five attempts, 429 TOO_MANY_ATTEMPTS until a new code is requested.
Example
482913The new password. 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 tortugaResponses
Section titled “Responses”The password is set. A session token (LoginResponseDto) or, when the account has two-factor authentication, { passwordReset: true, mfaRequired: true } (ResetPasswordMfaDto) and no session.
object
The session token, a signed JWT: send it as Authorization: Bearer <accessToken>. It acts for the person, in the company it names when it names one (currentTenantId in GET /v1/auth/me). The same token comes in the X-Session-Token response header.
Always Bearer: the scheme to send the token with in the Authorization header.
Remaining life of this token: whole seconds followed by s ("28800s" = 8 hours). It never reaches past the maximum of the session, which counts from the sign-in, so a re-issued token (switching company, renewing) lives less. Under a company inactivity rule it also ends that many minutes after it was issued, unless it is renewed with POST /v1/auth/sessions/renew.
The instant this token expires (ISO 8601, UTC): expiresIn as a date.
Present, and true, only in the answer of POST /v1/auth/login, when the password that just signed in does not meet the rule a new password must meet today (12 to 72 characters, nothing of the person, hard to guess: see POST /v1/auth/signup). A suggestion to change it, never a refusal: the sign-in went through.
object
Always true: the new password is already set.
Always true: no session was issued, because a reset through the mailbox must not skip the second factor. Sign in with the new password (POST /v1/auth/login) and complete the challenge it returns.
Example
{ "tokenType": "Bearer", "expiresIn": "28800s", "expiresAt": "2026-10-22T22:30:00.000Z", "passwordChangeSuggested": true}