Skip to main content
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.

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.
For a one-shot list where every contact just gets a single call, Create Batch Call is the simpler tool.

File format

Send a CSV, XLSX, or XLS file up to 10 MB in the multipart file 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.
Write phone numbers in international format with the country code, for example +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 multipart tags 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

A 201 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. 0 when none was.
  • tags: every tag applied in this upload.
  • errors: present only when some rows failed, one message per row. Rows are numbered from Row 1 in order of the rows that have a phone number; blank rows and rows without a number are skipped and not counted. The message is then Leads uploaded with N row(s) failed. instead of Leads uploaded successfully, and the status is still 201. On an active workflow, a row whose lead was created but could not be started is also listed here; that lead is included in count and data. Check List Workflow Leads before uploading such a row again, so the contact is not enrolled twice.
  • unused_columns and allowed_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 reserved notes and agent_transfer_destinations columns can also be listed in unused_columns.
Check List Workflow Leads after upload. If the workflow is active, new leads can immediately advance into calls and incur charges. After an error or timeout, inspect enrolled leads before retrying the file, because some leads may already have been created. On a draft workflow, a retry replaces them.

Destination validation

If the workflow contains Voice Call nodes, every row is validated before any lead is created. A lead’s phone_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, and dnd_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

Authorization
string
header
required

Bearer authentication header of the form Bearer <token>, where <token> is your auth token.

Path Parameters

workflowId
string
required

Workflow ID

Example:

"workflow_abc123"

Body

multipart/form-data
file
file
required

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.

tags
string

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.

Response

File processed successfully.

success
enum<boolean>
required
Available options:
true
error
enum<boolean>
required
Available options:
false
statusCode
integer
required
Example:

201

message
string
required
Example:

"Success"

data
object
required
timestamp
string<date-time>
required