API operation · auth group
POST
/auth/second-factor
First published 3 Oct 2026
0.1.0Unchanged since publicationStart enrolment of the caller's second factor
Who may call it
AdministratorResellerCustomer
Token scope
AnyAnswers200 OK
Supply current_password to start TOTP enrolment. The response contains the new secret as text and as an otpauth:// URI. Add the secret to an authenticator app, then send a code from the app to POST /auth/second-factor/confirm. The factor stays pending until confirmation.
Starting enrolment again replaces the pending secret. To replace a confirmed factor, first disable it with POST /auth/second-factor/disable.
As a command
Run as root on the servercurrent_passwordstring, up to 128 charactersRequiredExample
See the API overview for how to set $API and $TOKEN.Request
curl -sS -X POST "$API/auth/second-factor" \
-H "Authorization: Bearer $TOKEN" \
-H "Content-Type: application/json" \
-d '{
"current_password": "text"
}'Response ·
200 OK{
"account": "text",
"issuer": "text",
"pending": true,
"secret": "text",
"uri": "text"
}Errors
6 errors, each a status and a sentence400--name is required400Invalid username: 2 to 32 lowercase letters, digits or underscores, starting with a letter400Username '<value>' is reserved401Authentication required404User '<name>' not found409User '<name>' already has a second factor; turn it off firstNo error of this operation matches.
Generated from release 0.2.35 (current) · the API’s own descriptionThis entry has been unchanged since it was first published in release 0.1.0 on 3 Oct 2026.
urbestack.com/docs/api/post-auth-second-factor/