> For clean Markdown of any page, append .md to the page URL.
> For a complete documentation index, see https://docs.formantai.com/llms.txt.
> For AI client integration (Claude Code, Cursor, etc.), connect to the MCP server at https://docs.formantai.com/_mcp/server.

# Create a batch call

POST https://api.voice.formantai.com/v1/batch-call
Content-Type: multipart/form-data

Uploads a CSV file and initiates a batch of outbound calls.

Reference: https://docs.formantai.com/api-reference/formant-ai-voice-api/batch-calls/create-batch-call

## OpenAPI Specification

```yaml
openapi: 3.1.0
info:
  title: formantai-openapi
  version: 1.0.0
paths:
  /v1/batch-call:
    post:
      operationId: create-batch-call
      summary: Create a batch call
      description: Uploads a CSV file and initiates a batch of outbound calls.
      tags:
        - subpackage_batchCalls
      parameters:
        - name: Authorization
          in: header
          description: Bearer authentication
          required: true
          schema:
            type: string
      responses:
        '200':
          description: Batch accepted
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Batch Calls_createBatchCall_Response_200'
        '400':
          description: Invalid request
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
        '401':
          description: Invalid or missing API key
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
        '404':
          description: Resource not found
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
      requestBody:
        content:
          multipart/form-data:
            schema:
              type: object
              properties:
                agent_id:
                  type: integer
                file:
                  type: string
                  format: binary
                  description: CSV file with a customer_phone column
                name:
                  type: string
              required:
                - agent_id
                - file
                - name
servers:
  - url: https://api.voice.formantai.com
    description: Global production
  - url: https://api.in.voice.formantai.com
    description: India production
components:
  schemas:
    BatchCall:
      type: object
      properties:
        agent_id:
          type: integer
        created_at:
          type: string
          format: date-time
        id:
          type: integer
        name:
          type: string
        scheduled_for:
          type:
            - string
            - 'null'
          format: date-time
        status:
          type: string
        total_recipients:
          type: integer
        updated_at:
          type:
            - string
            - 'null'
          format: date-time
      title: BatchCall
    Batch Calls_createBatchCall_Response_200:
      type: object
      properties:
        data:
          $ref: '#/components/schemas/BatchCall'
      title: Batch Calls_createBatchCall_Response_200
    ErrorResponseError:
      type: object
      properties:
        message:
          type: string
        type:
          type: string
      title: ErrorResponseError
    ErrorResponse:
      type: object
      properties:
        error:
          $ref: '#/components/schemas/ErrorResponseError'
      title: ErrorResponse
  securitySchemes:
    bearerAuth:
      type: http
      scheme: bearer

```

## Examples



**Request**

```json
{
  "agent_id": 456,
  "file": "<file: customer_contacts_march.csv>",
  "name": "March Follow Ups"
}
```

**Response**

```json
{
  "data": {
    "agent_id": 456,
    "created_at": "2024-04-10T08:00:00Z",
    "id": 7890,
    "name": "March Follow Ups",
    "scheduled_for": "2024-04-15T09:00:00Z",
    "status": "scheduled",
    "total_recipients": 150,
    "updated_at": "2024-04-10T08:00:00Z"
  }
}
```

**SDK Code**

```python
import requests

url = "https://api.voice.formantai.com/v1/batch-call"

files = { "file": "open('customer_contacts_march.csv', 'rb')" }
payload = {
    "agent_id": "456",
    "name": "March Follow Ups"
}
headers = {"Authorization": "Bearer <token>"}

response = requests.post(url, data=payload, files=files, headers=headers)

print(response.json())
```

```javascript
const url = 'https://api.voice.formantai.com/v1/batch-call';
const form = new FormData();
form.append('agent_id', '456');
form.append('file', 'customer_contacts_march.csv');
form.append('name', 'March Follow Ups');

const options = {method: 'POST', headers: {Authorization: 'Bearer <token>'}};

options.body = form;

try {
  const response = await fetch(url, options);
  const data = await response.json();
  console.log(data);
} catch (error) {
  console.error(error);
}
```

