Trillet AI logo

Cancel Batch Job

Cancel one job in a batch.

DELETEhttps://api.trillet.ai/v1/api/batch-calls/{batchId}/calls/{jobId}

Headers

x-workspace-idstringrequired

Workspace identifier for the API.

Path Parameters

batchIdstringrequired

The batch that contains the job.

jobIdstringrequired

The 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

okboolean

true for cancelled and call_in_progress, otherwise false.

reasonstring

cancelled, call_in_progress, already_cancelled or call_not_found.

messagestring

What happened, in words.

jobIdstring

The job that was acted on. For a contact with a pending retry this can be the retry's job ID.

phonestring

The contact's phone number.

callStatusobject

The job's status record (same shape as Get Individual Call Status), after the change.

HTTP statusreason
200cancelled, call_in_progress
404call_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
409already_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