Regenerate Backup Codes
POST
/api/auth/mfa/backup-codes/regenerate
const url = 'https://example.com/api/auth/mfa/backup-codes/regenerate';const options = { method: 'POST', headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'}, body: '{"current_password":"example","otp_code":"example"}'};
try { const response = await fetch(url, options); const data = await response.json(); console.log(data);} catch (error) { console.error(error);}curl --request POST \ --url https://example.com/api/auth/mfa/backup-codes/regenerate \ --header 'Authorization: Bearer <token>' \ --header 'Content-Type: application/json' \ --data '{ "current_password": "example", "otp_code": "example" }'Invalidate all unused backup codes and issue 10 new ones. Same re-auth bar as /disable (current password + OTP).
Authorizations
Section titled “ Authorizations ”Request Bodyrequired
Section titled “ Request Bodyrequired ” Media type application/json
MfaBackupCodesRegenerateRequest
object
current_password
required
Current Password
string
otp_code
required
Otp Code
string
Example generated
{ "current_password": "example", "otp_code": "example"}Responses
Section titled “ Responses ”Successful Response
Media type application/json
MfaBackupCodesResponse
object
backup_codes
required
Backup Codes
Array<string>
Example generated
{ "backup_codes": [ "example" ]}Validation Error
Media type application/json
HTTPValidationError
object
detail
Detail
Array<object>
ValidationError object
ctx
Context
object
input
Input
loc
required
Location
Array
msg
required
Message
string
type
required
Error Type
string
Example generated
{ "detail": [ { "ctx": {}, "input": "example", "loc": [ "example" ], "msg": "example", "type": "example" } ]}