Skip to content

Reset the password

POST
/v1/auth/reset-password
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.

Media typeapplication/json
object
email
required

Email of the account, the same one sent to POST /v1/auth/forgot-password.

string
Example
ventas@emite.cr
code
required

The 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.

string
Example
482913
newPassword
required

The 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.

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

The password is set. A session token (LoginResponseDto) or, when the account has two-factor authentication, { passwordReset: true, mfaRequired: true } (ResetPasswordMfaDto) and no session.

Media typeapplication/json
One of:
object
accessToken
required

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.

string
tokenType
required

Always Bearer: the scheme to send the token with in the Authorization header.

string
Allowed values: Bearer
expiresIn
required

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.

string
expiresAt
required

The instant this token expires (ISO 8601, UTC): expiresIn as a date.

string format: date-time
passwordChangeSuggested

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.

boolean
Example
{
"tokenType": "Bearer",
"expiresIn": "28800s",
"expiresAt": "2026-10-22T22:30:00.000Z",
"passwordChangeSuggested": true
}