Create Audience
Create a new audience from an uploaded file and/or a JSON contacts array (pass audience_name), or append contacts to an existing audience (pass audience_id). Rows are collected from the uploaded file and/or the contacts array; rows without a usable mobile number are skipped, and every campaign/segment already connected to the audience is synced with the newly added contacts.
Endpoint
POST/audience/create
Content-Type: multipart/form-data (file upload) or application/json (JSON contacts only)
Authentication: Required (workspace auth)
Two Modes
- Create new audience — pass
audience_name(+ file and/orcontacts). Columns are taken from the uploaded file’s header row (or the first 50 JSONcontactsrows) when noinput_variablesare passed. - Append to an existing audience — pass
audience_id(+ file and/orcontacts) to add more contacts into that audience. At least one contact row (file orcontacts) is required.
Request Body
Create new audience
Append contacts to an existing audience
Response
New audience created
Contacts appended
Behavior
- Rows are pulled from the uploaded file (multipart field
audience) and/or the JSONcontactsarray and merged into one list before insert; large files insert in 500-row chunks. - If
input_variables(orvariable_id/variable_ids) were explicitly selected and a file is uploaded, the file’s header row must contain a column for every selected variable — values may be left blank, but the column must exist. - Appending contacts additionally requires the file to include a column for every one of the target audience’s existing input variables.
- A row without a usable phone/mobile value is skipped; if every row is skipped, the request fails rather than silently creating an empty audience.
- New contacts are automatically synced into any campaign (or segment) already connected to the audience.
Error Cases
Example cURL
JSON contacts only
File upload
Headers
API token for authentication
Body
Name of the new audience. Required when audience_id is not provided. Must be unique within the workspace.
ID of an existing audience to append contacts to. Switches the request into append mode.
Free-text description. Ignored in append mode.
1=CSV/Bulk Upload, 2=Manual. Forced to 1 when a file is uploaded. Ignored in append mode.
1, 2 Input-variable registry IDs, or an array of variable key strings directly. Also accepted as variable_id / variable_ids. Ignored in append mode.
Free-form tags. Ignored in append mode.
1 = usable by any agent (default), 0 = agent-specific. Ignored in append mode.
Agent this audience is scoped to. Implies is_global=0 unless is_global is explicitly set. Ignored in append mode.
Contact rows as an array of objects, e.g. [{"mobile_no":"+12025550123","name":"John Doe"}]. Combines with an uploaded file if both are given.

