Skip to main content
POST
Create audience
Use this endpoint to create a new audience, or append contacts to an existing one, from an uploaded file and/or a JSON contact list.

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/or contacts). Columns are taken from the uploaded file’s header row (or the first 50 JSON contacts rows) when no input_variables are passed.
  • Append to an existing audience — pass audience_id (+ file and/or contacts) to add more contacts into that audience. At least one contact row (file or contacts) 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 JSON contacts array and merged into one list before insert; large files insert in 500-row chunks.
  • If input_variables (or variable_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

token
string
required

API token for authentication

Body

audience_name
string

Name of the new audience. Required when audience_id is not provided. Must be unique within the workspace.

audience_id
integer

ID of an existing audience to append contacts to. Switches the request into append mode.

description
string

Free-text description. Ignored in append mode.

source
enum<integer>

1=CSV/Bulk Upload, 2=Manual. Forced to 1 when a file is uploaded. Ignored in append mode.

Available options:
1,
2
input_variables
any[]

Input-variable registry IDs, or an array of variable key strings directly. Also accepted as variable_id / variable_ids. Ignored in append mode.

tags
string[]

Free-form tags. Ignored in append mode.

is_global
boolean

1 = usable by any agent (default), 0 = agent-specific. Ignored in append mode.

agent_id
integer

Agent this audience is scoped to. Implies is_global=0 unless is_global is explicitly set. Ignored in append mode.

contacts
object[]

Contact rows as an array of objects, e.g. [{"mobile_no":"+12025550123","name":"John Doe"}]. Combines with an uploaded file if both are given.

Response

Audience created, or contacts appended, successfully

message
string
data
object