Skip to main content
POST
Create a workflow definition

Authorizations

hookie_session
string
cookie
required

The console's sealed session cookie, set by WorkOS AuthKit. Mutating requests also require the X-Requested-With CSRF header.

Headers

Idempotency-Key
string

Makes a POST safe to retry for 24 hours: the same key, credential, path and body returns the stored response (Idempotent-Replayed: true) instead of running again. 422 if the key was used for a different request; 409 while the first is in flight.

Required string length: 1 - 255

Path Parameters

project_id
string
required

Body

application/json
name
string
required

Trimmed before validation.

Required string length: 1 - 120
entry_dataset
string
required

A record landing in this dataset via the ingest/cron/ws pipeline can start an instance. Records emitted BY a workflow never start new ones.

Pattern: ^[a-zA-Z][a-zA-Z0-9_]{0,62}$
steps
(emit_event · object | call_ai · object | wait_for_event · object | delay · object | agent_call · object | branch · object | http · object | set · object | transform · object)[]
required

Ordered steps. Total count INCLUDING nested branch sub-steps must be <= 32, and the steps serialized at most 262144 bytes. New instances run on Cloudflare Workflows: each step is a durable step with retries, so emit_event is keyed on (instance, step) and never emits twice.

Minimum array length: 1
slug
string

Slugified server-side: lowercased, non-alphanumerics collapsed to '-', trimmed, max 48 chars, falling back to 'workflow'. Defaults to a slug of name. Not uniqueness-checked.

active
boolean
default:true

Only the literal false deactivates; anything else (including omission) means active. An inactive workflow starts no instances.

entry_conditions
object[]

Evaluated against the entry record. An empty array matches every record in the dataset.

One condition dialect (#165): {path, op, value}, or {path, equals} as shorthand for op "equals". Refused at save: both forms at once, a missing value (except exists), gt/gte/lt/lte with a non-number, contains or regex with a non-string, a regex that does not compile or is unbounded, in without a list of 1-100 scalars, any other object or array value, an unknown key. A {{placeholder}} value is refused here: nothing resolves it, so it would be compared as literal text.

Response

Created.

id
string
required
ok
enum<boolean>
required
Available options:
true
workflow
object

The created workflow, as GET by id returns it (#201).