Skip to content

Confirm email codes

POST
/v1/auth/2fa/email/confirm
curl --request POST \
--url https://api.emite.cr/v1/auth/2fa/email/confirm \
--header 'Content-Type: application/json' \
--data '{ "code": "123456" }'

Confirms the 6-digit code sent by POST /v1/auth/2fa/email/enable and turns on the email-code method: from then on, signing in asks for a code sent to the account email. When it is the first method of the account, the response carries the recovery codes, shown this one time. Closes every OTHER session of the person — they were opened without the second factor. This session continues under a new token, returned in the X-Session-Token header. 400 INVALID_CODE or CODE_EXPIRED, 429 TOO_MANY_ATTEMPTS after five attempts on the same code, 409 TWO_FACTOR_ALREADY_ENABLED when the method is already active.

Media typeapplication/json
object
code
required

6-digit code sent to the account email.

string
Example
123456

Email codes are active; recoveryCodes when it is the first method.

Media typeapplication/json
object
recoveryCodes

Present only when this method is the first second factor of the account: the 10 single-use recovery codes (xxxx-xxxx-xxxx), returned this one time — the API keeps only a hash of each. Absent (an empty object) when another method was already active: the existing codes stay as they were.

Array<string>
Example
{
"recoveryCodes": [
"k7m2-p9qx-4hzt",
"a3vb-8wnr-c6je"
]
}