Automatyzacje (workflow)
Endpointy „Automatyzacje (workflow)” Zanfia Workspace API — ze schematami i przykładami kodu.
Odczytuj automatyzacje workflow, przeglądaj historię uruchomień, wstrzymuj i wznawiaj je, ponawiaj nieudane uruchomienia, uruchamiaj je testowo oraz twórz automatyzacje: utwórz szkic, zastąp jego graf (PUT /automations/{automationId}/draft), opublikuj, zduplikuj i usuń. Szkic nigdy się nie wykonuje; publikacja uruchamia automatyzację na żywo, więc od tej chwili prawdziwe akcje wykonują się na prawdziwych zdarzeniach. Szkic odrzucony przez walidator zwraca 422 invalid-automation-graph z listą issues[] (stabilne kody reason); zapis szkicu raportuje te same problemy, ale go nie blokuje. Aktywacja nieopublikowanego szkicu zwraca 400. Ponowienie i uruchomienie testowe zwracają 202 (wykonanie jest asynchroniczne), a uruchomienie testowe wykonuje prawdziwy graf, więc akcje naprawdę się wykonują. Wszystkie endpointy wymagają nagłówka Authorization: Bearer — zobacz Uwierzytelnianie.
Lista automatyzacji workflow
/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"}Utwórz szkic automatyzacji
/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"}Szczegóły automatyzacji
/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"}Usuń automatyzację
/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"}Historia uruchomień
/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"}Wstrzymaj lub wznów automatyzację
/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"}Ponów nieudane uruchomienie
/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"}Uruchom testowo
/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"}Zastąp graf szkicu
/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"}Opublikuj szkic (start na żywo)
/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"}Zduplikuj automatyzację
/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"}Czy ten artykuł był pomocny?

