Executions API
Executions API
Trigger a Flow
POST /api/flows/65flow1/runAuthorization: Bearer <token>Content-Type: application/json
{ "args": { "invoiceId": "INV-2024-001", "customerEmail": "client@example.com", "notify": true }, "idempotencyKey": "process-INV-2024-001"}Response:
{ "playId": "65play1", "state": "RUN", "startedAt": "2024-01-15T10:05:00Z"}Poll Play Status
GET /api/plays/65play1{ "id": "65play1", "flowId": "65flow1", "state": "DONE", "startedAt": "2024-01-15T10:05:00Z", "completedAt": "2024-01-15T10:05:03Z", "duration": 3241, "args": {"invoiceId": "INV-2024-001"}}Get Step Results
GET /api/plays/65play1/layers[ { "id": "65pl1", "ref": "fetchInvoice", "state": "DONE", "startedAt": "2024-01-15T10:05:00Z", "completedAt": "2024-01-15T10:05:01Z", "out": { "statusCode": 200, "body": {"id": "INV-2024-001", "amount": 1250.00, "status": "pending"} } }, { "id": "65pl2", "ref": "sendNotification", "state": "DONE", "out": {"messageId": "<abc@mail.example.com>"} }]Approve a Pending Step
When a flowlet has needsApproval: true, the play enters WAIT state:
# ApprovePOST /api/plays/65play1/approve{"layerId": "65layer3", "decision": "approved", "note": "Looks good"}
# DeclinePOST /api/plays/65play1/approve{"layerId": "65layer3", "decision": "declined", "note": "Amount exceeds limit"}List Play History
GET /api/flows/65flow1/plays?state=FAIL&size=10&page=0
# Filter by date rangeGET /api/plays?flowId=65flow1&from=2024-01-01&to=2024-01-31