Sync API
Use the Sync API only if your task completes within 20 seconds. Otherwise, the request will time out
Path
POST /workflows/<TASK_NAME>/execute
Request Body
{
"params" : {} // your task command
}
Response Body
{
"status" : "success",
"response" : {
"id" : "", // task id
"status" : "COMPLETED | FAILED",
"result" : {}, // task result
"usage": { // Details of the used credits, if any
"credits": 10, // total credits charged for this task (including charged sub-tasks)
"details": [ // per-tool breakdown
{
"toolId": "example_tool", // tool that was charged
"price": 1, // credits per single use of the tool
"amount": 1, // number of uses charged
"credits": 1, // credits charged for this entry (price × amount)
"failed": false // whether the subtask has failed (failed subtasks are not charged)
}
]
}
}
}
Errors
Errors are returned as { "status": "error", "statusCode", "reason", "message" }.
| Status | reason | When |
|---|---|---|
402 | NOT_ENOUGH_AVAILABLE_CREDITS | The user's balance can't cover the task's price or its minimum balance. Nothing is charged. |
429 | rate_limit_exceeded | The task rejected the request over a request rate limit. details carries retryAfterSeconds, limit, and the limit's label when it has one. |
429 | concurrency_limit_exceeded | The task rejected the request over a concurrency limit: too many generations already in progress. details carries retryAfterSeconds (null: a slot frees when a running generation finishes), limit, and the limit's label when it has one. |
cURL Example
curl --location '{BASE_URL}/workflows/<TASK_NAME>/execute' \
--header 'Authorization: Bearer <USER_TOKEN>' \
--header 'x-app-authorization: Bearer <CLIENT_TOKEN>' \
--header 'platform: website' \
--header 'x-touchpoint: <touchpoint>' \
--data '{
"params": {},
}'