Skip to main content
PATCH
Update 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.

Path Parameters

workflowId
string<cuid2>
required

Workflow identifier.

Body

application/json

Partial workflow update. name and description are accepted in any state except archived; definition is only accepted while the workflow is draft or disabled. status is intentionally not patchable — use the lifecycle endpoints.

name
string
Required string length: 1 - 120
description
string | null
Maximum string length: 500
definition
object

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.

Response

Workflow updated 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.