Skip to content
Connect an agent

Keys

Make new recovery codes

Makes ten new one-time recovery codes, proved with the current code, and answers them once.

POST/user/two-factor/recovery-codes

TL;DR

QuestionAnswer
What does it do?Make new recovery codes.
What does it take?A JSON body of type TotpCodeBody.
What does it return?Status 200 with a body of type RecoveryCodes.
What can go wrong?400 the body is not valid; 401 not signed in, or the code is wrong (auth.two_factor_invalid); 403 the request came from an origin that may not make changes; 409 two-step sign-in is not on (account.two_factor_off); 429 too many requests. Every failure uses the one error envelope.

What it does

Makes ten new one-time recovery codes, proved with the current code, and answers them once. The old ones stop working.

Request body

The body has the type TotpCodeBody.

FieldTypeRequiredDescription
codestringyesThe six digits the authenticator app shows now. pattern ^\d{6}$.

Responses

StatusMeaningBody
200The new codes.RecoveryCodes
400The body is not valid.ErrorResponse
401Not signed in, or the code is wrong (auth.two_factor_invalid).ErrorResponse
403The request came from an origin that may not make changes.ErrorResponse
409Two-step sign-in is not on (account.two_factor_off).ErrorResponse
429Too many requests.ErrorResponse

Response body

A 200 answer has the type RecoveryCodes.

FieldTypeRequiredDescription
recoveryCodesstring[]yes

See also

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