Skip to main content

Create Campaign

Create a new campaign for the authenticated user. This endpoint accepts multipart/form-data.

Request Body (multipart/form-data)

string
required
Campaign name
integer
required
ID of the phone number to use
string
required
ID of the agent to use for calls
file
required
CSV file with recipient phone numbers. Format: one phone number per line.
boolean
required
Whether to send the campaign immediately (true) or schedule it (false)
string
Date in YYYY-MM-DD format (required if send_immediately is false)
string
Time in HH:MM:SS format (required if send_immediately is false)

CSV File Format

The recipients file should be a CSV with phone numbers. Example:
phone_number
+1234567890
+0987654321
+1122334455
curl -X POST "https://api.example.com/api/v1/campaigns" \
  -H "X-API-Key: your-api-key-here" \
  -F "name=Q1 Product Launch Campaign" \
  -F "phone_number_id=1" \
  -F "agent_id=123" \
  -F "[email protected]" \
  -F "send_immediately=true"

Scheduled Campaign Example

To schedule a campaign for later:
curl -X POST "https://api.example.com/api/v1/campaigns" \
  -H "X-API-Key: your-api-key-here" \
  -F "name=Scheduled Campaign" \
  -F "phone_number_id=1" \
  -F "agent_id=123" \
  -F "[email protected]" \
  -F "send_immediately=false" \
  -F "schedule_date=2024-02-01" \
  -F "schedule_time=10:00:00"

Response

status
object
Response status information
code
integer
HTTP status code (201)
message
string
Status message
data
object
Created campaign object
{
  "status": {
    "code": 201,
    "message": "Campaign created successfully"
  },
  "data": {
    "id": 1,
    "name": "Q1 Product Launch Campaign",
    "status": "pending",
    "elevenlabs_batch_call_id": null,
    "recipients_count": 500,
    "scheduled_at": null,
    "send_immediately": true,
    "created_at": "2024-01-15T10:30:00Z"
  }
}

Error Responses

401
object
Unauthorized - Invalid or missing authentication
404
object
Phone number or agent not found
422
object
Validation error - Invalid request body or file format
502
object
Bad gateway - ElevenLabs API error