curl --location 'https://api.weya.live/backend/api/call/upload' \
--header 'x-api-key: YOUR_API_KEY' \
--form 'file=@"/path/to/contacts.csv"' \
--form 'batchName="Marketing Campaign May 2025"' \
--form 'batchType="outbound"' \
--form 'callingNumbers="[\"64e5f12345abcdef87654321\"]"' \
--form 'enableDNC="true"' \
--form 'timezone="America/New_York"' \
--form 'callingHour="{\"start\":\"09:00\",\"end\":\"17:00\"}"' \
--form 'allowedDays="[\"Monday\",\"Tuesday\",\"Wednesday\",\"Thursday\",\"Friday\"]"'
{
"message": "Batch created successfully",
"status": true,
"code": 201,
"errorMessage": null,
"data": {
"batch": [
{
"_id": "64e5f12345abcdef98765432",
"batchName": "Marketing Campaign May 2025",
"callingNumbers": ["64e5f12345abcdef87654321"],
"totalCalls": 100
}
],
"uuid": "3f6c2a1e-8b4d-4f7a-9c1e-2d5b7a9e0f11"
}
}
Campaign Management
Upload Campaign CSV
Create a campaign and populate it by uploading a CSV file of contacts.
POST
/
api
/
call
/
upload
curl --location 'https://api.weya.live/backend/api/call/upload' \
--header 'x-api-key: YOUR_API_KEY' \
--form 'file=@"/path/to/contacts.csv"' \
--form 'batchName="Marketing Campaign May 2025"' \
--form 'batchType="outbound"' \
--form 'callingNumbers="[\"64e5f12345abcdef87654321\"]"' \
--form 'enableDNC="true"' \
--form 'timezone="America/New_York"' \
--form 'callingHour="{\"start\":\"09:00\",\"end\":\"17:00\"}"' \
--form 'allowedDays="[\"Monday\",\"Tuesday\",\"Wednesday\",\"Thursday\",\"Friday\"]"'
{
"message": "Batch created successfully",
"status": true,
"code": 201,
"errorMessage": null,
"data": {
"batch": [
{
"_id": "64e5f12345abcdef98765432",
"batchName": "Marketing Campaign May 2025",
"callingNumbers": ["64e5f12345abcdef87654321"],
"totalCalls": 100
}
],
"uuid": "3f6c2a1e-8b4d-4f7a-9c1e-2d5b7a9e0f11"
}
}
Overview
Create a campaign and add its contacts from a CSV or Excel file in one request. The file is validated, the campaign is created, and each row becomes a contact. Calling starts when you call Start Campaign. Aninbound campaign takes no file: it only links the calling numbers to the new campaign so incoming calls are recorded on it.
Prerequisites
- An API key for your workspace
- A CSV or Excel file with a
phoneNumbercolumn and any variables the agent needs (not needed forinbound). - At least one phone number with an outbound agent assigned. All numbers must use agents of the same conversation type.
Request
curl --location 'https://api.weya.live/backend/api/call/upload' \
--header 'x-api-key: YOUR_API_KEY' \
--form 'file=@"/path/to/contacts.csv"' \
--form 'batchName="Marketing Campaign May 2025"' \
--form 'batchType="outbound"' \
--form 'callingNumbers="[\"64e5f12345abcdef87654321\"]"' \
--form 'enableDNC="true"' \
--form 'timezone="America/New_York"' \
--form 'callingHour="{\"start\":\"09:00\",\"end\":\"17:00\"}"' \
--form 'allowedDays="[\"Monday\",\"Tuesday\",\"Wednesday\",\"Thursday\",\"Friday\"]"'
CSV/Excel File Requirements:
- Supported formats: CSV (.csv) or Excel (.xls, .xlsx)
- Must include a header row
- Must include
phoneNumbercolumn (required) - Every row must have a value for each variable listed in
mandatoryVariables - CSV headers should match agent variable keys (e.g.,
phoneNumber,name,account_id,custom_field_1) - The
phoneNumbercolumn is required; all other columns are flexible based on your agent’s needs - Extra columns are stored and forwarded to the agent state machine
- File encoding should be UTF-8
- Empty files or files with no valid rows will be rejected
- The system automatically detects file type by extension
- Excel files use the first sheet
- Invalid rows are identified and reported (unless
type="true") - Data is normalized and validated against agent requirements
- Phone numbers are deduplicated (only the first occurrence is kept)
- A file with no valid rows is always rejected
Response
{
"message": "Batch created successfully",
"status": true,
"code": 201,
"errorMessage": null,
"data": {
"batch": [
{
"_id": "64e5f12345abcdef98765432",
"batchName": "Marketing Campaign May 2025",
"callingNumbers": ["64e5f12345abcdef87654321"],
"totalCalls": 100
}
],
"uuid": "3f6c2a1e-8b4d-4f7a-9c1e-2d5b7a9e0f11"
}
}
ID of this upload. Pass it as
uuid to Start Campaign to start calling these contacts. For inbound campaigns there are no contacts to start.Error Handling
Errors returnstatus: false, with the reason in errorMessage.
- 400 Bad Request
Batch name required,Invalid batch type,callingNumbers required,CSV file requiredorUnsupported file type.callHours requiredorInvalid callHours format–callingHouris missing or not inHH:MMformat.Invalid input format–callingHour,callingNumbers,allowedDaysormandatoryVariablesis not valid JSON.Invalid pushingCrms format, or apushingCrmsentry fails validation.DNC not enabled for organization.Invalid holidayListIdorHoliday list not found.All phoneNumbers must have same agent type– the numbers’ outbound agents have different conversation types.- The file is empty or has no valid rows.
- 404 Not Found –
Phone(s) not found: …orNo agent linked to phone …: a calling number doesn’t exist or has no outbound agent. - 400 Bad Request (invalid rows) – The file has invalid rows and
typeis"false".datacontainscode: "INVALID_CSV_ROWS",totalInvalidRows,validRows,truncatedandinvalidRows(each{ rowNumber, phoneNumber, reason }). Fix the rows, or resend withtype="true"to skip them. - 401 Unauthorized – Missing or invalid API key.
- 409 Conflict –
inboundcampaigns only. A calling number is already active on another inbound campaign.data.requiresConfirmationistrueanddata.conflictslists each number as{ phoneId, phoneNumber, currentBatchId, currentBatchName }. Resend withconfirmReassign="true"to move them. - 500 Internal Server Error – File parsing failed, database error, or other server errors.
Then call
POST /api/call/start-calling with the campaign ID and data.uuid to start calling. Use GET /api/call/batch-details/{batchId} to confirm the imported rows match the expected total.Was this page helpful?

