ZitadelDocs

Create a new flow definition

Publishes a new flow definition revision. Flow definitions are templates that define the sequence of steps (capabilities) for a particular user journey (e.g., registration, login, password reset). Flow definitions are created based on the flow definition schema, which includes the flow's purpose, audience, and the steps involved. Every call allocates a new opaque id. Revisions of one flow share its `name`; posting a definition under an existing `name` publishes a new revision of that flow, it is not a conflict. List with `name` to see a flow's revisions, newest by creation time first.

POST
/flow_definitions

Publishes a new flow definition revision. Flow definitions are templates that define the sequence of steps (capabilities) for a particular user journey (e.g., registration, login, password reset).

Flow definitions are created based on the flow definition schema, which includes the flow's purpose, audience, and the steps involved.

Every call allocates a new opaque id. Revisions of one flow share its name; posting a definition under an existing name publishes a new revision of that flow, it is not a conflict. List with name to see a flow's revisions, newest by creation time first.

Authorization

oauth2 flow_definition.write
headerAuthorizationBearer <token>

Scope: flow_definition.write

Request Body

application/json
  1. body

Creates a flow definition. The flow definition is created in an active state by default. The status can also be set via the status attribute in the flow definition payload.

project_id*project-id
Match^[a-zA-Z0-9_-]+$
schema_uri?schema-uri

URI of the server-published flow definition schema this definition was authored against. The server uses this to validate the definition. If not provided, the engine will use the latest schema version for validation.

Formaturi
flow_definition*

A flow definition is the server-side configuration that describes a complete authentication or identity flow. It is NOT sent to the frontend — the flow engine evaluates it and produces FlowResponse payloads (steps with capability dictionaries) for the client.

Flow definitions are created by administrators and stored in the project/team configuration hierarchy. The engine selects the matching definition based on the purpose + audience when a flow is created via POST /flow.

Response Body

Flow definition created successfully.

application/json
  1. response
id*string

Unique identifier for the flow definition.

project_id*string

Identifier of the project this flow definition belongs to.

flow_definition*

A flow definition is the server-side configuration that describes a complete authentication or identity flow. It is NOT sent to the frontend — the flow engine evaluates it and produces FlowResponse payloads (steps with capability dictionaries) for the client.

Flow definitions are created by administrators and stored in the project/team configuration hierarchy. The engine selects the matching definition based on the purpose + audience when a flow is created via POST /flow.

user_schema?|

The user schema this flow operates on: the same object GET /schemas/{id} returns. Present only when the request asked for it with expand=user_schema; null when it was requested but the referenced schema no longer resolves or the caller may not read it.

created_at*string
Formatdate-time
updated_at*string
Formatdate-time
curl -X POST 'https://example.com/flow_definitions' \  -H 'Content-Type: application/json' \  -d '{  "project_id": "${PROJECT_ID}",  "schema_uri": "https://nextgen.com/flow-definition.json",  "flow_definition": {    "name": "default-login",    "status": "active",    "user_schema": "${USER_SCHEMA_URL}",    "purposes": {      "login": "identifier",      "register": "register"    },    "steps": [      {        "name": "identifier",        "fields": [          "email"        ],        "actions": [          {            "name": "submit",            "kind": "submit",            "primary": true,            "text_key": "identifier.action.continue"          },          {            "name": "passkey",            "kind": "passkey",            "primary": false,            "text_key": "identifier.action.passkey"          }        ],        "transitions": {          "submit": {            "target": "password"          },          "passkey": {            "target": "done"          },          "user_not_found": {            "target": "register"          }        }      },      {        "name": "password",        "fields": [          "x-auth-methods#password"        ],        "actions": [          {            "name": "submit",            "kind": "submit",            "primary": true,            "text_key": "password.action.signin"          },          {            "name": "passkey",            "kind": "passkey",            "primary": false,            "text_key": "password.action.passkey"          }        ],        "transitions": {          "submit": {            "target": "done"          },          "passkey": {            "target": "done"          }        }      },      {        "name": "register",        "fields": [          "email",          "givenName",          "familyName",          "dateOfBirth"        ],        "actions": [          {            "name": "submit",            "kind": "submit",            "primary": true,            "text_key": "register.action.password"          },          {            "name": "passkey_register",            "kind": "passkey_register",            "primary": false,            "text_key": "register.action.passkey"          }        ],        "transitions": {          "submit": {            "target": "register-password"          },          "passkey_register": {            "target": "done"          },          "user_already_exists": {            "target": "password"          }        }      },      {        "name": "register-password",        "fields": [          "x-auth-methods#password"        ],        "actions": [          {            "name": "submit",            "kind": "submit",            "primary": true,            "text_key": "register-password.action.submit"          }        ],        "on_success": "create_user",        "transitions": {          "submit": {            "target": "done"          },          "user_already_exists": {            "target": "password"          }        }      },      {        "name": "done",        "complete": "show"      }    ]  }}'
{  "id": "string",  "project_id": "string",  "flow_definition": {    "$schema": "string",    "name": "standard-login",    "status": "active",    "user_schema": "string",    "purposes": {      "property1": "string",      "property2": "string"    },    "audience": {      "team_ids": [        "string"      ],      "app_ids": [        "string"      ]    },    "steps": [      {        "name": "string",        "fields": [],        "actions": [],        "gates": {},        "sso_providers": [],        "on_success": "create_user",        "complete": "redirect",        "transitions": {          "property1": {            "target": "string",            "action": "switch",            "purpose": "login"          },          "property2": {            "target": "string",            "action": "switch",            "purpose": "login"          }        }      }    ]  },  "user_schema": {    "id": "string",    "schema": {      "$schema": "https://json-schema.org/draft/2020-12/schema",      "objectType": "string",      "kind": "user-schema",      "metaSchema": "http://example.com",      "x-auth-methods": {        "password": {          "enabled": true        },        "passkey": {          "enabled": true        },        "magic_link": {          "enabled": true        },        "sso": {          "providers": [            "google"          ],          "enabled": true        },        "otp": {          "enabled": true        }      },      "x-identifier": "string",      "x-display": [        "string"      ],      "properties": {        "property1": {          "x-unique": "unspecified",          "x-claim": "string",          "x-audit": false,          "properties": {            "property1": {},            "property2": {}          }        },        "property2": {          "x-unique": "unspecified",          "x-claim": "string",          "x-audit": false,          "properties": {            "property1": {},            "property2": {}          }        }      }    },    "metadata": {      "created_at": "2019-08-24T14:15:22Z"    }  },  "created_at": "2019-08-24T14:15:22Z",  "updated_at": "2019-08-24T14:15:22Z"}