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

/auth/second-factor/confirm

First published 3 Oct 20260.1.0Unchanged since publication

Confirm the caller's pending second factor

Who may call it
AdministratorResellerCustomer
Token scope
Any
Answers200 OK

Send the six-digit code from the authenticator app in code. Surrounding whitespace is allowed. A missing code or a code in any other format returns 400.

After confirmation, signing in requires a second step. The response contains eight single-use recovery codes, shown only once. Each code can replace an authenticator app code for one sign-in.

On a server that requires a second factor for administrators, confirmation grants the all scope to the session used for the request if that session was opened solely for enrolment and its scopes are still empty. The all scope excludes export, which covers export and import.

As a command

Run as root on the server

Request body

JSON ·SecondFactorConfirm· 1 field
codestring, up to 16 charactersRequired
Six-digit code displayed by the authenticator app.

Example

See the API overview for how to set $API and $TOKEN.
Request
curl -sS -X POST "$API/auth/second-factor/confirm" \
  -H "Authorization: Bearer $TOKEN" \
  -H "Content-Type: application/json" \
  -d '{
    "code": "text"
  }'
Response · 200 OK
{
  "confirmed_at": "text",
  "enabled": true,
  "recovery_codes": [
    "text"
  ]
}

Errors

11 errors, each a status and a sentence
400--code is the six digits the app shows
400--name is required
400Invalid id
400Invalid username: 2 to 32 lowercase letters, digits or underscores, starting with a letter
400The code does not match; check the secret in the app and the clock of the device
400The code is the six digits the app shows
400Unknown scope '<s>'; the scopes are
400Username '<value>' is reserved
401Authentication required
404User '<name>' not found
409User '<name>' has no enrolment pending; start one 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-confirm/