Issue a factor challenge
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.
oauth2 auth_attempt.writeAuthorizationBearer <token>Scope: auth_attempt.write
attempt_id*stringThe attempt_id that createAuthAttempt (POST /auth_attempts) returns.
^att_[a-zA-Z0-9_-]+$application/json- 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_optionsis optional and only used whenmethodispasskey.idp_provideris required whenmethodisidpand must be omitted otherwise. The server enforces this conditional requirement.
method*challenge-methodThe authentication factor method to challenge.
"identifier""password""passkey"passkey_options?Optional WebAuthn ceremony options. Only relevant when method is passkey.
The issued challenge.
application/json- 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-idThe unique identifier of this challenge, an opaque string with a ch_ prefix.
^ch_[a-zA-Z0-9_-]+$method*challenge-methodThe authentication method this challenge represents.
It determines which proof verifyAuthAttemptChallenge (POST /auth_attempts/{attempt_id}/challenges/{challenge_id}/verify) expects.
"identifier""password""passkey"state*stringCurrent state of this challenge:
pending: awaiting proof submissionfailed: proof rejected (invalid credential, wrong code, etc.)expired: the challenge's lifetime passed without a verified proof
"pending""failed""expired"created_at*stringWhen this challenge was issued.
date-timeexpires_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 optionsidp: Authorization URL and provider information
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" },);{ "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?