Multi-Factor Authentication API Routes
Multi-factor authentication (MFA) adds an extra layer of security to admin accounts by requiring additional verification factors during login, such as a TOTP code or a recovery code. These API routes allow admin users to manage their MFA factors, challenges, and recovery codes.
POST /auth/mfa/challenges/{id}/verify#
Verify a Multi-Factor Authentication (MFA) Challenge
Verify a multi-factor authentication (MFA) challenge issued during login. On success, this completes the authentication flow and returns a JWT token that can be used to authenticate subsequent requests.
Authentication: none.
Path parameters
idstringRequest body (application/json)
methodstringtotp or recovery-code).codestringRequest examples
Responses
200 OK
400, 401, 404, 409, 422, 500: an error response is returned.
GET /auth/mfa/factors#
List Multifactor Authentication (MFA) Factors
Retrieve the list of multi-factor authentication (MFA) factors registered for the authenticated user, including both pending (not yet verified) and enabled factors.
Authentication: none.
Request examples
Responses
200 OK
400, 401, 404, 409, 422, 500: an error response is returned.
POST /auth/mfa/factors#
Start Multi-Factor Authentication (MFA) Factor Enrollment
Start the enrollment of a new multi-factor authentication (MFA) factor for the authenticated
user. The response contains the factor along with provider-specific setup data (such as a
secret and an otpauth_url for TOTP) that can be used to display a QR code. The factor must
then be verified via the verify endpoint before it can be used.
Authentication: none.
Request body (application/json)
providerstringtotp).labelstringOptionalissuerstringOptionalmetadataobjectOptionalRequest examples
Responses
200 OK
400, 401, 404, 409, 422, 500: an error response is returned.
POST /auth/mfa/factors/{id}/verify#
Verify and Enable a Multi-Factor Authentication (MFA) Factor
Verify a pending multi-factor authentication (MFA) factor by submitting a code generated from it. A successful verification enables the factor, after which it can be used to verify MFA challenges during login.
Authentication: none.
Path parameters
idstringRequest body (application/json)
codestringRequest examples
Responses
200 OK
400, 401, 404, 409, 422, 500: an error response is returned.
POST /auth/mfa/recovery-codes#
Generate Multi-Factor Authentication (MFA) Recovery Codes
Generate a new set of single-use recovery codes for the authenticated user. Recovery codes can be used to verify MFA challenges when the user does not have access to their primary MFA factor. Generating new codes replaces any previously issued codes, so they should be stored in a safe place. At least one enabled MFA factor is required to generate recovery codes.
Authentication: none.
Request body (application/json)
countnumberOptionalRequest examples
Responses
200 OK
400, 401, 404, 409, 422, 500: an error response is returned.