Documentation Index
Fetch the complete documentation index at: https://mintlify.com/cgwire/zou/llms.txt
Use this file to discover all available pages before exploring further.
Overview
Zou supports multiple two-factor authentication (2FA) methods:- TOTP (Time-based One-Time Password) - Using authenticator apps like Google Authenticator, Authy
- Email OTP - One-time passwords sent via email
- FIDO/WebAuthn - Hardware security keys and platform authenticators
- Recovery Codes - Backup codes for account recovery
Organizations can enforce 2FA for all users. When enforcement is enabled, users must configure at least one 2FA method before gaining full access.
TOTP (Time-based One-Time Password)
Pre-enable TOTP
PUT /api/auth/totp
Prepare TOTP for enabling. Returns provisioning URI and secret for authenticator app setup.Headers
Bearer token for authenticationFormat:
Bearer <access_token>Response
Provisioning URI for QR code generation (can be used with authenticator apps)Example:
otpauth://totp/Zou:user@example.com?secret=ABCD1234&issuer=ZouTOTP secret key (can be manually entered in authenticator app)Example:
ABCD1234EFGH5678Status Codes
200- TOTP pre-enabled successfully400- TOTP already enabled401- Invalid or missing token
Enable TOTP
POST /api/auth/totp
Enable TOTP authentication. Requires verification code from authenticator app.Headers
Bearer token for authenticationFormat:
Bearer <access_token>Request Body
TOTP verification code from authenticator appExample:
123456Response
Array of recovery codes for account recoveryExample:
["ABCD-EFGH-IJKL-MNOP", "QRST-UVWX-YZ12-3456"]New access token without 2FA setup restrictions
New refresh token
Status Codes
200- TOTP enabled successfully400- TOTP already enabled or verification failed401- Invalid or missing token
Disable TOTP
DELETE /api/auth/totp
Disable TOTP authentication. Requires two-factor authentication verification.Headers
Bearer token for authenticationFormat:
Bearer <access_token>Request Body
TOTP verification code
Email OTP verification code
FIDO authentication response
Recovery code for two-factor authentication
At least one 2FA method must be provided to disable TOTP.
Response
Whether TOTP was disabled successfully
Status Codes
200- TOTP disabled successfully400- TOTP not enabled or verification failed401- Invalid or missing token
Email OTP
Send Email OTP
GET /api/auth/email-otp
Send a one-time password by email to the user for authentication.Query Parameters
User email addressExample:
user@example.comResponse
Whether OTP was sent successfully
Status Codes
200- OTP sent successfully400- OTP by email not enabled404- User not found
Pre-enable Email OTP
PUT /api/auth/email-otp
Prepare email OTP for enabling. An OTP code will be sent to the user’s email address.Headers
Bearer token for authenticationFormat:
Bearer <access_token>Response
Whether email OTP pre-enable was successful
Status Codes
200- Email OTP pre-enabled, code sent400- Email OTP already enabled401- Invalid or missing token
Enable Email OTP
POST /api/auth/email-otp
Enable email OTP authentication. Requires verification code sent to email.Headers
Bearer token for authenticationFormat:
Bearer <access_token>Request Body
Email OTP verification codeExample:
123456Response
Array of recovery codes for account recovery
New access token without 2FA setup restrictions
New refresh token
Status Codes
200- Email OTP enabled successfully400- Email OTP already enabled or verification failed401- Invalid or missing token
Disable Email OTP
DELETE /api/auth/email-otp
Disable email OTP authentication. Requires two-factor authentication verification.Headers
Bearer token for authenticationFormat:
Bearer <access_token>Request Body
TOTP verification code
Email OTP verification code
FIDO authentication response
Recovery code for two-factor authentication
Response
Whether email OTP was disabled successfully
Status Codes
200- Email OTP disabled successfully400- Email OTP not enabled or verification failed401- Invalid or missing token
FIDO/WebAuthn
Get FIDO Challenge
GET /api/auth/fido
Get a challenge for FIDO device authentication. Used for WebAuthn authentication flow.Query Parameters
User email addressExample:
user@example.comResponse
Returns WebAuthn challenge object for authentication.Status Codes
200- FIDO challenge generated400- FIDO not enabled404- User not found
Pre-register FIDO Device
PUT /api/auth/fido
Prepare FIDO device for registration. Returns registration options for WebAuthn.Headers
Bearer token for authenticationFormat:
Bearer <access_token>Response
Returns WebAuthn registration options object.Status Codes
200- FIDO device pre-registered401- Invalid or missing token
Register FIDO Device
POST /api/auth/fido
Register a FIDO device for WebAuthn authentication. Requires registration response from the device.Headers
Bearer token for authenticationFormat:
Bearer <access_token>Request Body
FIDO device registration response from WebAuthn API
Name for the FIDO deviceExample:
YubiKey 5, Touch ID, Windows HelloResponse
Array of recovery codes for account recovery
New access token without 2FA setup restrictions
New refresh token
Status Codes
200- FIDO device registered successfully400- Registration failed or no preregistration401- Invalid or missing token
Unregister FIDO Device
DELETE /api/auth/fido
Unregister a FIDO device from WebAuthn authentication. The user must be authenticated.Headers
Bearer token for authenticationFormat:
Bearer <access_token>Request Body
Name of the FIDO device to unregister
Response
Whether device was unregistered successfully
Status Codes
200- FIDO device unregistered successfully400- FIDO not enabled401- Invalid or missing token
Recovery Codes
Generate New Recovery Codes
PUT /api/auth/recovery-codes
Generate new recovery codes for two-factor authentication. Requires two-factor authentication verification. Previous recovery codes will be invalidated.Headers
Bearer token for authenticationFormat:
Bearer <access_token>Request Body
TOTP verification code
Email OTP verification code
FIDO authentication response
Recovery code for two-factor authentication
At least one 2FA method must be provided to generate new recovery codes.
Response
Array of new recovery codesExample:
["ABCD-EFGH-IJKL-MNOP", "QRST-UVWX-YZ12-3456"]Status Codes
200- New recovery codes generated400- No 2FA enabled or verification failed401- Invalid or missing token
2FA Enforcement
When 2FA enforcement is enabled (ENFORCE_2FA config), users must configure at least one 2FA method.
Enforcement Flow
- User logs in with email and password
- If 2FA is not configured, login succeeds but with restricted access
- Access token includes
requires_2fa_setupclaim - User can only access 2FA setup endpoints
- After configuring 2FA, new tokens are issued without restrictions
Login Response with 2FA Required
two_factor_authentication_required flag indicates that 2FA setup is required before gaining full access.