Docs

Issue a factor challenge

POST
/auth_attempts/{attempt_id}/challenges

Issues a challenge, a request to prove one factor, within an authentication attempt.

A challenge names one factor method, such as password, passkey, TOTP or OTP via SMS. The response carries the challenge's challenge_id, method, metadata and any UI hints. The client then submits the proof with verifyAuthAttemptChallenge (POST /auth_attempts/{attempt_id}/challenges/{challenge_id}/verify), using that challenge_id.

Authorization

oauth2 auth_attempt.write
headerAuthorizationBearer <token>

Scope: auth_attempt.write

Path Parameters

attempt_id*string

The attempt_id that createAuthAttempt (POST /auth_attempts) returns.

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

Request Body

application/json
  1. body

Request to issue a challenge for one factor.

The method field selects which factor to challenge. Additional fields are only relevant for specific methods:

  • passkey_options is optional and only used when method is passkey.
  • idp_provider is required when method is idp and must be omitted otherwise. The server enforces this conditional requirement.
method*challenge-method

The authentication factor method to challenge.

Value in"identifier""password""passkey"
passkey_options?

Optional WebAuthn ceremony options. Only relevant when method is passkey.

Response Body

The issued challenge.

application/json
  1. response

A challenge issued within an authentication attempt.

A challenge asks the user to prove one factor: a password, a TOTP code, a passkey assertion and so on. The client submits the proof with verifyAuthAttemptChallenge (POST /auth_attempts/{attempt_id}/challenges/{challenge_id}/verify) (POST /auth_attempts/{attempt_id}/challenges/{challenge_id}/verify).

challenge_id*challenge-id

The unique identifier of this challenge, an opaque string with a ch_ prefix.

Match^ch_[a-zA-Z0-9_-]+$
method*challenge-method

The authentication method this challenge represents. It determines which proof verifyAuthAttemptChallenge (POST /auth_attempts/{attempt_id}/challenges/{challenge_id}/verify) expects.

Value in"identifier""password""passkey"
state*string

Current state of this challenge:

  • pending: awaiting proof submission
  • failed: proof rejected (invalid credential, wrong code, etc.)
  • expired: the challenge's lifetime passed without a verified proof
Value in"pending""failed""expired"
created_at*string

When this challenge was issued.

Formatdate-time
expires_at?|

When this challenge expires.

payload?||

Method-specific challenge data. Structure depends on the method field.

  • identifier, password: null (no additional data needed)
  • passkey: WebAuthn challenge and credential options
  • idp: Authorization URL and provider information
Example Request
import { createZitadelApi, ZitadelClient } from "@zitadel/api/client";const api = createZitadelApi(  new ZitadelClient({    baseUrl: process.env.ZITADEL_URL ?? "http://localhost:8080",    token: process.env.ZITADEL_PROJECT_SECRET!, // server-side only  }),);const authAttemptChallenge = await api.createAuthAttemptChallenge(  "att_01J0Z9KX7Y0Q2Y7JX5M9K2YF3C",  { method: "identifier" },);
Example Response
{  "challenge_id": "string",  "method": "identifier",  "state": "pending",  "created_at": "2019-08-24T14:15:22Z",  "expires_at": "2019-08-24T14:15:22Z",  "payload": {}}

Was this helpful?