Keys
Start setting up an authenticator app
Makes a new secret for an authenticator app and answers it once.
POST
/user/two-factor/setupTL;DR
| Question | Answer |
|---|---|
| What does it do? | Start setting up an authenticator app. |
| What does it take? | Nothing. |
| What does it return? | Status 200 with a body of type TwoFactorSetup. |
| What can go wrong? | 401 not signed in; 403 the request came from an origin that may not make changes; 409 two-step sign-in is already on (account.two_factor_on); 429 too many requests; 503 this server cannot set up two-step sign-in (account.two_factor_unavailable). Every failure uses the one error envelope. |
What it does
Makes a new secret for an authenticator app and answers it once. Nothing is turned on until POST /user/two-factor/enable gets a right code from the app.
Responses
| Status | Meaning | Body |
|---|---|---|
| 200 | The secret, shown once. | TwoFactorSetup |
| 401 | Not signed in. | ErrorResponse |
| 403 | The request came from an origin that may not make changes. | ErrorResponse |
| 409 | Two-step sign-in is already on (account.two_factor_on). | ErrorResponse |
| 429 | Too many requests. | ErrorResponse |
| 503 | This server cannot set up two-step sign-in (account.two_factor_unavailable). | ErrorResponse |
Response body
A 200 answer has the type TwoFactorSetup.
| Field | Type | Required | Description |
|---|---|---|---|
secret | string | yes | The shared secret in base32, for typing into an app that cannot scan. |
uri | string | yes | The otpauth:// address an authenticator app scans as a QR code. |
See also
| Doc | Why |
|---|---|
| API reference | Every endpoint, and the error envelope |
| Schemas | Every request and response type |
| Tool reference | The operations as callable tools |