---
agent:
  instructions: "Use this search API to find relevant content across this site with keywords or natural-language queries, instead of crawling individual pages. Results are returned in Markdown."
  endpoint: "https://truto.one/.well-known/search?q={query}"
  method: "GET"
  documentation: "https://developers.cloudflare.com/ai-search/how-to/search-for-agents/"
---

# Start setting up a passkey as the second factor

> Source: https://truto.one/docs/api-reference/admin/passkeys/mfa-setup-registration-options/

`POST /auth/passkey/mfa-setup/registration/options`

Resource: **Passkeys**

Unauthenticated, during sign-in. When a team requires two factors and the account has none, sign-in answers `mfa_setup_required` with an `mfa_token` (purpose `mfa_setup`) and `mfa_setup_methods`, the factors it may set up, passkey first: `["passkey", "totp"]`, or `["totp"]` where `PASSKEY_MFA` is off. `POST /auth/login` returns them in its JSON body (`{ "mfa_setup_required": true, "mfa_token": "…", "mfa_setup_methods": ["passkey", "totp"] }`); a browser sign-in redirects to the app's `/auth/mfa/setup?mfa_token=…&mfa_setup_methods=passkey,totp`. Offer a passkey only when it is listed. The account can set up an authenticator app (`/auth/mfa/token/setup`) or a passkey here.

Issues the `PublicKeyCredentialCreationOptionsJSON` for `navigator.credentials.create()` (discoverable, user verification required) and stores the challenge server-side against the account for 5 minutes; a new call replaces it. Finish with `POST /auth/passkey/mfa-setup/registration/verify`. No step-up: the `mfa_token` is the proof, as for the authenticator app.

Only for an account with no second factor yet: one with an authenticator app or a passkey is a 400. At most ten calls per minute per account (429 with `Retry-After`).

## Request body

- **`mfa_token`** _(string)_
  The `mfa_token` from the sign-in that answered `mfa_setup_required`.

## Response body

- **`rp`** _(object)_
  Relying party. `id` is the environment's `APP_URL` host, so a passkey registered on one environment is never offered on another.
  - **`id`** _(string)_
  - **`name`** _(string)_
- **`user`** _(object)_
  User handle the authenticator groups credentials under. `id` is the base64url-encoded Truto user id.
  - **`id`** _(string)_
  - **`name`** _(string)_
  - **`displayName`** _(string)_
- **`challenge`** _(string)_
  base64url challenge. Single-use, stored server-side for 5 minutes.
- **`pubKeyCredParams`** _(array<object>)_
  Offered algorithms — Ed25519 (-8), ES256 (-7), RS256 (-257).
  - **`alg`** _(number)_
  - **`type`** _(string)_
- **`timeout`** _(number)_
  Browser-side ceremony timeout in milliseconds.
- **`attestation`** _(string)_
  v1 asks for no attestation.
  Allowed: `none`
- **`excludeCredentials`** _(array<object>)_
  The user's existing credentials, so an authenticator they already enrolled refuses to register a duplicate.
  - **`id`** _(string)_
  - **`type`** _(string)_
  - **`transports`** _(array<string>)_
- **`authenticatorSelection`** _(object)_
  `residentKey: required` because sign-in is usernameless, and `userVerification: required` so every assertion carries a second factor — which is what lets a passkey login satisfy `mfa_required`.
  - **`residentKey`** _(string)_
  - **`requireResidentKey`** _(boolean)_
  - **`userVerification`** _(string)_
- **`extensions`** _(object)_
  Client extensions the library asks for. `credProps` lets the browser report back whether the credential really was created as discoverable.
  - **`credProps`** _(boolean)_
- **`hints`** _(array<string>)_
  Always empty — v1 gives the browser no authenticator hints.

## Errors

| Status | Description |
| :----- | :---------- |
| `400` | Missing, expired or wrong-purpose `mfa_token`, the account already has a second factor, unknown body keys, or a body that is not JSON. |
| `403` | The account is turned off, or its organization enforces SSO (non-staff). |
| `404` | Passkeys are not enabled for this environment, or a passkey does not count as a second factor here yet (`PASSKEY_MFA` is off). |
| `429` | Too many calls for this account or from this IP. |

## Code examples

### curl

```bash
curl -X POST 'https://api.truto.one/auth/passkey/mfa-setup/registration/options' \
  -H 'Authorization: Bearer <your_api_token>' \
  -H 'Content-Type: application/json' \
  -d '{
  "mfa_token": "your_mfa_token"
}'
```

### JavaScript

```javascript
const body = {
  "mfa_token": "your_mfa_token"
};

const response = await fetch('https://api.truto.one/auth/passkey/mfa-setup/registration/options', {
  method: 'POST',
  headers: {
    'Authorization': 'Bearer <your_api_token>',
    'Content-Type': 'application/json',
  },
  body: JSON.stringify(body),
});

const data = await response.json();
console.log(data);
```

### Python

```python
import requests

url = "https://api.truto.one/auth/passkey/mfa-setup/registration/options"
headers = {
    "Authorization": "Bearer <your_api_token>",
    "Content-Type": "application/json",
}
params = {
}
payload = {
    "mfa_token": "your_mfa_token"
}

response = requests.post(url, headers=headers, params=params, json=payload)
print(response.json())
```
