Enable 2FA
Initiate the two-factor authentication setup process. Returns a QR code and secret that the user can scan with an authenticator app.Response
Indicates if the request was successful
Status message
Base64-encoded QR code image that can be scanned by authenticator apps (Google Authenticator, Authy, etc.)
The base32-encoded secret key (for manual entry into authenticator apps)
Error Responses
After calling this endpoint, the user should scan the QR code with their authenticator app and then call the verify endpoint to complete the setup.
Verify 2FA
Complete the 2FA setup by verifying a code from the authenticator app. This confirms that the user has successfully configured their authenticator.Request Body
The 6-digit code from the authenticator app
Response
Indicates if the request was successful
Success message
Error Responses
Scan QR Code
Have the user scan the QR code with their authenticator app (Google Authenticator, Authy, Microsoft Authenticator, etc.)
Verify Code
User enters the 6-digit code from their authenticator app, which is then sent to
/api/security/2fa/verifyThe verification process uses a time-based one-time password (TOTP) algorithm with a window of 2, allowing codes from the current time period as well as one period before and after to account for clock drift.