1. Docs
  2. API Reference
  3. Regenerate the caller's recovery codes

Regenerate the caller's recovery codes

POST/v1/auth/mfa/recovery-codes/regenerate

Issues a fresh batch of ten single-use recovery codes for the authenticated administrator, retiring every unused code of the previous batch, and returns the plaintext codes with the new recovery_codes_generation; they cannot be retrieved again. Requires a valid step-up token in the x-mfa-step-up-token header. Writes user.mfa.recovery_codes.regenerated and emails the account holder. Rate-limited to 5 requests per minute.

Authentication

Bearer TokenAuthorization

JWT access token. Never send alongside X-API-Key: a request carrying both is refused.

Headers

  • x-mfa-step-up-token required

    The step-up token `POST /v1/auth/mfa/step-up` returned, proving a second factor was answered moments ago for this administrator

Responses

application/json

  • dataMfaRecoveryCodesResponseDto*

application/json

  • errorApiErrorBodyDto*

application/json

  • errorApiErrorBodyDto*

application/json

  • errorApiErrorBodyDto*

application/json

  • errorApiErrorBodyDto*

Rate limit

5 requests per 1mPer caller: the signed-in user for a bearer token; for an API key, the key and the end user's address when a backend forwards it, otherwise the client address

Returned object

Request
curl -X POST "https://auth.canopy-io.com/v1/auth/mfa/recovery-codes/regenerate" \
  -H "x-mfa-step-up-token: value" \
  -H "Authorization: Bearer $CANOPY_TOKEN"
Response
{
  "data": {
    "recovery_codes": [
      "ABCD-EFGH-IJKL-MNOP",
      "QRST-UVWX-YZ23-4567",
      "..."
    ],
    "recovery_codes_generation": 0
  }
}
Related endpoints
GETList the caller's enrolled second factors
POSTBegin authenticator app enrollment
POSTComplete authenticator app enrollment
POSTBegin passkey enrollment
POSTComplete passkey enrollment
POSTProve a fresh second factor before a sensitive change
POSTBegin a passkey step-up
POSTComplete a passkey step-up
DELETERemove one of the caller's second factors
GETHow many recovery codes the caller has left
GETList the caller's remembered devices
DELETEForget every remembered device
DELETEForget one remembered device
Was this page helpful?

Tell us how we can improve this guide.