Skip to Content
Campaigns

Import campaign recipients

Permissioncampaigns:updateAdd-onCampaignsRetriesIdempotency-Key requiredAuthentication
POST
/campaigns/{id}/recipients/import

Uploads a recipient list as multipart/form-data: a required file part (CSV or XLSX, at most 10 MiB) and an optional mapping JSON part. The parser is chosen from the file's content, not its name.

Every column that is not the phone column becomes a prompt variable for that recipient.

Bad rows

Rows that are duplicates, unusable numbers, or carry invalid variables reject the whole file with campaign_recipients_invalid — unless mapping.skip_invalid is set, in which case they are stored as excluded and retrievable from the error report.

Imports are allowed only while the campaign is a draft, and repeat imports append.

Authorization

bearerAuth
headerAuthorizationBearer <token>

Use a Voice API key or connected-app OAuth access token. Authentication.

Path Parameters

id*string
Formatuuid

Header Parameters

Idempotency-Key*string

Required. Reuse the same key to retry this write safely. Retries and idempotency.

Match^[A-Za-z0-9!#$%&'*+.^_`|~-]+$
Length1 <= length <= 255

Request Body

multipart/form-data
  1. body

Multipart upload body. At most 10 MiB in total.

file*file

CSV or XLSX recipient list. The parser is chosen from the file content, not its name.

Formatbinary
mapping?

Steers how the uploaded columns become recipients. Sent as the mapping multipart part.

Response Body

Import result and the campaign's refreshed counters.

application/json
  1. response
campaign_id*string
Formatuuid
total_rows*integer
Range0 <= value
imported*integer
Range0 <= value
excluded*integer
Range0 <= value
counters*

Per-status recipient tally, always derived from the recipient rows rather than stored, so it cannot drift from reality.

Example Request
curl -X POST 'https://api.kejue.co/v1/campaigns/497f6eca-6276-4993-bfeb-53cbbbba6f08/recipients/import' \  -H 'Idempotency-Key: string' \  -F 'file=string'
Example Response
{  "campaign_id": "78614b6c-fe7c-41e2-8e25-c9b3a3c91904",  "total_rows": 0,  "imported": 0,  "excluded": 0,  "counters": {    "total": 0,    "pending": 0,    "queued": 0,    "calling": 0,    "completed": 0,    "failed": 0,    "canceled": 0,    "excluded": 0  }}