API Reference
Set up TOTP for a new user
POST
/api/auth/setup-totp
Generates a TOTP secret for a user who doesn't have one yet. Requires a pending browser session (from login). The user must verify the code via /api/auth/verify-totp to complete enrollment. If an unverified enrollment was abandoned, clients may send force: true to restart enrollment and replace the unverified secret.
Operation IDsetupTotp
Authentication
No authentication is required.
Request body
Content typeapplication/json
requestobject1 property
forcebooleanReplace an existing unverified TOTP secret for this pending session
Success response body
200TOTP enrollment data
TOTP enrollment data
Content typeapplication/json
responseobject2 properties
totp_secretstringtotp_uristringError responses
400TOTP already configured, or enrollment already started and `force` was not provided
TOTP already configured, or enrollment already started and force was not provided
Content typeapplication/json
responseobject2 properties
errorstringmessagestring401Not authenticated
Not authenticated
Content typeapplication/json
responseobject2 properties
errorstringmessagestringExample response
{
"error": "AUTH_ERROR",
"message": "Not authenticated"
}429Too many requests
Too many requests
Content typeapplication/json
responseobject2 properties
errorstringmessagestringExample response
{
"error": "RATE_LIMITED",
"message": "Too many failed TOTP attempts. Try again later."
}