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-factorTL;DR
| Question | Answer |
|---|---|
| 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.
| Field | Type | Required | Description |
|---|---|---|---|
challenge | string | yes | pattern ^[0-9a-f]{64}$. |
code | string | no | The six digits the authenticator app shows now. pattern ^\d{6}$. |
recoveryCode | string | no | One 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
| Status | Meaning | Body |
|---|---|---|
| 200 | Signed in. | SignInResponse |
| 400 | The body is not valid. | ErrorResponse |
| 401 | The code is wrong (auth.two_factor_invalid), or the step expired (auth.two_factor_expired). | ErrorResponse |
| 403 | The request came from an origin that may not sign in, or the account is suspended. | ErrorResponse |
| 429 | Too many requests. | ErrorResponse |
Response body
A 200 answer has the type SignInResponse.
| Field | Type | Required | Description |
|---|---|---|---|
user | Account | yes | |
user.id | string | yes | |
user.email | string | yes |
See also
| Doc | Why |
|---|---|
| API reference | Every endpoint, and the error envelope |
| Schemas | Every request and response type |
| Tool reference | The operations as callable tools |