Skip to main content
POST
/
campaigns-leads
/
upload-file
/
{campaignId}
Bulk upload leads via file
curl --request POST \
  --url https://api.dialnexa.com/v1/campaigns-leads/upload-file/{campaignId} \
  --header 'Authorization: Bearer <token>' \
  --header 'Content-Type: multipart/form-data' \
  --form file='@example-file'
{
  "campaign_id": "cmp_xyz789",
  "leads_created": 150,
  "leads_skipped": 3,
  "message": "150 leads queued successfully. 3 rows skipped due to missing phone_number."
}
Uploads a file to add multiple leads to a campaign in a single request. This is the fastest way to populate a campaign with a large contact list.

File format

Your file must include a phone_number column. All other column headers are treated as dynamic variable names and are injected into the agent’s prompt per lead:
phone_number,name,city,product_interest,last_purchase_value
9876543210,Priya Sharma,Mumbai,home_loan,500000
9123456789,Rahul Mehra,Delhi,car_loan,250000
In your agent prompt, reference these as {{name}}, {{city}}, {{product_interest}}, etc. Each call is personalized with that lead’s row data.

File requirements

  • Formats: CSV, XLSX, or XLS
  • Max size: 10 MB
  • Required column: phone_number
  • Optional columns: Any additional column becomes a dynamic variable (max 15 custom columns)

Destination validation

Uploaded campaign leads are checked against the campaign’s outbound phone number before they are queued. For non-SIP routes, each destination must be allowed by Workspace Settings > Telephony Config. If rows fail validation, the API returns 400 Bad Request with grouped errors and row numbers. Fix invalid phone numbers, unsupported countries, unsupported prefixes, or missing Telephony Config coverage before uploading again.

Request example

curl -X POST https://api.dialnexa.com/v1/campaigns-leads/upload-file/cmp_xyz789 \
  -H "Authorization: Bearer YOUR_API_KEY" \
  -F "file=@leads.csv"

Authorizations

Authorization
string
header
required

Pass your API key as a Bearer token in the Authorization header.

Path Parameters

campaignId
string
required

Body

multipart/form-data
file
file
required

CSV, XLSX, or XLS file. Max 10 MB. Must contain a phone_number column. Destination numbers must pass workspace route validation.

Response

Leads uploaded and queued.

campaign_id
string
Example:

"cmp_xyz789"

leads_created
integer
Example:

150

leads_skipped
integer
Example:

3

message
string
Example:

"150 leads queued successfully. 3 rows skipped due to missing phone_number."