Skip to main content
POST

Overview

Create an empty campaign that you add contacts to later, for example with Add Calls to Campaign. The fields you send depend on channel_type:
  • voice (default) – an outbound calling campaign. Send the calling numbers and schedule.
  • video – a video agent campaign. Send videoAgentId. The response includes the link people use to join.
  • web_chat – a chat widget campaign. Send chatAgentId and allowedDomains. The response includes the script tag to embed.
To create a voice campaign and upload contacts in one step, use Upload Campaign CSV instead.

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

string
required
Your workspace API key. Create one from the profile menu in the dashboard → API Keys.

Request Parameters

string
default:"voice"
Type of campaign: voice, video or web_chat.
string
required
Name of the campaign, shown in the dashboard.

Voice campaigns

array[string]
required
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.
string
default:"outbound"
Campaign type: outbound, inbound or mixed. Any other value creates an outbound campaign. It can’t be changed later.
integer
Maximum attempts per contact. Use a value from 1 to 10, the range the dashboard allows. The API does not check the range.
integer
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.
string
Timezone used for the calling schedule. Example: Asia/Kolkata.
object
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.
array[string]
Days of the week calls can be placed on. Example: ["Monday", "Tuesday", "Wednesday", "Thursday", "Friday"].
string
ID of a holiday list in your organization. No calls are placed on the dates in that list.

Video campaigns

string
required
ID of the video agent people talk to. Required when channel_type is video.

Web chat campaigns

string
required
ID of the chat agent. Required when channel_type is web_chat.
string
Optional voice agent for visitors who switch to a call from the chat widget. Must not be a chat agent.
array[string]
required
Websites the chat widget is allowed to load on: 1 to 50 domains. Required when channel_type is web_chat.

Response

boolean
required
Indicates whether the campaign was created.
integer
required
HTTP status code.
string
required
Human-readable success message: Batch created successfully, Video campaign created or Chat campaign created.
string | object
required
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 return status: false, with the reason in errorMessage.
  • 400 Bad Request
    • batchName is missing, or channel_type is not voice, video or web_chat.
    • Voice: Batch name & valid callingNumbers required – callingNumbers is missing or empty.
    • Voice: Invalid holidayListId or Holiday list not found.
    • Video: videoAgentId is required for a video campaign.
    • Web chat: chatAgentId missing, allowedDomains empty, 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 found or Voice 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/addCallsToBatch to add contacts to a voice campaign.
  • POST /api/call/start-calling to start calling.
  • GET /api/call/batches/{userId} to see it in your campaign list.