```go
package main

import (
	"fmt"
	"strings"
	"net/http"
	"io"
)

func main() {

	url := "https://api.voice.formantai.com/v1/batch-call"

	payload := strings.NewReader("-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"agent_id\"\r\n\r\n456\r\n-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"file\"; filename=\"customer_contacts_march.csv\"\r\nContent-Type: application/octet-stream\r\n\r\n\r\n-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"name\"\r\n\r\nMarch Follow Ups\r\n-----011000010111000001101001--\r\n")

	req, _ := http.NewRequest("POST", url, payload)

	req.Header.Add("Authorization", "Bearer <token>")

	res, _ := http.DefaultClient.Do(req)

	defer res.Body.Close()
	body, _ := io.ReadAll(res.Body)

	fmt.Println(res)
	fmt.Println(string(body))

}
```

```ruby
require 'uri'
require 'net/http'

url = URI("https://api.voice.formantai.com/v1/batch-call")

http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true

request = Net::HTTP::Post.new(url)
request["Authorization"] = 'Bearer <token>'
request.body = "-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"agent_id\"\r\n\r\n456\r\n-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"file\"; filename=\"customer_contacts_march.csv\"\r\nContent-Type: application/octet-stream\r\n\r\n\r\n-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"name\"\r\n\r\nMarch Follow Ups\r\n-----011000010111000001101001--\r\n"

response = http.request(request)
puts response.read_body
```

```java
import com.mashape.unirest.http.HttpResponse;
import com.mashape.unirest.http.Unirest;

HttpResponse<String> response = Unirest.post("https://api.voice.formantai.com/v1/batch-call")
  .header("Authorization", "Bearer <token>")
  .body("-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"agent_id\"\r\n\r\n456\r\n-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"file\"; filename=\"customer_contacts_march.csv\"\r\nContent-Type: application/octet-stream\r\n\r\n\r\n-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"name\"\r\n\r\nMarch Follow Ups\r\n-----011000010111000001101001--\r\n")
  .asString();
```

```php
<?php
require_once('vendor/autoload.php');

$client = new \GuzzleHttp\Client();

$response = $client->request('POST', 'https://api.voice.formantai.com/v1/batch-call', [
  'multipart' => [
    [
        'name' => 'agent_id',
        'contents' => '456'
    ],
    [
        'name' => 'file',
        'filename' => 'customer_contacts_march.csv',
        'contents' => null
    ],
    [
        'name' => 'name',
        'contents' => 'March Follow Ups'
    ]
  ]
  'headers' => [
    'Authorization' => 'Bearer <token>',
  ],
]);

echo $response->getBody();
```

```csharp
using RestSharp;

var client = new RestClient("https://api.voice.formantai.com/v1/batch-call");
var request = new RestRequest(Method.POST);
request.AddHeader("Authorization", "Bearer <token>");
request.AddParameter("undefined", "-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"agent_id\"\r\n\r\n456\r\n-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"file\"; filename=\"customer_contacts_march.csv\"\r\nContent-Type: application/octet-stream\r\n\r\n\r\n-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"name\"\r\n\r\nMarch Follow Ups\r\n-----011000010111000001101001--\r\n", ParameterType.RequestBody);
IRestResponse response = client.Execute(request);
```

```swift
import Foundation

let headers = ["Authorization": "Bearer <token>"]
let parameters = [
  [
    "name": "agent_id",
    "value": "456"
  ],
  [
    "name": "file",
    "fileName": "customer_contacts_march.csv"
  ],
  [
    "name": "name",
    "value": "March Follow Ups"
  ]
]

let boundary = "---011000010111000001101001"

var body = ""
var error: NSError? = nil
for param in parameters {
  let paramName = param["name"]!
  body += "--\(boundary)\r\n"
  body += "Content-Disposition:form-data; name=\"\(paramName)\""
  if let filename = param["fileName"] {
    let contentType = param["content-type"]!
    let fileContent = String(contentsOfFile: filename, encoding: String.Encoding.utf8)
    if (error != nil) {
      print(error as Any)
    }
    body += "; filename=\"\(filename)\"\r\n"
    body += "Content-Type: \(contentType)\r\n\r\n"
    body += fileContent
  } else if let paramValue = param["value"] {
    body += "\r\n\r\n\(paramValue)"
  }
}

let request = NSMutableURLRequest(url: NSURL(string: "https://api.voice.formantai.com/v1/batch-call")! as URL,
                                        cachePolicy: .useProtocolCachePolicy,
                                    timeoutInterval: 10.0)
request.httpMethod = "POST"
request.allHTTPHeaderFields = headers
request.httpBody = postData as Data

let session = URLSession.shared
let dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in
  if (error != nil) {
    print(error as Any)
  } else {
    let httpResponse = response as? HTTPURLResponse
    print(httpResponse)
  }
})

dataTask.resume()
```