Skip to content

Verifies the code that was mailed to the user after a login from an unknown device, and logs the user in.

POST
/api/v1/user/login/verify

The response is the normal login response plus a deviceToken. Send that token as the X-Btcd-Device-Token header with every following login from this device: it keeps the device trusted for 90 days after its last use, until the user changes their password.

A wrong code, an unknown or an expired challenge all give ER922. After 5 wrong attempts on the same code the challenge is gone and the user has to log in again. A challenge expires 10 minutes after the login.

object
challengeId

The challengeId from the ER921 login response.

string
Example
9f86d081884c7d659a2feaa0c55ad015a3bf4f1b2b0b822cd15d6c15b0f00a08
code

The 6-digit verification code the user received by email.

string
Example
123456

Code verified, user logged in. Same body as a successful POST /api/v1/user/login, plus deviceToken.

object
uuid

UUID of the user.

string format: string
Example
60bd85f1-1b05-427f-9226-915b6b13f39e
token

Authentication token. Use this to request resources requiring user authentication.

string format: string
Example
eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJzdWIiOiIxMjM0NTY3ODkwIiwibmFtZSI6IkpvaG4gRG9lIiwiaWF0IjoxNTE2MjM5MDIyfQ.SflKxwRJSMeKKF2QT4fwpMeJf36POk6yJV_adQssw5c
refreshToken

Refresh token. Use this to request a new authenticatoin token.

string format: string
Example
eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJzdWIiOiIxMjM0NTY3ODkwIiwibmFtZSI6IkpvaG4gRG9lIiwiaWF0IjoxNTE2MjM5MDIyfQ.SflKxwRJSMeKKF2QT4fwpMeJf36POk6yJV_adQssw5c
deviceToken

Send as the X-Btcd-Device-Token header on the next logins from this device.

string
Example
b5bb9d8014a0f9b1d61e21e796d78dccdf1352f23cd32812f4850b878ae4944c

A list of possible errors for this endpoint.

object
code
required
string
Allowed values: ER048 ER800 ER801 ER802 ER803 ER805 ER806 ER922 ER999
message
required
string
solution
required
string
Example
{
"errors": {
"ER048": {
"code": "ER048",
"message": "Invalid JSON data provided.",
"solution": "Provide valid JSON data."
},
"ER800": {
"code": "ER800",
"message": "Authorization token is invalid.",
"solution": "Provide a valid authorization token."
},
"ER801": {
"code": "ER801",
"message": "Authorization token has expired.",
"solution": "Request a new authorization token."
},
"ER802": {
"code": "ER802",
"message": "Authorization token not found.",
"solution": "Provide an authorization token."
},
"ER803": {
"code": "ER803",
"message": "Multiple authorization methods used.",
"solution": "Use exactly one authorization method."
},
"ER805": {
"code": "ER805",
"message": "API key is invalid.",
"solution": "Provide a valid API key."
},
"ER806": {
"code": "ER806",
"message": "API key not found.",
"solution": "Provide an API key."
},
"ER922": {
"code": "ER922",
"message": "Invalid or expired verification code.",
"solution": "Ask the user to check the code, request a new one via POST /api/v1/user/login/verify/resend, or log in again."
},
"ER999": {
"code": "ER999",
"message": "A general error has occurred. Please contact our support team.",
"solution": "Contact our support team."
}
}
}