Docs

Begin a passkey registration

POST
/users/{user_id}/passkeys/registrations

Starts a WebAuthn registration ceremony for the user and returns the creation options for navigator.credentials.create(). A passkey is registered in two steps: this one returns options for the browser, and completeUserPasskeyRegistration (POST /users/{user_id}/passkeys/registrations/{registration_id}) verifies the browser's answer.

Complete the ceremony with POST /users/{user_id}/passkeys/registrations/{registration_id} within five minutes, using the registration_id this response returns. Credentials already registered for the user are excluded automatically.

Authorization

oauth2 user.write
headerAuthorizationBearer <token>

Scope: user.write

Path Parameters

user_id*string

The user ID: the id that createUser (POST /users) or queryUsers (POST /users/query) returns.

Match^user_[a-zA-Z0-9_-]+$

Request Body

application/json
  1. body

The request body for beginning a WebAuthn registration ceremony for the user.

Management callers are not browsers, so the relying-party parameters cannot be derived from an Origin header and must be supplied explicitly.

rp_id*string

The relying party ID, the domain the credential is scoped to.

Length1 <= length
rp_origins*array<>

The origins allowed for this ceremony's attestation.

Items1 <= items
username?string

The account label the browser shows in its credential picker. Optional: when omitted, a neutral default is used.

display_name?string

The display name the browser shows. Optional; defaults to the username.

Response Body

The started registration ceremony.

application/json
  1. response

The started registration ceremony.

registration_id*string

The ID of this ceremony. Pass it back as registration_id on POST /users/{user_id}/passkeys/registrations/{registration_id}, together with the attestation.

options*

The PublicKeyCredentialCreationOptions object, passed directly to the browser's navigator.credentials.create().

Example Request
import { createZitadelClient } from "@zitadel/api/client";const client = createZitadelClient({  baseUrl: process.env.ZITADEL_URL ?? "http://localhost:8080",  token: process.env.ZITADEL_PROJECT_SECRET!, // server-side only});const userPasskeyRegistration = await client.createUserPasskeyRegistration(  "user_01KWH3B72K7M7F0N9WD3P2E4YM",  { rp_id: "string", rp_origins: ["http://example.com"] },);
Example Response
{  "registration_id": "string",  "options": {}}

Was this helpful?