Skip to main content
POST
Create a workflow

Authorizations

next-auth.session-token
string
cookie
required

NextAuth session JWT cookie. Development: often next-auth.session-token. Production (HTTPS): often __Secure-next-auth.session-token. Send the cookie your browser receives after sign-in.

Body

application/json
workspaceId
string<cuid2>
required
name
string
required
Required string length: 1 - 120
definition
object
required

Scope 1 workflow JSON document, mirroring ZWorkflowDefinition in packages/workflows. The definition is the public source of truth for the builder and API clients. Scope 1 intentionally excludes user-authored if/else branches, webhook actions, schedules, delays, loops, and AI/MCP-assisted creation; future node types extend nodes additively.

Graph rules enforced on every write (400 with invalid_params on violation): node ids are unique across trigger and nodes; every edge references existing node ids; the trigger has at most one outgoing edge; entryNodeId equals trigger.id. Trigger-only drafts (no nodes, no edges) are valid persisted documents. Executability rules (exactly one outgoing trigger edge, acyclic graph, every node reachable from the trigger) are additionally enforced by enable and test with 422 workflow_not_executable.

description
string | null
Maximum string length: 500
status
enum<string>

New workflows are created as drafts in Scope 1.

Available options:
draft

Response

Workflow created successfully

data
object
required

Full workflow shape returned by detail, create, update, duplicate, and lifecycle endpoints: the list-item fields plus the complete definition document.