> ## Documentation Index
> Fetch the complete documentation index at: https://dialnexa.com/docs/llms.txt
> Use this file to discover all available pages before exploring further.

# Create Batch Call

> Upload contacts and start a batch of outbound calls.

Billable - retry unsafe
A batch call lets you upload a CSV or XLSX file of contacts and trigger a single outbound call to each one. Every row with a phone number becomes one call. A new batch is stored as `waiting` until the scheduler prepares it, or as `scheduled` when `starts_at` is in the future. `ends_at`, `calling_hours_start` and `calling_hours_end` (`HH:MM`) are stored with the batch but are not enforced by the scheduler today: calls are not held to those hours or stopped at `ends_at`.

## When to use this

* **One-shot outreach**: call a fixed list of contacts you already have in a file, such as appointment reminders or a payment-due campaign.
* **Scheduled campaigns**: upload now and let the batch start at a scheduled time.
* **Personalized calls at scale**: every extra column in your file, apart from the reserved columns below, becomes a dynamic variable in the agent's prompt, so each contact hears their own details.

If leads arrive continuously or the sequence has multiple steps, use workflows with [Upload Workflow Leads](https://dialnexa.com/docs/api-reference/v1/workflow-leads/add.md) instead. For a single immediate call, use [Create Call](https://dialnexa.com/docs/api-reference/v1/calls/create.md).

## File format

Your file must include a phone number column. The header can be `phone_number`, `phone`, `mobile`, `mobile_number`, `cell`, `telephone` or `tel`; case, spaces, underscores and hyphens in the header are ignored. Every number must start with its country code. Other column headers, apart from the reserved columns below, become **dynamic variables** that are injected into the agent's prompt for each individual call:

| phone\_number | customer\_name | loan\_amount | product |
| - | - | - | - |
| +919876543210 | Priya Sharma | 500000 | home\_loan |
| +919123456789 | Rahul Mehra | 250000 | car\_loan |

In your agent prompt, reference these as `{{customer_name}}`, `{{loan_amount}}`, etc. An empty cell sets no variable for that row.

### Reserved columns

These headers are matched the same way as the phone header and are not passed to the prompt as ordinary variables:

| Column | Behaviour |
| - | - |
| `notes` | Stored on the lead and copied to each call's `notes`. A JSON object with at most 15 top-level keys, or plain text, which is stored as `{"text": "..."}`. A JSON array, or invalid JSON that starts with `{` or `[`, returns `400`. |
| `agent_transfer_destinations` | Transfer numbers for that lead, separated by the pipe character. Validated, then passed to the call as the `agent_transfer_destinations` variable. An invalid value returns `400`. |
| `tags` | Validated, then not saved: batch leads do not keep tags. An invalid value returns `400`. |

### Row rules

* CSV: blank rows and rows with an empty phone number are skipped. A row with more values than the header has columns returns `400`; wrap values that contain commas in double quotes. Extra empty values at the end of a row are ignored.
* XLSX and XLS: only the first sheet is read, and a row with an empty phone number returns `400`. Values in a column with no header are skipped.
* A file with no usable phone number returns `400`.

## Batch vs. Campaign

Use a **batch call** for a one-shot outreach where you upload the full list upfront and do not need to add leads later. If you need to stop and restart execution, use [Update Batch Call Status](https://dialnexa.com/docs/api-reference/v1/batches/status.md). If you need incremental lead enrollment, use workflows.

## Queue Behavior

Multiple batches can run concurrently in one workspace and share its available calling capacity. A `waiting` batch is awaiting scheduler preparation; it does not need another batch to finish first. Future-start batches remain `scheduled` until eligible for preparation. See the [batch lifecycle state machine](https://dialnexa.com/docs/batch-calls/retries-and-statuses.md#batch-lifecycle-state-machine) before automating status changes.

Treat create requests as billable and retry unsafe. If the client times out, call [List Batch Calls](https://dialnexa.com/docs/api-reference/v1/batches/list.md) before repeating the upload so you do not create a duplicate batch.

The create response no longer includes a scheduling-conflict warning for other batches. Available concurrency and call-start capacity still determine how quickly calls are placed.

The create response always reports `status: "initiated"` and does not include `created_at`. The stored batch is already `waiting` or `scheduled`; read its real status from [List Batch Calls](https://dialnexa.com/docs/api-reference/v1/batches/list.md).

## File requirements

* Formats: CSV, XLSX, XLS
* Max size: 10 MB. A larger file returns `413`.
* Required column: a phone number column, as described in [File format](#file-format)
* Batch title: `35` characters or fewer
* Every phone number must start with its country code, for example `+919876543210`. A leading `+` or `00` is optional, so `919876543210` is read the same way, but `9876543210` is read as country code `98` and fails validation.
* The workspace needs a billing plan and a spendable wallet balance, and must be under its monthly spend cap; otherwise the API returns `402 Payment Required`.
* Rows whose number is on the workspace's DNC list are left out: no lead is created for them, and `dnc_skipped_count` in the response counts them. If every row's number is on the DNC list, the API returns `400` and no lead is created. A queued call whose number is added to the DNC list before it dials fails with `end_reason` `dnc_blocked`.

`agent_version_number` is optional. If you omit it, DialNexa uses the agent's latest published version. If you provide it, that version must exist and be published. The batch stays on this version even if the agent is published again.

## Choose The From Number

The batch dials from one of the agent's outbound numbers. Pass `phone_number_id` (a `phn_` ID from [List Agent Phone Numbers](https://dialnexa.com/docs/api-reference/v1/agents/list-phone-numbers.md)) to choose it. When the agent has exactly one outbound number you can omit it. When it has several, omitting it returns `400 Bad Request` with code `PHONE_NUMBER_REQUIRED` and the agent's numbers in `data.phone_number_ids`. A `phone_number_id` that is not one of the agent's outbound numbers returns `400` with code `PHONE_NUMBER_NOT_LINKED`. An agent with no outbound number returns `400`; [attach one](https://dialnexa.com/docs/api-reference/v1/agents/attach-phone-number.md) first. Error bodies on this route have the shape `{ "message": "...", "data": { "code": "..." } }`.

If `title` is longer than `35` characters, the API returns `400 Bad Request` with a clear validation message instead of creating the batch.

Binding checks happen before the campaign is written. The API returns `404 Not Found` for an agent outside the workspace or a requested version that does not exist. It returns `400 Bad Request` when the agent has no published version, the requested version is still a draft, or the From number cannot be resolved as described above. A successful response reports the number the batch dials from in `from_number`.

## Create Batch Calls With Retry Settings

Send `number_of_retries` and `interval_between_retries` as multipart fields when configuring retries. Retry count is an integer from 0 to 4; the interval is an integer from 0 to 1440 minutes. Set both to zero, or omit both, to disable retries, or use a positive count and interval. When both fields are supplied, mixing zero and a positive value returns `400`. Send the two fields together: a positive count without an interval is accepted and its retries are scheduled with no wait.

A retry is scheduled the interval after the attempt ends, then, when the From number's country has a known time zone, moved into 10:00 to 21:00 local time (to 10:00 the same or next day). This window applies to retries only; it is not the batch's `calling_hours_start` and `calling_hours_end`.

Files must be CSV, XLSX, or XLS and no larger than 10 MB. The documented batch endpoints do not return a batch's retry settings after creation, so record the values you sent. Before attempting another create request, check the batch's status with [List Batch Calls](https://dialnexa.com/docs/api-reference/v1/batches/list.md).

## Destination validation

Before launch, each row is checked against the outbound route selected for the batch. For non-SIP routes, the destination country and prefix must be enabled in **Workspace Settings > Telephony**.

If one or more rows fail validation, the API returns `400 Bad Request` with grouped error details, including the affected row numbers. Common reasons include invalid phone number format, unsupported destination country, unsupported prefix, or no enabled countries configured. While the workspace's KYC is still pending, every row must be the owner's registered phone number; any other number returns `403 Forbidden`.

The dashboard preview path can show invalid rows before launch so operators can edit or remove them. Direct API create requests still reject the whole file when row validation fails, so repair the file before retrying.

A create request that fails, for example on row validation, the KYC check or an unsupported file type, leaves no batch behind.


## OpenAPI

````yaml POST /v1/batch-calls
openapi: 3.0.0
info:
  title: DialNexa API
  description: Public `/v1` REST API for the DialNexa voice AI platform.
  version: 1.0.0
servers:
  - url: https://api.dialnexa.com
    description: DialNexa production API
security:
  - bearer: []
tags:
  - name: Agents
  - name: Batch Calls
  - name: Calls
  - name: Knowledge Base
  - name: Languages
  - name: LLMs
  - name: Phone Numbers
  - name: Organization Folders
  - name: Transcribers
  - name: Webhooks
  - name: Voices
  - name: Workflows
  - name: Workflow Leads
  - name: Authentication
  - name: Agent Builder
  - name: Agent Evaluations
paths:
  /v1/batch-calls:
    post:
      tags:
        - Batch Calls
      summary: Create Batch Call
      description: >-
        Uploads a CSV or Excel file and creates a batch pinned to a published
        agent version and an outbound number. The response status initiated
        means accepted; the saved job is waiting or scheduled. Multiple batches
        can run concurrently within available workspace capacity. A request that
        fails, for example on row validation, KYC or an unsupported file type,
        leaves no batch behind.
      operationId: createBatchCall
      parameters: []
      requestBody:
        required: true
        content:
          multipart/form-data:
            schema:
              type: object
              required:
                - file
                - title
                - agent_id
              properties:
                file:
                  type: string
                  format: binary
                  description: >-
                    CSV, XLSX or XLS file containing leads (max 10 MB). Needs a
                    phone number column; every number must include its country
                    code.
                title:
                  type: string
                  example: Q3 Follow-up Batch
                agent_id:
                  type: string
                  example: agent_abc123
                agent_version_number:
                  type: number
                  example: 1
                  description: >-
                    Must be a published version. Omit to use the agent's latest
                    published version. The batch stays on this version even if
                    the agent is published again.
                phone_number_id:
                  type: string
                  example: phn_abc123
                  description: >-
                    One of the agent's outbound numbers to dial from. Required
                    when the agent has more than one outbound number.
                starts_at:
                  type: string
                  example: '2026-10-15T09:00:00Z'
                  description: 'ISO 8601 datetime: leave empty to start immediately'
                ends_at:
                  type: string
                  example: '2026-10-20T18:00:00Z'
                  description: >-
                    ISO 8601 datetime stored with the batch. The scheduler does
                    not enforce it today: calls are not stopped at this time.
                calling_hours_start:
                  type: string
                  example: '09:00'
                  description: >-
                    Time of day (for example `09:00`) stored with the batch. The
                    scheduler does not enforce it today. The API does not
                    validate it; a value that is not a valid time returns 500.
                calling_hours_end:
                  type: string
                  example: '18:00'
                  description: >-
                    Time of day (for example `18:00`) stored with the batch. The
                    scheduler does not enforce it today. The API does not
                    validate it; a value that is not a valid time returns 500.
                number_of_retries:
                  type: integer
                  minimum: 0
                  maximum: 4
                  example: 2
                  description: >-
                    How many times to retry a lead that did not connect, from 0
                    to 4. Omit both retry fields for no retries. Must be 0 when
                    interval_between_retries is 0, and greater than 0 when it is
                    not; send both fields together.
                interval_between_retries:
                  type: integer
                  minimum: 0
                  maximum: 1440
                  example: 30
                  description: >-
                    Minutes to wait between retries, from 0 to 1440. Must be 0
                    when number_of_retries is 0, and greater than 0 when it is
                    not. Send it whenever number_of_retries is above 0: without
                    it the retry is scheduled with no wait.
            examples:
              request:
                summary: Request example
                value:
                  file: leads.csv
                  title: Q3 Follow-up Batch
                  agent_id: agent_abc123
                  agent_version_number: 1
      responses:
        '201':
          description: >-
            Batch accepted. status is initiated; from_number identifies the
            selected outbound number. No scheduling-conflict warning is
            returned.
          content:
            application/json:
              schema:
                type: object
                properties:
                  id:
                    type: string
                    example: batch_abc123
                  total_records:
                    type: number
                    example: 250
                  dnc_skipped_count:
                    type: number
                    example: 0
                    description: >-
                      Leads left out because their number is on the workspace's
                      DNC list
                  status:
                    type: string
                    example: initiated
                  from_number:
                    type: string
                    nullable: true
                  title:
                    type: string
              examples:
                success:
                  summary: Successful response
                  value:
                    id: batch_abc123
                    total_records: 250
                    dnc_skipped_count: 0
                    status: initiated
                    from_number: '+14155552671'
                    title: Q3 Follow-up Batch
        '400':
          description: >-
            Invalid file, malformed rows or missing required fields, invalid
            retry or date fields, rows whose numbers fail validation (with
            validation_errors and invalid_row_count), the resolved agent version
            is unpublished, the agent has no outbound number, phone_number_id is
            not one of its outbound numbers (PHONE_NUMBER_NOT_LINKED), or the
            agent has several outbound numbers and none was chosen
            (PHONE_NUMBER_REQUIRED, with phone_number_ids in data).
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/FilteredErrorResponse'
              examples:
                error:
                  summary: 400 Bad Request
                  value:
                    message: >-
                      Request validation failed: No valid phone numbers found in
                      CSV
                titleTooLong:
                  summary: Title too long
                  value:
                    message: >-
                      Request validation failed: title must be 35 characters or
                      fewer (received 42).
                unpublishedVersion:
                  summary: Agent version is still a draft
                  value:
                    message: >-
                      Request validation failed: Version 2 of agent agent_abc123
                      is a draft. Publish it before starting a call.
                phoneNumberNotLinked:
                  summary: 400 Bad Request
                  value:
                    message: >-
                      Request validation failed: Phone number phn_abc123 is not
                      an outbound number of agent agent_abc123.
                    data:
                      code: PHONE_NUMBER_NOT_LINKED
                phoneNumberRequired:
                  summary: 400 Bad Request
                  value:
                    message: >-
                      Request validation failed: Agent agent_abc123 has 2
                      outbound numbers. Pass phone_number_id to choose which one
                      to dial from.
                    data:
                      code: PHONE_NUMBER_REQUIRED
                      phone_number_ids:
                        - phn_abc123
                        - phn_def456
                rowValidation:
                  summary: Rows whose numbers fail validation
                  value:
                    message: >-
                      Request validation failed: 1 phone number failed
                      validation.

                      Phone Number "12345" Could Not Be Parsed. Use
                      International Format Such As +447700900123. (row: 3)
                    validation_errors:
                      - error: >-
                          Phone Number "12345" Could Not Be Parsed. Use
                          International Format Such As +447700900123.
                        rows:
                          - 3
                        phone_numbers:
                          - '12345'
                    invalid_row_count: 1
                allNumbersOnDnc:
                  summary: Every number is on the DNC list
                  value:
                    message: >-
                      Request validation failed: All 2 numbers in this file are
                      on your workspace's DNC list, so there is nothing to call.
        '401':
          description: Unauthorized - missing or invalid API key.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/FilteredErrorResponse'
              examples:
                error:
                  summary: 401 Unauthorized
                  value:
                    message: >-
                      API key is missing or invalid. You can generate this by
                      logging in into dashboard
        '402':
          description: >-
            The workspace has no billing plan or no spendable balance, or its
            monthly spend cap is reached.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/FilteredErrorResponse'
              examples:
                error:
                  summary: 402 Payment Required
                  value:
                    message: >-
                      Insufficient wallet credits. Please recharge to create
                      campaigns.
                spendCapReached:
                  summary: Monthly spend cap reached
                  value:
                    message: >-
                      Monthly spend cap reached (₹5,000.00 of ₹5,000.00 used).
                      Raise it in Billing → Balance alerts, or it resets on 1
                      Nov.
        '403':
          description: >-
            The workspace owner's KYC is not verified and a lead's phone number
            is not the owner's registered number (not enforced for SIP numbers).
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/FilteredErrorResponse'
              examples:
                error:
                  summary: >-
                    KYC pending: destinations limited to the owner's registered
                    phone
                  value:
                    message: Verify Your KYC to schedule a batch
        '404':
          description: >-
            Agent not found in the workspace, the requested agent version does
            not exist, or the uploaded file is not a .csv, .xls or .xlsx file
            (Unsupported file type).
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/FilteredErrorResponse'
              examples:
                versionNotFound:
                  summary: Agent version not found
                  value:
                    message: >-
                      Agent agent_abc123 has no version 9. Published versions:
                      1, 3.
        '413':
          description: The uploaded file is larger than 10 MB.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/FilteredErrorResponse'
              examples:
                error:
                  summary: 413 Payload Too Large
                  value:
                    message: An unexpected error occurred. Please try again later.
        '500':
          description: Internal server error.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/FilteredErrorResponse'
              examples:
                error:
                  summary: 500 Internal Server Error
                  value:
                    message: An unexpected error occurred. Please try again later.
      security:
        - bearer: []
components:
  schemas:
    FilteredErrorResponse:
      type: object
      description: >-
        Error body on calls, batch calls, voices, languages and LLMs, which
        return only the message (and data for a coded refusal).
      properties:
        message:
          type: string
        data:
          type: object
          properties:
            code:
              type: string
              description: Machine-readable refusal code.
          description: >-
            Present for a coded refusal: code and the details listed for that
            code.
        validation_errors:
          type: array
          description: >-
            Present when uploaded rows fail number validation (batch and
            workflow lead uploads): one group per distinct error.
          items:
            type: object
            properties:
              error:
                type: string
              rows:
                type: array
                items:
                  type: integer
                description: Row numbers with this error.
              phone_numbers:
                type: array
                items:
                  type: string
        invalid_row_count:
          type: integer
          description: 'Present with validation_errors: how many rows failed.'
      required:
        - message
  securitySchemes:
    bearer:
      scheme: bearer
      type: http

````

This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.