Create Call Batch (Idempotent)
PUT Create a new call batch idempotently
Create a call batch the same way as POST /call-batches, but scoped to a caller-supplied idempotency_key. This is the preferred way to create batches: if a network error or timeout forces you to retry a request, retrying with the same key returns the batch that was already created instead of scheduling a duplicate.
- The first request for a given
idempotency_keyschedules the batch and returns201 Created. - Any later request with the same
idempotency_key(from the same account) returns the original batch unchanged with200 OKandidempotent: true— no new batch is created, and the contacts/settings from the retry are ignored. idempotency_keyis scoped per account — reusing a key across different accounts does not cause a collision.
Authorization
Authorization: Bearer sk_your_api_key
Request Body
Accepts every field from POST /call-batches, plus:
| Parameter | Type | Required | Description |
|---|---|---|---|
idempotency_key | string | ✅ | Your unique key for this create attempt (1–128 characters). Reuse it to safely retry. |
Code Examples
- cURL
- Python
- JavaScript
- Java
curl -X PUT https://api.techladder.ai/api/v1/public/call-batches \
-H "Authorization: Bearer sk_your_api_key" \
-H "Content-Type: application/json" \
-d '{
"idempotency_key": "campaign-2026-05-15-batch-1",
"agent_name": "agt-57949b14",
"version_name": "pmt-667ddf271b",
"voice": "Tara",
"did_number_id": "08037236753",
"interruption": false,
"use_alternate_number": false,
"start_mode": "scheduled",
"schedule_date": "2026-05-15",
"schedule_time": "14:00",
"schedule_timezone": "Asia/Kolkata (IST, UTC+5:30)",
"contacts": [
{
"contact_id": "101",
"name": "John Doe",
"phone_number": "919876543210",
"metadata": {
"Name": "John Doe",
"Company Name": "Acme Corporation",
"City": "Delhi",
"Business Type": "Retailer"
}
}
]
}'
import requests
response = requests.put(
"https://api.techladder.ai/api/v1/public/call-batches",
headers={"Authorization": "Bearer sk_your_api_key"},
json={
"idempotency_key": "campaign-2026-05-15-batch-1",
"agent_name": "agt-57949b14",
"version_name": "pmt-667ddf271b",
"voice": "Tara",
"did_number_id": "08037236753",
"interruption": False,
"use_alternate_number": False,
"start_mode": "scheduled",
"schedule_date": "2026-05-15",
"schedule_time": "14:00",
"schedule_timezone": "Asia/Kolkata (IST, UTC+5:30)",
"contacts": [
{
"contact_id": "101",
"name": "John Doe",
"phone_number": "919876543210",
"metadata": {
"Name": "John Doe",
"Company Name": "Acme Corporation",
"City": "Delhi",
"Business Type": "Retailer",
},
}
],
},
)
print(response.status_code, response.json())
const response = await fetch(
"https://api.techladder.ai/api/v1/public/call-batches",
{
method: "PUT",
headers: {
Authorization: "Bearer sk_your_api_key",
"Content-Type": "application/json",
},
body: JSON.stringify({
idempotency_key: "campaign-2026-05-15-batch-1",
agent_name: "agt-57949b14",
version_name: "pmt-667ddf271b",
voice: "Tara",
did_number_id: "08037236753",
interruption: false,
use_alternate_number: false,
start_mode: "scheduled",
schedule_date: "2026-05-15",
schedule_time: "14:00",
schedule_timezone: "Asia/Kolkata (IST, UTC+5:30)",
contacts: [
{
contact_id: "101",
name: "John Doe",
phone_number: "919876543210",
metadata: {
Name: "John Doe",
"Company Name": "Acme Corporation",
City: "Delhi",
"Business Type": "Retailer",
},
},
],
}),
}
);
const data = await response.json();
console.log(response.status, data);
import java.net.URI;
import java.net.http.*;
String apiKey = "sk_your_api_key";
String body = """
{
"idempotency_key": "campaign-2026-05-15-batch-1",
"agent_name": "agt-57949b14",
"version_name": "pmt-667ddf271b",
"voice": "Tara",
"did_number_id": "08037236753",
"start_mode": "scheduled",
"schedule_date": "2026-05-15",
"schedule_time": "14:00",
"schedule_timezone": "Asia/Kolkata (IST, UTC+5:30)",
"contacts": [{
"contact_id": "101",
"name": "John Doe",
"phone_number": "919876543210",
"metadata": {
"Name": "John Doe",
"Company Name": "Acme Corporation"
}
}]
}
""";
HttpClient client = HttpClient.newHttpClient();
HttpRequest request = HttpRequest.newBuilder()
.uri(URI.create("https://api.techladder.ai/api/v1/public/call-batches"))
.header("Authorization", "Bearer " + apiKey)
.header("Content-Type", "application/json")
.method("PUT", HttpRequest.BodyPublishers.ofString(body))
.build();
HttpResponse<String> response = client.send(request,
HttpResponse.BodyHandlers.ofString());
System.out.println(response.statusCode() + " " + response.body());
Responses
201 Created
Returned the first time this idempotency_key is used — a new batch was scheduled.
{
"status_code": 201,
"message": "Call batch created successfully",
"error": null,
"data": {
"batch_id": "sched_7bac6f2a",
"agent_id": "agt-57949b14",
"version_id": "pmt-667ddf271b",
"status": "pending",
"start_mode": "scheduled",
"total_contacts": 1,
"accepted_contacts": 1,
"rejected_contacts": 0,
"validation_errors": [],
"concurrency": 20,
"created_at": "2026-05-14T10:00:00Z",
"idempotent": false
}
}
200 OK
Returned when this idempotency_key was already used for a previous request — the existing batch is returned as-is, and no new batch is scheduled. Note idempotent: true.
{
"status_code": 200,
"message": "Call batch already exists for this idempotency key",
"error": null,
"data": {
"batch_id": "sched_7bac6f2a",
"agent_id": "agt-57949b14",
"version_id": "pmt-667ddf271b",
"status": "pending",
"start_mode": "scheduled",
"total_contacts": 1,
"accepted_contacts": 1,
"rejected_contacts": 0,
"validation_errors": [],
"concurrency": 20,
"created_at": "2026-05-14T10:00:00Z",
"idempotent": true
}
}
401 Unauthorized
Returned when the API key is missing or invalid. This is not wrapped in the standard envelope.
{
"detail": "Invalid API key"
}
404 Not Found
Returned when the referenced agent or prompt version doesn't exist on your account.
{
"detail": "Agent 'agt-unknown' not found"
}
422 Unprocessable Entity — request validation
Returned when a required field — including idempotency_key — is missing or fails validation. This case is wrapped in the standard envelope.
{
"status_code": 422,
"message": "Missing required parameter",
"error": {
"code": "MISSING_PARAMETER",
"details": [
"idempotency_key: Field required"
]
},
"data": null
}
422 Unprocessable Entity — business rule
Returned for domain-level failures caught after the request body parses successfully (e.g. every contact was rejected). This case is not wrapped in the envelope.
{
"detail": "All contacts are invalid"
}