Workflow automations
Workflow automations endpoints of the Zanfia Workspace API, with schemas and code samples.
Read your workflow automations, inspect run history, pause/resume them, retry a failed run, fire a test run, and author workflows: create a draft, replace its graph (PUT /automations/{automationId}/draft), publish, duplicate and delete. The draft never executes; publishing makes the workflow live, so real actions fire on real events from that moment. A draft the validator refuses answers 422 invalid-automation-graph with issues[] (stable reason codes); saving a draft reports the same issues without blocking. Activating a never-published draft returns 400. Retry and test-run answer 202 (the run executes asynchronously) and a test run executes the real graph, so actions genuinely fire. All routes require a Authorization: Bearer header — see Authentication.
List workflow automations
/automationsAuthorization
bearerAuth API key from Dashboard → Integrations → API, MCP and CLI.
In: header
Response Body
application/json
application/json
curl -X GET "https://example.com/automations"{ "items": [ { "id": "string", "name": "string", "description": "string", "status": "active", "triggers": [ "product.ProductPurchased" ], "productIds": [ "string" ], "kind": "transactional", "published": true, "publishedAt": "string", "runsThisMonth": 0, "lastRunAt": "string", "lastRunStatus": "running", "createdAt": "string", "updatedAt": "string" } ]}{ "error": "string", "message": "string"}Create a workflow draft
/automationsAuthorization
bearerAuth API key from Dashboard → Integrations → API, MCP and CLI.
In: header
Request Body
application/json
TypeScript Definitions
Use the request body type in TypeScript.
Creates a DRAFT — nothing runs until POST /automations/:automationId/publish.
Response Body
application/json
application/json
curl -X POST "https://example.com/automations" \ -H "Content-Type: application/json" \ -d '{ "name": "string" }'{ "automation": { "createdAt": "2019-08-24T14:15:22Z", "updatedAt": "2019-08-24T14:15:22Z", "workspaceId": "string", "createdBy": "string", "updatedBy": "string", "id": "string", "name": "string", "description": "string", "status": "active", "scope": { "productIds": [ "string" ] }, "draft": { "nodes": [ { "id": "string", "position": { "x": 0, "y": 0 }, "name": "string", "notes": "string", "disabled": true, "kind": "trigger", "config": { "eventType": "product.ProductPurchased", "productIds": [ "string" ], "formIds": [ "string" ], "tagIds": [ "string" ], "inactiveDays": 0, "filters": [ { "type": "included", "prices": [ "string" ] } ] } } ], "edges": [ { "id": "string", "source": "string", "target": "string", "sourceHandle": "true" } ], "schemaVersion": 1 }, "published": { "nodes": [ { "id": "string", "position": { "x": 0, "y": 0 }, "name": "string", "notes": "string", "disabled": true, "kind": "trigger", "config": { "eventType": "product.ProductPurchased", "productIds": [ "string" ], "formIds": [ "string" ], "tagIds": [ "string" ], "inactiveDays": 0, "filters": [ { "type": "included", "prices": [ "string" ] } ] } } ], "edges": [ { "id": "string", "source": "string", "target": "string", "sourceHandle": "true" } ], "schemaVersion": 1 }, "publishedAt": "2019-08-24T14:15:22Z", "publishedBy": "string", "triggerEventTypes": [ "product.ProductPurchased" ], "triggers": [ { "eventType": "product.ProductPurchased", "nodeId": "string", "productIds": [ "string" ], "formIds": [ "string" ], "tagIds": [ "string" ], "inactiveDays": 0 } ], "stats": { "runsThisMonth": 0, "runsMonth": "string", "lastRunAt": "2019-08-24T14:15:22Z", "lastRunStatus": "running", "consecutiveFailedRuns": 0 }, "presentation": "workflow", "kind": "transactional", "autoPausedAt": "2019-08-24T14:15:22Z", "autoPausedReason": "webhookDeliveryFailures", "_migratedFromProductId": "string" }}{ "error": "string", "message": "string"}Automation detail
/automations/{automationId}Authorization
bearerAuth API key from Dashboard → Integrations → API, MCP and CLI.
In: header
Path Parameters
Workflow automation id
Query Parameters
Value in
- "graph"
Response Body
application/json
application/json
curl -X GET "https://example.com/automations/string"{ "id": "string", "name": "string", "description": "string", "status": "active", "triggers": [ "product.ProductPurchased" ], "productIds": [ "string" ], "kind": "transactional", "published": true, "publishedAt": "string", "runsThisMonth": 0, "lastRunAt": "string", "lastRunStatus": "running", "createdAt": "string", "updatedAt": "string", "nodeCounts": { "triggers": 0, "actions": 0, "conditions": 0, "delays": 0 }, "draftGraph": { "nodes": [ { "id": "string", "position": { "x": 0, "y": 0 }, "name": "string", "notes": "string", "disabled": true, "kind": "trigger", "config": { "eventType": "product.ProductPurchased", "productIds": [ "string" ], "formIds": [ "string" ], "tagIds": [ "string" ], "inactiveDays": 0, "filters": [ { "type": "included", "prices": [ "string" ] } ] } } ], "edges": [ { "id": "string", "source": "string", "target": "string", "sourceHandle": "true" } ], "schemaVersion": 1 }, "publishedGraph": { "nodes": [ { "id": "string", "position": { "x": 0, "y": 0 }, "name": "string", "notes": "string", "disabled": true, "kind": "trigger", "config": { "eventType": "product.ProductPurchased", "productIds": [ "string" ], "formIds": [ "string" ], "tagIds": [ "string" ], "inactiveDays": 0, "filters": [ { "type": "included", "prices": [ "string" ] } ] } } ], "edges": [ { "id": "string", "source": "string", "target": "string", "sourceHandle": "true" } ], "schemaVersion": 1 }, "hasUnpublishedChanges": true}{ "error": "string", "message": "string"}Delete an automation
/automations/{automationId}Authorization
bearerAuth API key from Dashboard → Integrations → API, MCP and CLI.
In: header
Path Parameters
Workflow automation id
Response Body
application/json
application/json
curl -X DELETE "https://example.com/automations/string"{ "status": "ok"}{ "error": "string", "message": "string"}Run history
/automations/{automationId}/runsAuthorization
bearerAuth API key from Dashboard → Integrations → API, MCP and CLI.
In: header
Path Parameters
Workflow automation id
Response Body
application/json
application/json
curl -X GET "https://example.com/automations/string/runs"{ "items": [ { "id": "string", "status": "running", "trigger": "product.ProductPurchased", "startedAt": "string", "completedAt": "string", "steps": { "total": 0, "succeeded": 0, "failed": 0, "skipped": 0 }, "error": "string" } ]}{ "error": "string", "message": "string"}Pause or resume an automation
/automations/{automationId}/statusAuthorization
bearerAuth API key from Dashboard → Integrations → API, MCP and CLI.
In: header
Path Parameters
Workflow automation id
Request Body
application/json
TypeScript Definitions
Use the request body type in TypeScript.
Response Body
application/json
application/json
curl -X POST "https://example.com/automations/string/status" \ -H "Content-Type: application/json" \ -d '{ "status": "active" }'{ "id": "string", "status": "active", "cancelledRuns": 0}{ "error": "string", "message": "string"}Retry a failed run
/automations/{automationId}/runs/{runId}/retryAuthorization
bearerAuth API key from Dashboard → Integrations → API, MCP and CLI.
In: header
Path Parameters
Workflow automation id
Response Body
application/json
application/json
curl -X POST "https://example.com/automations/string/runs/string/retry"{ "runId": "string"}{ "error": "string", "message": "string"}Fire a test run
/automations/{automationId}/test-runAuthorization
bearerAuth API key from Dashboard → Integrations → API, MCP and CLI.
In: header
Path Parameters
Workflow automation id
Request Body
application/json
TypeScript Definitions
Use the request body type in TypeScript.
Fire the published graph once with a synthetic trigger context. ⚠️ The test run executes the REAL graph — actions genuinely fire (emails, webhooks, integration commands), so pass a client email you control. The run is flagged as a test (excluded from stats, kept 7 days).
Response Body
application/json
application/json
curl -X POST "https://example.com/automations/string/test-run" \ -H "Content-Type: application/json" \ -d '{ "context": {} }'{ "runId": "string"}{ "error": "string", "message": "string"}Replace the draft graph
/automations/{automationId}/draftAuthorization
bearerAuth API key from Dashboard → Integrations → API, MCP and CLI.
In: header
Path Parameters
Workflow automation id
Request Body
application/json
TypeScript Definitions
Use the request body type in TypeScript.
Replaces the whole DRAFT graph (+ optional metadata). The published graph — what actually runs — changes only through the publish route.
Response Body
application/json
application/json
curl -X PUT "https://example.com/automations/string/draft" \ -H "Content-Type: application/json" \ -d '{ "draft": { "nodes": [ { "id": "string", "position": { "x": 0, "y": 0 }, "kind": "trigger", "config": { "eventType": "product.ProductPurchased" } } ], "edges": [ { "id": "string", "source": "string", "target": "string" } ], "schemaVersion": 1 } }'{ "issues": [ { "code": "noTriggerNode", "reason": "duplicateNodeId", "params": { "property1": "string", "property2": "string" }, "message": "string", "nodeId": "string", "edgeId": "string" } ], "status": "ok"}{ "error": "string", "message": "string"}Publish the draft (goes live)
/automations/{automationId}/publishAuthorization
bearerAuth API key from Dashboard → Integrations → API, MCP and CLI.
In: header
Path Parameters
Workflow automation id
Response Body
application/json
application/json
curl -X POST "https://example.com/automations/string/publish"{ "automation": { "createdAt": "2019-08-24T14:15:22Z", "updatedAt": "2019-08-24T14:15:22Z", "workspaceId": "string", "createdBy": "string", "updatedBy": "string", "id": "string", "name": "string", "description": "string", "status": "active", "scope": { "productIds": [ "string" ] }, "draft": { "nodes": [ { "id": "string", "position": { "x": 0, "y": 0 }, "name": "string", "notes": "string", "disabled": true, "kind": "trigger", "config": { "eventType": "product.ProductPurchased", "productIds": [ "string" ], "formIds": [ "string" ], "tagIds": [ "string" ], "inactiveDays": 0, "filters": [ { "type": "included", "prices": [ "string" ] } ] } } ], "edges": [ { "id": "string", "source": "string", "target": "string", "sourceHandle": "true" } ], "schemaVersion": 1 }, "published": { "nodes": [ { "id": "string", "position": { "x": 0, "y": 0 }, "name": "string", "notes": "string", "disabled": true, "kind": "trigger", "config": { "eventType": "product.ProductPurchased", "productIds": [ "string" ], "formIds": [ "string" ], "tagIds": [ "string" ], "inactiveDays": 0, "filters": [ { "type": "included", "prices": [ "string" ] } ] } } ], "edges": [ { "id": "string", "source": "string", "target": "string", "sourceHandle": "true" } ], "schemaVersion": 1 }, "publishedAt": "2019-08-24T14:15:22Z", "publishedBy": "string", "triggerEventTypes": [ "product.ProductPurchased" ], "triggers": [ { "eventType": "product.ProductPurchased", "nodeId": "string", "productIds": [ "string" ], "formIds": [ "string" ], "tagIds": [ "string" ], "inactiveDays": 0 } ], "stats": { "runsThisMonth": 0, "runsMonth": "string", "lastRunAt": "2019-08-24T14:15:22Z", "lastRunStatus": "running", "consecutiveFailedRuns": 0 }, "presentation": "workflow", "kind": "transactional", "autoPausedAt": "2019-08-24T14:15:22Z", "autoPausedReason": "webhookDeliveryFailures", "_migratedFromProductId": "string" }}{ "error": "string", "message": "string"}Duplicate an automation
/automations/{automationId}/duplicateAuthorization
bearerAuth API key from Dashboard → Integrations → API, MCP and CLI.
In: header
Path Parameters
Workflow automation id
Request Body
application/json
TypeScript Definitions
Use the request body type in TypeScript.
Copies the source's DRAFT into a fresh unpublished draft automation.
Response Body
application/json
application/json
curl -X POST "https://example.com/automations/string/duplicate" \ -H "Content-Type: application/json" \ -d '{}'{ "automation": { "createdAt": "2019-08-24T14:15:22Z", "updatedAt": "2019-08-24T14:15:22Z", "workspaceId": "string", "createdBy": "string", "updatedBy": "string", "id": "string", "name": "string", "description": "string", "status": "active", "scope": { "productIds": [ "string" ] }, "draft": { "nodes": [ { "id": "string", "position": { "x": 0, "y": 0 }, "name": "string", "notes": "string", "disabled": true, "kind": "trigger", "config": { "eventType": "product.ProductPurchased", "productIds": [ "string" ], "formIds": [ "string" ], "tagIds": [ "string" ], "inactiveDays": 0, "filters": [ { "type": "included", "prices": [ "string" ] } ] } } ], "edges": [ { "id": "string", "source": "string", "target": "string", "sourceHandle": "true" } ], "schemaVersion": 1 }, "published": { "nodes": [ { "id": "string", "position": { "x": 0, "y": 0 }, "name": "string", "notes": "string", "disabled": true, "kind": "trigger", "config": { "eventType": "product.ProductPurchased", "productIds": [ "string" ], "formIds": [ "string" ], "tagIds": [ "string" ], "inactiveDays": 0, "filters": [ { "type": "included", "prices": [ "string" ] } ] } } ], "edges": [ { "id": "string", "source": "string", "target": "string", "sourceHandle": "true" } ], "schemaVersion": 1 }, "publishedAt": "2019-08-24T14:15:22Z", "publishedBy": "string", "triggerEventTypes": [ "product.ProductPurchased" ], "triggers": [ { "eventType": "product.ProductPurchased", "nodeId": "string", "productIds": [ "string" ], "formIds": [ "string" ], "tagIds": [ "string" ], "inactiveDays": 0 } ], "stats": { "runsThisMonth": 0, "runsMonth": "string", "lastRunAt": "2019-08-24T14:15:22Z", "lastRunStatus": "running", "consecutiveFailedRuns": 0 }, "presentation": "workflow", "kind": "transactional", "autoPausedAt": "2019-08-24T14:15:22Z", "autoPausedReason": "webhookDeliveryFailures", "_migratedFromProductId": "string" }}{ "error": "string", "message": "string"}Was this article helpful?

