Start typing to search.

API Reference

Set up TOTP for a new user

View Markdown
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

requestobject
1 property
forceboolean

Replace an existing unverified TOTP secret for this pending session

Success response body

200TOTP enrollment data

TOTP enrollment data

Content typeapplication/json

responseobject
2 properties
totp_secretstring
totp_uristring

Error 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

responseobject
2 properties
errorstring
messagestring

401Not authenticated

Not authenticated

Content typeapplication/json

responseobject
2 properties
errorstring
messagestring
Example response
{
  "error": "AUTH_ERROR",
  "message": "Not authenticated"
}

429Too many requests

Too many requests

Content typeapplication/json

responseobject
2 properties
errorstring
messagestring
Example response
{
  "error": "RATE_LIMITED",
  "message": "Too many failed TOTP attempts. Try again later."
}