Cancel Batch Operation
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>'import requests
url = "https://api.trillet.ai/v1/api/batch-calls/{batchId}"
headers = {
"x-api-key": "<api-key>",
"x-workspace-id": "<x-workspace-id>"
}
response = requests.delete(url, headers=headers)
print(response.text)const options = {
method: 'DELETE',
headers: {'x-api-key': '<api-key>', 'x-workspace-id': '<x-workspace-id>'}
};
fetch('https://api.trillet.ai/v1/api/batch-calls/{batchId}', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://api.trillet.ai/v1/api/batch-calls/{batchId}",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "DELETE",
CURLOPT_HTTPHEADER => [
"x-api-key: <api-key>",
"x-workspace-id: <x-workspace-id>"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"net/http"
"io"
)
func main() {
url := "https://api.trillet.ai/v1/api/batch-calls/{batchId}"
req, _ := http.NewRequest("DELETE", url, nil)
req.Header.Add("x-api-key", "<api-key>")
req.Header.Add("x-workspace-id", "<x-workspace-id>")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.delete("https://api.trillet.ai/v1/api/batch-calls/{batchId}")
.header("x-api-key", "<api-key>")
.header("x-workspace-id", "<x-workspace-id>")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.trillet.ai/v1/api/batch-calls/{batchId}")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Delete.new(url)
request["x-api-key"] = '<api-key>'
request["x-workspace-id"] = '<x-workspace-id>'
response = http.request(request)
puts response.read_body{
"batchId": "<string>",
"status": "<string>",
"message": "<string>",
"details": {
"completedCalls": 123,
"failedCalls": 123,
"cancelledCalls": 123,
"totalCalls": 123
},
"error": "<string>",
"id": "<string>"
}Batch Calls
Cancel Batch Operation
Cancel a batch call operation and stop any remaining calls from being processed
DELETE
/
v1
/
api
/
batch-calls
/
{batchId}
Cancel Batch Operation
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>'import requests
url = "https://api.trillet.ai/v1/api/batch-calls/{batchId}"
headers = {
"x-api-key": "<api-key>",
"x-workspace-id": "<x-workspace-id>"
}
response = requests.delete(url, headers=headers)
print(response.text)const options = {
method: 'DELETE',
headers: {'x-api-key': '<api-key>', 'x-workspace-id': '<x-workspace-id>'}
};
fetch('https://api.trillet.ai/v1/api/batch-calls/{batchId}', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://api.trillet.ai/v1/api/batch-calls/{batchId}",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "DELETE",
CURLOPT_HTTPHEADER => [
"x-api-key: <api-key>",
"x-workspace-id: <x-workspace-id>"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"net/http"
"io"
)
func main() {
url := "https://api.trillet.ai/v1/api/batch-calls/{batchId}"
req, _ := http.NewRequest("DELETE", url, nil)
req.Header.Add("x-api-key", "<api-key>")
req.Header.Add("x-workspace-id", "<x-workspace-id>")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.delete("https://api.trillet.ai/v1/api/batch-calls/{batchId}")
.header("x-api-key", "<api-key>")
.header("x-workspace-id", "<x-workspace-id>")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.trillet.ai/v1/api/batch-calls/{batchId}")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Delete.new(url)
request["x-api-key"] = '<api-key>'
request["x-workspace-id"] = '<x-workspace-id>'
response = http.request(request)
puts response.read_body{
"batchId": "<string>",
"status": "<string>",
"message": "<string>",
"details": {
"completedCalls": 123,
"failedCalls": 123,
"cancelledCalls": 123,
"totalCalls": 123
},
"error": "<string>",
"id": "<string>"
}Headers
string
required
API key used for authenticating requests to the API.
string
required
Workspace identifier for the API.
Path Parameters
string
required
The unique identifier of the batch call operation to cancel
Response
string
The ID of the cancelled batch
string
New status of the batch (will be “cancelled”)
string
Confirmation message about the cancellation
object
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:- Queued Calls: All calls waiting in the queue are immediately cancelled and will not be processed
- Active Calls: Currently active calls will continue to completion but no new calls will start
- Completed Calls: Already completed calls are not affected
- Batch Status: The batch status is updated to “cancelled”
- History: The cancellation is recorded in the batch history
Error Responses
string
Error message describing what went wrong
string
Additional context about the error
string
The batch ID that was not found (for 404 errors)
404- Batch not found with the specified ID500- 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
