Upload Cohort
Cohorts
Upload Cohort
Upload a cohort of users for a deployment. When a known user calls in, the agent receives their personalized variables (name, balance, language, etc.) for a tailored conversation.
Upload as multipart form-data with three fields:
name— Cohort name (1–50 characters)cohort_file— CSV file with a header row and user datacohort_transformation_file— JSON file that maps CSV columns to phone numbers and agent variables
POST
Upload Cohort
Overview
A cohort gives your deployment user context. When a known user calls in, the agent receives their personalized variables (name, balance, language preference, etc.) — making the conversation feel tailored rather than generic.How phone number matching works
The phone number is the lookup key. When an inbound call arrives, the system:- Extracts the caller’s phone number
- Looks it up across all cohorts uploaded to this deployment
- If found → loads that user’s agent variables into the conversation
- If not found → the agent handles the call without any personalized context
Multiple cohorts with the same phone number
If you upload multiple cohorts and the same phone number appears in more than one, the most recently uploaded cohort takes precedence. The system always uses the latest context for a given phone number. This is useful when you need to refresh user data — simply upload a new cohort with updated values. You don’t need to delete the old one.| Scenario | What happens |
|---|---|
| Phone number in one cohort | That cohort’s variables are used |
| Phone number in multiple cohorts | The latest cohort’s variables are used |
| Phone number not in any cohort | Agent handles the call without personalized context |
Transformation config
The transformation config tells the system how to read your CSV:| Section | Purpose |
|---|---|
phone_number | Required. Which column contains the user’s phone number. This is the key used to match inbound callers. |
app_variables | Maps CSV columns → agent variables. Keys must match the agent’s declared variables. |
app_overrides | Override agent-level settings per user (language, initial message, initial state) |
Phone number normalization
The system normalizes all phone numbers to E.164 format using thecountry_code you provide. For example, with "country_code": "IN":
9876543210→+91987654321009876543210→+919876543210+919876543210→+919876543210(already valid)
Validation
Blocking — rejects the entire upload:- All referenced
column_namevalues must exist as CSV headers - CSV must have at least one data row
app_overrideskeys must be one of:initial_bot_message,initial_state_name,initial_language_nameapp_variableskeys must match the agent’s declared variables
- Phone number must be valid (normalizable to E.164)
- Required columns must be non-empty
- Formatting functions (if configured) must succeed
Statuses
| Status | Meaning |
|---|---|
processing | Upload queued and being validated |
completed | Processing finished — user context is live |
failed | Processing failed (upload-level error) |
Checking for rejected records
Afterstatus becomes completed, check result.rejected_records:
result.rejected_records > 0, download the rejection file to see which rows failed and why:
Authorizations
Body
multipart/form-data
Response
Successful Response
Cohort metadata including processing status and result counts.
Name of the cohort
Unique identifier for the cohort
Example:
"coh-x1y2z3"
Current processing status
Available options:
processing, completed, failed How the cohort was uploaded
Available options:
pre_signed_url, file_upload User who created this cohort
Example:
"user@company.com"
Timestamp when created (ISO 8601)
Example:
"2026-04-01T09:00:00Z"
Timestamp when last updated (ISO 8601)
Example:
"2026-04-01T09:02:30Z"
Processing result with record counts
User who last updated this cohort