Skip to content
Connect an agent

Auth

Finish signing in with your authenticator code

The second step for an account with two-step sign-in: the challenge from POST /auth/verify and the code the authenticator app shows now, or a recovery code.

POST/auth/two-factor

TL;DR

QuestionAnswer
What does it do?Finish signing in with your authenticator code.
What does it take?A JSON body of type TwoFactorSignInBody.
What does it return?Status 200 with a body of type SignInResponse.
What can go wrong?400 the body is not valid; 401 the code is wrong (auth.two_factor_invalid), or the step expired (auth.two_factor_expired); 403 the request came from an origin that may not sign in, or the account is suspended; 429 too many requests. Every failure uses the one error envelope.

What it does

The second step for an account with two-step sign-in: the challenge from POST /auth/verify and the code the authenticator app shows now, or a recovery code. A right code opens the session. A wrong one counts against the step, which ends after five or ten minutes.

Request body

The body has the type TwoFactorSignInBody.

FieldTypeRequiredDescription
challengestringyespattern ^[0-9a-f]{64}$.
codestringnoThe six digits the authenticator app shows now. pattern ^\d{6}$.
recoveryCodestringnoOne of the recovery codes made when two-step sign-in was turned on. Each works once. at least 10 characters; at most 32 characters.

Responses

StatusMeaningBody
200Signed in.SignInResponse
400The body is not valid.ErrorResponse
401The code is wrong (auth.two_factor_invalid), or the step expired (auth.two_factor_expired).ErrorResponse
403The request came from an origin that may not sign in, or the account is suspended.ErrorResponse
429Too many requests.ErrorResponse

Response body

A 200 answer has the type SignInResponse.

FieldTypeRequiredDescription
userAccountyes
user.idstringyes
user.emailstringyes

See also

DocWhy
API referenceEvery endpoint, and the error envelope
SchemasEvery request and response type
Tool referenceThe operations as callable tools