POST
Upload Cohort

Overview

A cohort is a batch of users uploaded as a CSV along with a transformation config (JSON) that maps your CSV columns to phone numbers and agent variables. Uploading a cohort triggers background processing that validates each row and queues calls for valid records.

Validation

Blocking — rejects the entire upload:
  • All referenced column_name values must exist as CSV headers
  • CSV must have at least one data row
  • app_overrides keys must be one of: initial_bot_message, initial_state_name, initial_language_name
  • For agent campaigns: app_variables keys must match the agent’s declared variables
Row-level — row is rejected, the rest continue:
  • Phone number must be valid (normalized to E.164)
  • Required columns must be non-empty
  • Formatting functions (if configured) must succeed
Rejected rows are collected into a downloadable CSV with an appended rejected_reason column.

Statuses


Rejected records

Once status is completed, always check result.rejected_records. Poll:
If result.rejected_records > 0, download the file to see which rows failed and why, then fix the data and re-upload:
Rejected users will not be called. Catching and re-uploading them before the campaign goes live ensures maximum coverage.

Authorizations

X-API-Key
string
header
required

Path Parameters

org_id
string
required
workspace_id
string
required
campaign_id
string
required

Body

multipart/form-data
name
string
required

Name of the resource

Example:

"April Batch 1"

cohort_file
file
required

CSV file containing the cohort data

cohort_transformation_file
file
required

JSON file defining how CSV columns map to agent variables

Response

Successful Response

Cohort metadata including processing status and result counts.

name
string
required

Name of the resource

Example:

"April Batch 1"

cohort_id
string
required

Unique identifier for the cohort

Example:

"coh-x1y2z3"

status
enum<string>
required

Current status

Available options:
processing,
completed,
failed
Example:

"completed"

source_type
enum<string>
required

How the cohort was uploaded

Available options:
pre_signed_url,
file_upload
Example:

"file_upload"

created_by
string
required

User who created this resource

Example:

"user@company.com"

created_at
string<date-time>
required

Timestamp when the resource was created (ISO 8601)

Example:

"2026-04-01T09:00:00Z"

updated_at
string<date-time>
required

Timestamp when the resource was last updated (ISO 8601)

Example:

"2026-04-01T09:05:00Z"

result
CohortResult · object | null

Processing result with record counts

Example:
updated_by
string | null

User who last updated this resource

Example:

"user@example.com"