Submit a flow step
Submits the user's input for the current step of a flow. The server
validates it, processes it (for example, verifies a credential), advances
the flow through any invisible steps, and returns the next visible step.
The flow endpoints are the runtime calls the login component
(<zitadel-login>) makes, step by step; createFlow (POST /flows) starts a flow.
The browser sends the flow's encrypted HttpOnly cookie,
_zflow_{flow_id}, and the response sets it again with the new flow
state. The server is stateless: all orchestration state is carried in
this cookie between requests. A request without it answers 401 with
flow.cookie_invalid.
Sign-up additionally requires a single-use gate_proofs.signup_pow
solution for step.gates.signup_pow: a password sign-up (create_user)
sends it with the submit, and a passkey registration that creates its user
sends it with the attestation in challenge_response. Pending
challenges and rate counters are stored on the server. Invalid or spent
proofs return 403 flow.proof_invalid; exhausted per-flow budgets return
429 flow.rate_limited. GET the current step to obtain or refresh its
challenge before solving. Start and Submit announce the gate without a puzzle.
Important: The id in the response may differ from the id used in
the request. This happens when a flow pivots (pushes a new flow onto the
stack) or when a stacked flow completes (auto-pops to the parent flow).
Always use the id from the latest response for the next request: the
cookie moves with it, to _zflow_{id}, and the response deletes the
one under the old id.
Flow completion
When step.type is complete, the flow is terminal. The step.behavior
field tells the frontend what to do:
behavior | Action |
|---|---|
redirect | Navigate to redirect_uri (OIDC/SAML auth request done). |
show | Render the step as a success screen, such as registration. |
A complete step is only returned when the entire flow stack is done.
If a stacked flow (for example, recovery pivoted from login) finishes, the
server auto-pops to the parent flow and returns the parent's next step.
The frontend never sees a complete for intermediate flows.
External sign-in
{action: "sso", sso_provider_id, return_target} on a step that offers
sso_providers returns the server-emitted sso-redirect step, whose
redirect_url the frontend navigates to.
- The flow state does not change, but its cookie is re-sealed like on every response, so its ten-minute window restarts at this submission; the external sign-in and the return must complete within it.
- A second
Set-Cookieline carries the browser-binding cookie the callback checks:HttpOnly,Path=/,SameSite=Lax. - On every host except http loopback it is
__Host-_zssowithSecure. - When the request host is http loopback (local development, where
Safari rejects
Secure), it is_zssowith noSecure; the__Host-prefix is dropped because it requiresSecure.
An identity provider (an external sign-in such as Google) whose
client_id is a ${{ NAME }} reference has it filled from the project's
variables. A provider the server cannot start a sign-in with, including a
reference with no variable behind it, re-renders the step with
error.sso_unavailable.
Reuses the deployment sealed into the flow's cookie at createFlow; it
does not re-resolve from Origin. If that release was revoked since the attempt
started, the response is 409 with rel.revoked.
flow_id*stringFlow ID returned by POST /flows or the latest POST /flows/{flow_id}/submit.
Names the flow's encrypted cookie, _zflow_{flow_id}, which holds its
state; each flow in a browser has its own. May change between responses
when a flow pivot or pop occurs — always use the id from the latest response.
Origin?stringStandard browser Origin header. When a step issues a passkey
challenge, the server derives the WebAuthn relying-party ID and the
allowed origin from this value. An sso submission is bound to it as
well: return_target must be on this origin, and the callback route
is built under it (see External sign-in above). Browsers send it
automatically on the fetch POST; no client action is required.
uriapplication/json- body
The request body for submitting the current step of a flow.
session_token?stringReserved for future rotation. The flow's sealed _zflow_{flow_id} cookie carries the flow state today.
action*stringWhich action to take. Must be a key from the step's actions dictionary:
- A regular action (for example "submit", "register" or "back")
- The reserved value "sso", which triggers an SSO redirect (requires
sso_provider_id)
A name the current step does not declare is refused with 400
(flow.invalid_action). That includes the outcome names the server
routes on its own (user_not_found, user_already_exists,
sso_user_not_found, sso_authenticated), which are never actions.
fields?User input values. Keys match field names from the step's fields
dictionary. On the consent step, accept takes scopes: the list of
scope names the user grants (see the step's consent).
gate_proofs?Solutions for security gates. Keys match gate names from the step's gates dictionary.
For sign-up, the login component solves the built-in challenge with Web
Crypto and submits its JSON proof under signup_pow: with the password
for a password sign-up, and with challenge_response for a passkey
registration that creates the user.
challenge_response?Response to a pending challenge on the step. Required when the step has a
challenge property (for example, after submitting a passkey action).
The <zl-passkey> component populates this after the WebAuthn ceremony.
sso_provider_id?stringID of the selected SSO provider (from sso_providers[].id).
Required when action is "sso".
return_target?stringThe page hosting the login component, where the flow resumes after an
external sign-in: the callback sends the browser here unchanged, and
the page loads GET /flows/{flow_id} to render the next step. The client
puts the flow ID in it; the login component reads ?flow=<id> on the
reload. Required when action is "sso". An absolute URL; the server
parses it and keeps a fragment, so a hash-routed page returns to its
route. Its origin must equal the request origin; any other origin is
rejected and no sign-in is started.
length <= 2048The next step. The id may have changed if a pivot or stack-pop
occurred, so always use the returned id for the next request.
application/json- response
The state of a flow, with its handle, its session and the step to render.
id*stringFlow handle. Use this as the path parameter for subsequent
submit/event calls. May change between responses when a
flow pivot or pop occurs. Empty when a prompt=none request is
refused because no flow can start for it: nothing is left to submit.
session_id*stringUnderlying session ID. Stable across all stacked flows. Empty when a flow for an authorization request ends as it starts with a refusal, which no session is behind; the browser's live session when it ends with the code.
session_token?stringReserved for future rotation. The flow's sealed _zflow_{flow_id} cookie carries the flow state today.
step*The step the login component renders now. A step is one screen of a flow.
It holds ordered arrays of what to collect (fields), what the user can do
(actions), and which security checks must pass (gates). The LiquidJS template
in branding.liquid_template iterates these arrays in order and builds
name-keyed indexes locally for lookup.
branding?Resolved branding inherited from the app → team → project hierarchy. Determined at flow creation based on audience context. Does not change between steps.
client?The client whose authorization request the flow answers. Present on
every response of a flow started with auth_request_id, absent on
any other.
redirect_uri?stringPresent when step.complete is redirect.
urihandoff_token?stringShort-lived, audience-bound token produced on flow completion.
Exchange it for a session via POST /sessions/exchange.
Only present when step.complete is set.
handoff_token_expires_at?stringExpiry timestamp for handoff_token. Only present when
handoff_token is set.
date-timeimport { createZitadelApi, ZitadelClient } from "@zitadel/api/client";const api = createZitadelApi( new ZitadelClient({ baseUrl: process.env.ZITADEL_URL ?? "http://localhost:8080", }),);const flowStep = await api.submitFlowStep( "flow_01KWH8Q5NZT7F0N9WD3P2E4YM7", { action: "string" },);{ "id": "string", "session_id": "string", "session_token": "string", "step": { "name": "string", "texts": { "title_key": "string", "description_key": "string" }, "purpose": "login", "notice": "string", "error": "string", "complete": "redirect", "redirect_url": "http://example.com", "fields": [], "identifier": { "value": "string", "autocomplete": "string" }, "actions": [], "gates": {}, "sso_providers": [], "challenge": { "method": "passkey", "challenge_id": "string", "options": {} }, "consent": { "client": { "client_id": "string", "name": "string", "redirect_host": "string", "document_host": "string", "loopback": true }, "resource": "string", "scopes": [ { "name": "string", "group": "string", "access": "read", "selected": true, "text_key": "string" } ] } }, "branding": { "$schema": "string", "layout": "centered", "liquid_template": "string", "logo_url": "http://example.com", "hero_url": "http://example.com", "theme": { "mode": "light", "light": { "logo_url": "http://example.com", "palette": { "primary": "#4F46E5", "on_primary": "#4F46E5", "background": "#4F46E5", "surface": "#4F46E5", "muted": "#4F46E5", "border": "#4F46E5", "text": "#4F46E5", "text_muted": "#4F46E5", "link": "#4F46E5", "success": "#4F46E5", "warning": "#4F46E5", "error": "#4F46E5" } }, "dark": { "logo_url": "http://example.com", "palette": { "primary": "#4F46E5", "on_primary": "#4F46E5", "background": "#4F46E5", "surface": "#4F46E5", "muted": "#4F46E5", "border": "#4F46E5", "text": "#4F46E5", "text_muted": "#4F46E5", "link": "#4F46E5", "success": "#4F46E5", "warning": "#4F46E5", "error": "#4F46E5" } } }, "typography": { "font_family": "string", "font_url": "http://example.com", "scale": 0.75 }, "shape": { "radius": "none", "density": "compact", "logo_scale": 0.5 } }, "client": { "client_id": "string", "application_id": "string", "name": "string", "redirect_host": "string", "document_host": "string", "first_party": true }, "redirect_uri": "http://example.com", "handoff_token": "string", "handoff_token_expires_at": "2019-08-24T14:15:22Z"}Was this helpful?