DELETE
/
v1
/
api
/
batch-calls
/
{batchId}
curl --request DELETE \
  --url https://api.trillet.ai/v1/api/batch-calls/{batchId} \
  --header 'x-api-key: <api-key>' \
  --header 'x-workspace-id: <x-workspace-id>'
{
  "batchId": "<string>",
  "status": "<string>",
  "message": "<string>",
  "details": {
    "completedCalls": 123,
    "failedCalls": 123,
    "cancelledCalls": 123,
    "totalCalls": 123
  },
  "error": "<string>",
  "id": "<string>"
}

Headers

x-api-key
string
required

API key used for authenticating requests to the API.

x-workspace-id
string
required

Workspace identifier for the API.

Path Parameters

batchId
string
required

The unique identifier of the batch call operation to cancel

Response

batchId
string

The ID of the cancelled batch

status
string

New status of the batch (will be “cancelled”)

message
string

Confirmation message about the cancellation

details
object

Summary of the cancellation impact

Example Usage

curl -X DELETE "https://api.trillet.ai/v1/batch-calls/batch_7891011121314" \
  -H "x-api-key: YOUR_API_KEY" \
  -H "x-workspace-id: YOUR_WORKSPACE_ID"

Example Response

{
  "batchId": "batch_7891011121314",
  "status": "cancelled",
  "message": "Batch cancelled successfully",
  "details": {
    "completedCalls": 95,
    "failedCalls": 5,
    "cancelledCalls": 50,
    "totalCalls": 150
  }
}

Cancellation Behavior

When you cancel a batch operation:

  1. Queued Calls: All calls waiting in the queue are immediately cancelled and will not be processed
  2. Active Calls: Currently active calls will continue to completion but no new calls will start
  3. Completed Calls: Already completed calls are not affected
  4. Batch Status: The batch status is updated to “cancelled”
  5. History: The cancellation is recorded in the batch history

Error Responses

error
string

Error message describing what went wrong

message
string

Additional context about the error

id
string

The batch ID that was not found (for 404 errors)

Common Error Codes:

  • 404 - Batch not found with the specified ID
  • 500 - Server error during cancellation process

Use Cases

  • Stop a batch operation that was started with incorrect data
  • Cancel remaining calls when you’ve achieved your campaign goals
  • Emergency stop for batch operations
  • Cost control by stopping long-running batches

Important Notes

  • Cancellation cannot be undone
  • You will still be charged for completed calls
  • Active calls at the time of cancellation will finish normally
  • The batch cannot be restarted after cancellation