Zitadel Preview Docs

Create a new flow definition

Creates a new flow definition. 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.

POST
/flow_definitions

Creates a new flow definition. 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.

Authorization

oauth2 flow_definitions.write
AuthorizationBearer <token>

In: header

Scope: flow_definitions.write

Request Body

application/json

TypeScript Definitions

Use the request body type in TypeScript.

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.

Response Body

application/json

application/json

application/json

application/json

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": "fd_123abc456def",  "project_id": "proj_789ghi012jkl",  "flow_definition": {    "name": "standard-login",    "status": "active",    "user_schema": "sch_01KWHF18816ZQESRCS7Z2STJ05",    "purposes": {      "login": "identify"    },    "audience": {      "app_ids": [        "app_saas"      ]    },    "steps": [      {        "name": "identify",        "fields": [          "email"        ],        "actions": [          {            "name": "submit",            "kind": "submit",            "primary": true          }        ],        "transitions": {          "submit": {            "target": "authenticate"          },          "user_not_found": {            "target": "register",            "action": "switch"          }        }      },      {        "name": "authenticate",        "fields": [          "password"        ],        "actions": [          {            "name": "submit",            "kind": "submit",            "primary": true          }        ],        "transitions": {          "submit": {            "target": "done"          }        }      },      {        "name": "done",        "complete": "redirect"      }    ]  },  "created_at": "2020-01-28T14:25:39.123456Z",  "updated_at": "2020-01-28T14:25:39.123456Z"}
{  "code": "string",  "message": "string",  "details": {}}
{  "code": "string",  "message": "string",  "details": {}}
{  "code": "string",  "message": "string",  "details": {}}