Cancel Batch Job
Cancel one job in a batch.
DELETE
Headers
x-workspace-idstringrequiredWorkspace identifier for the API.
Path Parameters
batchIdstringrequiredThe batch that contains the job.
jobIdstringrequiredThe numeric job ID to cancel. Job IDs come from the id field of List Batch Calls.
Behavior
What happens depends on the job's state:
- Waiting or scheduled retry: the job is removed from the queue and its status becomes
cancelled. - In progress: the live call can't be stopped. It continues, but no further smart-callback retries are scheduled (
reason: "call_in_progress"). - Already completed or failed: the call is left as it is, and any scheduled smart-callback retry is cancelled (
reason: "cancelled"). - Already cancelled: nothing changes (
409).
Response
okbooleantrue for cancelled and call_in_progress, otherwise false.
reasonstringcancelled, call_in_progress, already_cancelled or call_not_found.
messagestringWhat happened, in words.
jobIdstringThe job that was acted on. For a contact with a pending retry this can be the retry's job ID.
phonestringThe contact's phone number.
callStatusobjectThe job's status record (same shape as Get Individual Call Status), after the change.
| HTTP status | reason |
|---|---|
200 | cancelled, call_in_progress |
404 | call_not_found (the job isn't in this batch), or {"error": "Batch not found"} when the batch doesn't exist or belongs to another workspace |
409 | already_cancelled |
500 | {"ok": false, "error": "..."} on a server error |
Example
curl -X DELETE "https://api.trillet.ai/v1/api/batch-calls/k3j9x0a1bq/calls/4821" \
-H "x-api-key: YOUR_API_KEY" \
-H "x-workspace-id: YOUR_WORKSPACE_ID"
Example Response
{
"ok": true,
"reason": "cancelled",
"message": "Call cancelled and removed from batchCallQueue",
"jobId": "4821",
"phone": "+14155550123",
"callStatus": {
"jobId": "4821",
"batchId": "k3j9x0a1bq",
"phoneNumber": "+14155550123",
"status": "cancelled",
"endTime": 1793284900000
}
}Last updated on