Skip to content

Complete the sign-in challenge

POST
/v1/auth/2fa/challenge/verify
curl --request POST \
--url https://api.emite.cr/v1/auth/2fa/challenge/verify \
--header 'Content-Type: application/json' \
--data '{ "challengeToken": "example", "code": "123456", "recoveryCode": "example" }'

Completes the MFA challenge of POST /v1/auth/login with its challengeToken and a code (from the authenticator, or emailed for this sign-in) or a recovery code. On success it returns the same LoginResponseDto as POST /v1/auth/login, in the body and in the X-Session-Token header, and the challenge is spent. Every call counts toward the five attempts of the challenge: past them, 429 MFA_TOO_MANY_ATTEMPTS until a new sign-in. 400 MFA_CHALLENGE_EXPIRED for an unknown, used or expired challenge; 400 INVALID_TWO_FACTOR_CODE for a wrong code; an emailed code can also answer 400 CODE_EXPIRED or 429 TOO_MANY_ATTEMPTS. Signing in with a recovery code closes every other session of the person and unlinks their WhatsApp number, and an email tells them how many codes are left. At most 10 requests per minute per client IP (429 AUTH_RATE_LIMITED).

Media typeapplication/json
object
challengeToken
required

Challenge token returned by the login response.

string
code

A 6-digit code: from the authenticator app, or the one emailed for this sign-in. Send it or recoveryCode: with both, only recoveryCode is checked; with neither, 400 TWO_FACTOR_CODE_REQUIRED. A wrong code answers 400 INVALID_TWO_FACTOR_CODE.

string
Example
123456
recoveryCode

One of the single-use recovery codes of the account (xxxx-xxxx-xxxx; case, dashes and spaces are ignored), spent on use. Signing in with one closes every other session of the person.

string

The session: the sign-in is complete.

Media typeapplication/json
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
}