curl --location 'https://api.weya.live/backend/api/call/createBatch' \
--header 'x-api-key: YOUR_API_KEY' \
--header 'Content-Type: application/json' \
--data '{
"channel_type": "voice",
"batchName": "API Campaign May 2025",
"callingNumbers": ["64e5f12345abcdef87654321"],
"retry": 3,
"delay": 30,
"timezone": "Asia/Kolkata",
"callingHour": { "start": "09:00", "end": "17:00" },
"allowedDays": ["Monday", "Tuesday", "Wednesday", "Thursday", "Friday"],
"holidayListId": "64f12345abcdef9876543210"
}'
curl --location 'https://api.weya.live/backend/api/call/createBatch' \
--header 'x-api-key: YOUR_API_KEY' \
--header 'Content-Type: application/json' \
--data '{
"channel_type": "video",
"batchName": "Product Demo Campaign",
"videoAgentId": "6891a23bc456def789123456"
}'
curl --location 'https://api.weya.live/backend/api/call/createBatch' \
--header 'x-api-key: YOUR_API_KEY' \
--header 'Content-Type: application/json' \
--data '{
"channel_type": "web_chat",
"batchName": "Website Chat",
"chatAgentId": "6891a23bc456def789654321",
"allowedDomains": ["example.com"]
}'
{
"message": "Batch created successfully",
"status": true,
"code": 201,
"errorMessage": null,
"data": "64e5f12345abcdef98765432"
}
{
"message": "Video campaign created",
"status": true,
"code": 201,
"errorMessage": null,
"data": {
"id": "64e5f12345abcdef98765433",
"link": "https://..."
}
}
Campaign Management
Create Campaign
Create a voice, video or web chat campaign without uploading contacts.
POST
/
api
/
call
/
createBatch
curl --location 'https://api.weya.live/backend/api/call/createBatch' \
--header 'x-api-key: YOUR_API_KEY' \
--header 'Content-Type: application/json' \
--data '{
"channel_type": "voice",
"batchName": "API Campaign May 2025",
"callingNumbers": ["64e5f12345abcdef87654321"],
"retry": 3,
"delay": 30,
"timezone": "Asia/Kolkata",
"callingHour": { "start": "09:00", "end": "17:00" },
"allowedDays": ["Monday", "Tuesday", "Wednesday", "Thursday", "Friday"],
"holidayListId": "64f12345abcdef9876543210"
}'
curl --location 'https://api.weya.live/backend/api/call/createBatch' \
--header 'x-api-key: YOUR_API_KEY' \
--header 'Content-Type: application/json' \
--data '{
"channel_type": "video",
"batchName": "Product Demo Campaign",
"videoAgentId": "6891a23bc456def789123456"
}'
curl --location 'https://api.weya.live/backend/api/call/createBatch' \
--header 'x-api-key: YOUR_API_KEY' \
--header 'Content-Type: application/json' \
--data '{
"channel_type": "web_chat",
"batchName": "Website Chat",
"chatAgentId": "6891a23bc456def789654321",
"allowedDomains": ["example.com"]
}'
{
"message": "Batch created successfully",
"status": true,
"code": 201,
"errorMessage": null,
"data": "64e5f12345abcdef98765432"
}
{
"message": "Video campaign created",
"status": true,
"code": 201,
"errorMessage": null,
"data": {
"id": "64e5f12345abcdef98765433",
"link": "https://..."
}
}
Overview
Create an empty campaign that you add contacts to later, for example with Add Calls to Campaign. The fields you send depend onchannel_type:
voice(default) – an outbound calling campaign. Send the calling numbers and schedule.video– a video agent campaign. SendvideoAgentId. The response includes the link people use to join.web_chat– a chat widget campaign. SendchatAgentIdandallowedDomains. The response includes the script tag to embed.
Prerequisites
- An API key for your workspace
- For voice: at least one phone number with an outbound agent assigned. The agent is needed when you add contacts.
- For video or web chat: a video or chat agent created by the user who owns the API key. A chat agent (and the optional voice agent) must have at least one saved version.
Endpoint
Request
curl --location 'https://api.weya.live/backend/api/call/createBatch' \
--header 'x-api-key: YOUR_API_KEY' \
--header 'Content-Type: application/json' \
--data '{
"channel_type": "voice",
"batchName": "API Campaign May 2025",
"callingNumbers": ["64e5f12345abcdef87654321"],
"retry": 3,
"delay": 30,
"timezone": "Asia/Kolkata",
"callingHour": { "start": "09:00", "end": "17:00" },
"allowedDays": ["Monday", "Tuesday", "Wednesday", "Thursday", "Friday"],
"holidayListId": "64f12345abcdef9876543210"
}'
curl --location 'https://api.weya.live/backend/api/call/createBatch' \
--header 'x-api-key: YOUR_API_KEY' \
--header 'Content-Type: application/json' \
--data '{
"channel_type": "video",
"batchName": "Product Demo Campaign",
"videoAgentId": "6891a23bc456def789123456"
}'
curl --location 'https://api.weya.live/backend/api/call/createBatch' \
--header 'x-api-key: YOUR_API_KEY' \
--header 'Content-Type: application/json' \
--data '{
"channel_type": "web_chat",
"batchName": "Website Chat",
"chatAgentId": "6891a23bc456def789654321",
"allowedDomains": ["example.com"]
}'
Request Parameters
Voice campaigns
IDs of the phone numbers to call from, from Get Phone Numbers. At least one is required. Calls are handled by the outbound agent assigned to each number.
Campaign type:
outbound, inbound or mixed. Any other value creates an outbound campaign. It can’t be changed later.Maximum attempts per contact. Use a value from 1 to 10, the range the dashboard allows. The API does not check the range.
Time to wait between attempts to the same contact, in minutes. Use a value from 5 to 1440, the range the dashboard allows. The API does not check the range.
Daily calling window in 24-hour
HH:MM format, with both start and end. Example: { "start": "09:00", "end": "17:00" }. This endpoint does not check the format, so send valid values.Days of the week calls can be placed on. Example:
["Monday", "Tuesday", "Wednesday", "Thursday", "Friday"].Video campaigns
Web chat campaigns
Optional voice agent for visitors who switch to a call from the chat widget. Must not be a chat agent.
Websites the chat widget is allowed to load on: 1 to 50 domains. Required when
channel_type is web_chat.Response
{
"message": "Batch created successfully",
"status": true,
"code": 201,
"errorMessage": null,
"data": "64e5f12345abcdef98765432"
}
{
"message": "Video campaign created",
"status": true,
"code": 201,
"errorMessage": null,
"data": {
"id": "64e5f12345abcdef98765433",
"link": "https://..."
}
}
Human-readable success message:
Batch created successfully, Video campaign created or Chat campaign created.For voice campaigns, the new campaign’s ID (
batchId). For video campaigns, an object with the campaign id and its join link. For web chat campaigns, an object with the campaign id, campaignToken and the scriptTag to embed on your site.Error Handling
Errors returnstatus: false, with the reason in errorMessage.
- 400 Bad Request
batchNameis missing, orchannel_typeis notvoice,videoorweb_chat.- Voice:
Batch name & valid callingNumbers required–callingNumbersis missing or empty. - Voice:
Invalid holidayListIdorHoliday list not found. - Video:
videoAgentId is required for a video campaign. - Web chat:
chatAgentIdmissing,allowedDomainsempty, over 50 entries or containing an invalid domain, or the chat or voice agent has no saved version.
- 401 Unauthorized – Missing or invalid API key.
- 404 Not Found –
Video agent not found,Chat agent not foundorVoice agent not found: the agent doesn’t exist or wasn’t created by the user who owns the API key. - 500 Internal Server Error – Unexpected server error.
After creating a campaign, you can:
POST /api/call/addCallsToBatchto add contacts to a voice campaign.POST /api/call/start-callingto start calling.GET /api/call/batches/{userId}to see it in your campaign list.
Was this page helpful?

