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

# Create Batch

> Start a batch of recordings from files or URLs

A batch is a CSV that lists your recordings. Audio never goes through the API. With `direct_upload` you upload each file to storage (see [Create upload slot](https://docs.60db.ai/api-reference/call-analysis/create-upload-slot.md)). With `csv_urls` 60db downloads each `recording_url`.

> [!NOTE]
>
> Needs `manage` on the analyzer.

## Request

### Headers

**Authorization** `string` *required*

Bearer token with your API key: `Bearer sk_...`

**Content-Type** `string` *required*

application/json

### Path

**agentId** `string` *required*

Analyzer ID (UUID)

### Body

**source\_kind** `string` *required*

`direct_upload` or `csv_urls`

**csv\_text** `string` *required*

The CSV text, with a header row. Up to 5 MiB, 5,000 rows, 50 columns and 2,000 characters per cell

**name** `string`

Up to 200 characters

**mapping** `object`

Maps your CSV headers to the field names below

**default\_agent\_id** `string`

UUID of a human agent for rows that name none

### CSV columns

| Column | Used for | Notes |
| - | - | - |
| `external_call_ref` (or `call_id`) | your own call reference | |
| `file_name` | `direct_upload` | the file you will upload for this row |
| `recording_url` | `csv_urls` | public URL 60db downloads |
| `agent_external_id` | the human agent | |
| `started_at` | when the call started | ISO 8601 with UTC offset |
| `customer_number`, `campaign`, `disposition` | metadata | |

A row with a missing file name or URL is counted as `invalid` and cannot take a recording.

## Response

**201 Created**

```json theme={null}
{
  "success": true,
  "data": {
    "id": "9b7e6d5c-4b3a-4291-8f0e-1d2c3b4a5968",
    "total": 2,
    "valid": 2,
    "invalid": 0
  }
}
```

## Errors

Errors use `{ "success": false, "message": "...", "code": "..." }`. See the [overview](https://docs.60db.ai/api-reference/call-analysis/overview.md#errors) for the codes every route can return.

### This endpoint

| Status | Code | When |
| - | - | - |
| 400 | `INVALID_MAPPING` | The mapping does not fit the CSV headers |
| 400 | `CSV_TOO_MANY_ROWS` | More than 5,000 rows |
| 400 | `VALIDATION_ERROR` | A field is invalid |

## Example

```bash cURL theme={null}
curl -X POST 'https://api.60db.ai/deep-analytics/analysis-agents/3f1c2d4e-5a6b-4c7d-8e9f-0a1b2c3d4e5f/batches' \
  -H "Authorization: Bearer your-api-key" \
  -H "Content-Type: application/json" \
  -d '{"source_kind": "direct_upload", "csv_text": "call_id,file_name\nA-1,one.mp3\nA-2,two.mp3\n"}'
```

```javascript JavaScript theme={null}
const res = await fetch('https://api.60db.ai/deep-analytics/analysis-agents/3f1c2d4e-5a6b-4c7d-8e9f-0a1b2c3d4e5f/batches', {
  method: 'POST',
  headers: {
    Authorization: 'Bearer your-api-key',
    'Content-Type': 'application/json',
  },
  body: JSON.stringify({
    "source_kind": "direct_upload",
    "csv_text": "call_id,file_name\nA-1,one.mp3\nA-2,two.mp3\n"
  }),
});
const { success, data, message, code } = await res.json();
if (!success) throw new Error(`${code}: ${message}`);
```


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