Get your free beta license ↗
API operation · auth group
POST

/auth/second-factor

First published 3 Oct 20260.1.0Unchanged since publication

Start enrolment of the caller's second factor

Who may call it
AdministratorResellerCustomer
Token scope
Any
Answers200 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 server

Request body

JSON ·CurrentPassword· 1 field
current_passwordstring, up to 128 charactersRequired

Example

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 sentence
400--name is required
400Invalid username: 2 to 32 lowercase letters, digits or underscores, starting with a letter
400Username '<value>' is reserved
401Authentication required
404User '<name>' not found
409User '<name>' already has a second factor; turn it off first
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/