Workflow Leads
Upload Workflow Leads
Upload leads to a workflow.
POST
Upload Workflow Leads
Changes state - verify before retry
Uploads leads into a workflow from a CSV or Excel file. Each row with a phone number becomes one enrolled lead. Ordinary data columns become dynamic variables available in the agent’s prompt at each voice call step.
Write phone numbers in international format with the country code, for example
Draft workflows are replaced, others are appended
What an upload does to the leads already in the workflow depends on the workflow’s status:
So on a draft workflow, upload the complete lead list in one file. To add more leads later, activate the workflow first.
When to use this
- Enrolling a cohort: add a set of leads to a workflow that is already built.
- Incremental enrollment: keep feeding new leads into an active workflow as they arrive, unlike a batch call where the list is fixed at creation.
- Re-enrollment after correction: on an active workflow, remove a lead that was uploaded with bad data via Delete Workflow Lead, then upload the corrected record here. On a draft workflow, upload the corrected complete file instead.
File format
Send a CSV, XLSX, or XLS file up to 10 MB in the multipartfile field; a larger file returns 413. The file name must end in .csv, .xlsx or .xls, and the part’s Content-Type must be text/csv, application/vnd.openxmlformats-officedocument.spreadsheetml.sheet or application/vnd.ms-excel. A part sent as application/octet-stream is rejected with 400.
+919876543210. A number without a country code is read as if its first digits were one: 9876543210 is read as +98... and fails destination validation. Numbers are stored exactly as written in the file.
Tags
Add an optional multiparttags field, such as priority,september, to label every lead in the upload. It is combined with each row’s own tags column. Tags are comma- or pipe-separated, lowercased, whitespace-normalized, and deduplicated, with at most 20 tags per lead and 40 characters per tag. A tag over 40 characters, or more than 20 tags in the tags field or in one row’s tags column, fails the upload with 400 before any lead is created. When the field and a row’s column together exceed 20 tags, the upload returns 400 at that row, after the rows before it have been created. Because an upload to a draft workflow replaces its leads, the draft then holds only the rows before that one; upload the corrected complete file.
Response
A201 response carries, inside data:
data: the created lead IDs (lead_...) grouped by phone number, as written in the file.count: the number of leads created.dnd_skipped_count: rows left out because their number is on the workspace’s DND list.0when none was.tags: every tag applied in this upload.errors: present only when some rows failed, one message per row. Rows are numbered fromRow 1in order of the rows that have a phone number; blank rows and rows without a number are skipped and not counted. The message is thenLeads uploaded with N row(s) failed.instead ofLeads uploaded successfully, and the status is still201. On an active workflow, a row whose lead was created but could not be started is also listed here; that lead is included incountanddata. Check List Workflow Leads before uploading such a row again, so the contact is not enrolled twice.unused_columnsandallowed_columns: present only when some data columns are not referenced by any node or agent prompt in the workflow. The columns are still stored on the leads. The reservednotesandagent_transfer_destinationscolumns can also be listed inunused_columns.
Destination validation
If the workflow contains Voice Call nodes, every row is validated before any lead is created. A lead’sphone_number must be valid and must be allowed by at least one active Voice Call phone number in the workflow.
For non-SIP routes, the destination country and prefix must be enabled in Workspace Settings > Telephony. Validation failures return 400 Bad Request with grouped row-level errors and no lead is created, so you can fix the file and retry. These errors number rows by their line in the file, with the header as row 1, so the first data row is row 2.
Numbers on the DND list
Rows whose number is on the workspace’s DND list are skipped: no lead is created and nothing is processed for them, anddnd_skipped_count in the response counts them. If every row’s number is on the DND list, the upload returns 400 Bad Request (All N numbers in this file are on your workspace's DND list, so there is nothing to call.) and creates nothing; on a draft workflow the existing leads are kept. A lead whose number is added to the DND list after upload is stopped before its next step of any kind, with the lead status dnd_blocked. The DND list is managed in the dashboard, not through the API.Authorizations
Bearer authentication header of the form Bearer <token>, where <token> is your auth token.
Path Parameters
Workflow ID
Example:
"workflow_abc123"
Body
multipart/form-data
CSV, XLSX, or XLS file, at most 10 MB (10485760 bytes). The part's Content-Type must be text/csv, application/vnd.openxmlformats-officedocument.spreadsheetml.sheet or application/vnd.ms-excel, and the file name must end in .csv, .xlsx or .xls.
Optional comma- or pipe-separated labels for every lead. Unioned with the reserved tags column, normalized to lowercase, at most 20 tags per lead and 40 characters per tag.