curl -X POST 'https://api.weya.live/backend/api/call/addCallsToBatch' \
-H "Content-Type: application/json" \
-H "x-api-key: YOUR_API_KEY" \
-d '{
"batchId": "64e5f12345abcdef98765432",
"callData": [
{
"phoneNumber": "+918800000000",
"name": "Asha Rao",
"amount": "500.00"
},
{
"phoneNumber": "+919900000000",
"name": "Test User",
"amount": "100.00"
}
]
}'
{
"success": true,
"added": 2,
"callIds": ["2f6c1a3e-6b1d-4c52-9f0a-3a7d2e9b8c11", "8a1d0c55-1e2f-4b8a-a0c3-5d6e7f8a9b10"],
"summary": {
"totalChunks": 1,
"successfulChunks": 1,
"failedChunks": 0,
"skippedRows": 0
},
"message": "All calls processed successfully"
}
{
"success": false,
"added": 1000,
"callIds": ["2f6c1a3e-6b1d-4c52-9f0a-3a7d2e9b8c11"],
"summary": {
"totalChunks": 2,
"successfulChunks": 1,
"failedChunks": 1,
"skippedRows": 0
},
"partial": true,
"message": "Partial success: Some chunks failed",
"failedChunks": [
{ "chunkNum": 2, "error": "..." }
]
}
Campaign Management
Add Calls to Campaign
Add contacts to an existing outbound or mixed campaign as JSON.
POST
/
api
/
call
/
addCallsToBatch
curl -X POST 'https://api.weya.live/backend/api/call/addCallsToBatch' \
-H "Content-Type: application/json" \
-H "x-api-key: YOUR_API_KEY" \
-d '{
"batchId": "64e5f12345abcdef98765432",
"callData": [
{
"phoneNumber": "+918800000000",
"name": "Asha Rao",
"amount": "500.00"
},
{
"phoneNumber": "+919900000000",
"name": "Test User",
"amount": "100.00"
}
]
}'
{
"success": true,
"added": 2,
"callIds": ["2f6c1a3e-6b1d-4c52-9f0a-3a7d2e9b8c11", "8a1d0c55-1e2f-4b8a-a0c3-5d6e7f8a9b10"],
"summary": {
"totalChunks": 1,
"successfulChunks": 1,
"failedChunks": 0,
"skippedRows": 0
},
"message": "All calls processed successfully"
}
{
"success": false,
"added": 1000,
"callIds": ["2f6c1a3e-6b1d-4c52-9f0a-3a7d2e9b8c11"],
"summary": {
"totalChunks": 2,
"successfulChunks": 1,
"failedChunks": 1,
"skippedRows": 0
},
"partial": true,
"message": "Partial success: Some chunks failed",
"failedChunks": [
{ "chunkNum": 2, "error": "..." }
]
}
Overview
Add contacts to an existing campaign. Each contact needs aphoneNumber; any other fields are stored with the contact and passed to the agent as variables.
Contacts are queued for calling straight away and are called during the campaign’s calling hours. You don’t need to call Start Campaign afterwards. A completed campaign is moved back to pending so the new contacts get called.
Prerequisites
- An outbound or mixed campaign and its
batchId, created by the user who owns the API key. Contacts can’t be added toinboundcampaigns. - The campaign’s calling numbers have an outbound agent assigned.
Request
ID of the campaign, from Create Campaign or Get Campaigns.
Contacts to add, up to 10,000 per request. Each object must include
phoneNumber in E.164 format, for example +919876543210. Other fields are stored with the contact.timezone– optional per-contact timezone. Defaults to the campaign’s timezone.- Agent variables you leave out are stored as
null. They are not rejected. - These field names are reserved and rejected:
call_status,retry_count,call_duration,insertuuid,_id,x_weya_transliterated_name,x_weya_transliterated_language.
curl -X POST 'https://api.weya.live/backend/api/call/addCallsToBatch' \
-H "Content-Type: application/json" \
-H "x-api-key: YOUR_API_KEY" \
-d '{
"batchId": "64e5f12345abcdef98765432",
"callData": [
{
"phoneNumber": "+918800000000",
"name": "Asha Rao",
"amount": "500.00"
},
{
"phoneNumber": "+919900000000",
"name": "Test User",
"amount": "100.00"
}
]
}'
Response
This endpoint returns a summary object, not the standardstatus/data wrapper. Errors use the standard wrapper (see below).
{
"success": true,
"added": 2,
"callIds": ["2f6c1a3e-6b1d-4c52-9f0a-3a7d2e9b8c11", "8a1d0c55-1e2f-4b8a-a0c3-5d6e7f8a9b10"],
"summary": {
"totalChunks": 1,
"successfulChunks": 1,
"failedChunks": 0,
"skippedRows": 0
},
"message": "All calls processed successfully"
}
{
"success": false,
"added": 1000,
"callIds": ["2f6c1a3e-6b1d-4c52-9f0a-3a7d2e9b8c11"],
"summary": {
"totalChunks": 2,
"successfulChunks": 1,
"failedChunks": 1,
"skippedRows": 0
},
"partial": true,
"message": "Partial success: Some chunks failed",
"failedChunks": [
{ "chunkNum": 2, "error": "..." }
]
}
Number of new contacts added. Contacts whose phone number is already in the campaign are updated instead and aren’t counted.
IDs of the contacts added or updated by this request. All of them are queued for calling.
Contacts are saved in chunks of 1,000:
totalChunks, successfulChunks, failedChunks (a count) and skippedRows (rows skipped because the phone number was invalid).All calls processed successfully, Calls saved but with warnings (some rows were skipped), or Partial success: Some chunks failed.Present when chunks failed: each
{ chunkNum, error }. Send the contacts of those chunks again.Present when rows were skipped: each
{ rowNumber, phoneNumber, error }. rowNumber is the 1-based position in callData.Error Handling
Errors returnstatus: false, with the reason in errorMessage.
- 400 Bad Request
Valid callData is required–callDatais missing or empty.Upload exceeds the maximum of 10,000 rows…– split the contacts into several requests.Call data contains restricted headers: …– a contact uses a reserved field name.No valid phone numbers in callData…– every phone number was invalid.Cannot add lead data to an inbound batch.Batch has no calling numbers.
- 401 Unauthorized – Missing or invalid API key.
- 403 Forbidden –
Batch not found or not authorized for this user: the campaign doesn’t exist, was deleted, or wasn’t created by the user who owns the API key. - 404 Not Found –
Agent not found for the provided calling numbers: no calling number has an outbound agent. - 500 Internal Server Error – Unexpected server error.
Duplicates:
- When the same phone number appears more than once in
callData, only the first is kept. - When a phone number is already in the campaign, that contact’s data is replaced with the new values and it becomes callable again: its retry counter is reset to 0 and it is no longer expired. Its earlier call history is kept.
Was this page helpful?

