Create a workflow
A new workflow: a draft (empty, or the definition you send), its callback URL and signing secret, and a trigger URL that stays off until it is turned on.
A new workflow: a draft (empty, or the definition you send), its callback URL and signing secret, and a trigger URL that stays off until it is turned on.
Rate limit: 2000 requests per minute per organization, counted together with every endpoint that has no stricter limit of its own. Exceeding it returns 429 with Retry-After; the X-RateLimit-* response headers report your remaining allowance on every call.
v2/workflowsAuthorization
AuthorizationRequiredBearer <token>
Your Graine API key. Create one in the dashboard under Developers, or via POST /v2/api-keys. Send it as Authorization: Bearer <key>.
In: header
Request Body
application/jsonRequirednameName
Its name (a sample's name when omitted).
120descriptionDescription
What it is for.
1000definitionDefinition
Steps to start the draft with.
sampleSample
Start from a sample instead (GET /v2/workflow-samples): its id.
64agent_idAgent Id
With a sample: the agent for every one of its call steps.
128Response Body
201
The new workflow, with its draft.
idRequiredId
The workflow's id.
nameRequiredName
Its name.
descriptionRequiredDescription
What it is for.
versionsRequiredVersions
How many versions were published.
latest_versionLatest Version | null
The newest version's number.
agent_idsRequiredAgent Ids
The agents it calls with.
draft_revisionRequiredDraft Revision
The draft's revision.
draft_saved_atDraft Saved At | null
When the draft was saved.
trigger_enabledRequiredTrigger Enabled
Whether its trigger URL is on.
created_byCreated By | null
Who created it.
created_atCreated At | null
When.
updated_atUpdated At | null
When it last changed.
published_atPublished At | null
When the newest version was published.
draftRequiredWorkflowDraft
The workflow's editable copy.
triggerRequiredWorkflowTrigger
The URL your system posts a contact to, to start a run.
call_triggerAny properties in WorkflowCallTrigger
app_startAny properties in WorkflowAppStart
callback_urlCallback Url | null
The workflow's callback URL: your system posts here and the body names the contact (only to a key that may edit and run).
signing_secretSigning Secret | null
Signs requests to the trigger and callback URLs (only to a key that may edit and run).
publishedPublished | null
Its versions, newest first (on a read of the workflow).
401
1100 — missing, unknown or inactive API key. 1101 — a browser session token was presented instead of an API key.
errorRequiredError
Stable integer code from the /v2 error table. Branch on this.
messageRequiredMessage
One human-readable sentence. Wording may change; the code will not.
403
1102 — the key is valid but lacks the scope this endpoint requires, or names another organization. GET /v2/scopes reports what a key holds.
errorRequiredError
Stable integer code from the /v2 error table. Branch on this.
messageRequiredMessage
One human-readable sentence. Wording may change; the code will not.
404
1200 — no such resource in your organization. A resource belonging to another organization answers 404, never 403.
errorRequiredError
Stable integer code from the /v2 error table. Branch on this.
messageRequiredMessage
One human-readable sentence. Wording may change; the code will not.
422
1001 — the body or query failed validation; the message names the first offending field.
errorRequiredinteger
Stable integer code from the error table. Branch on this, not on the message.
messageRequiredstring
One human-readable sentence. Wording may change; the code will not.
429
1300 — the per-organization request rate or concurrent-call limit was reached. Carries Retry-After.
errorRequiredError
Stable integer code from the /v2 error table. Branch on this.
messageRequiredMessage
One human-readable sentence. Wording may change; the code will not.
The new workflow, with its draft.

