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

# Create a Batch Upload URL

> Get a URL to upload a JSONL file of messages for a batch.

Step one of a file batch. Returns an `upload_url` for one JSONL file. `PUT` the file to it with every header in `required_headers`, then pass the `upload_id` to [Create a Batch](https://docs.zerodrift.com/api-reference/batches/create-batch.md). Each upload creates one batch.

For the whole flow, see [Audit Historical Messages](https://docs.zerodrift.com/guides/audit-historical-messages.md). Needs a full-access API key.

## Request Body

Send an empty object `{}` or no body.

**kind** `string` (default: jsonl)

The file type. Only `jsonl` is supported.

## File format

The file you `PUT` to `upload_url` has one JSON object per line. These fields go in the file, not in this request.

| Field | Required | Rules |
| - | - | - |
| `custom_id` | Yes | 1–64 letters, digits, `_` or `-`. Unique in the file. |
| `content` | Yes | The message text. Not empty, at most 1 MB. |
| `metadata` | No | Any JSON object. Returned with the item's result. |

## Response

**upload\_id** `string`

Pass to [Create a Batch](https://docs.zerodrift.com/api-reference/batches/create-batch.md) or [Check a Batch Upload](https://docs.zerodrift.com/api-reference/batches/check-upload.md).

**upload\_url** `string`

Where to `PUT` the file.

**upload\_method** `string`

Always `PUT`.

**required\_headers** `object`

Headers the `PUT` must send exactly as given. The URL is signed with them.

**expires\_at** `string`

When `upload_url` stops working, 15 minutes after the request.

**max\_upload\_bytes** `integer`

Largest file accepted, in bytes (256 MB).

**max\_items** `integer`

Most lines a file can hold (100,000).

```bash cURL theme={null}
curl -X POST https://api.zerodrift.ai/api/v3/batches/uploads \
  -H "x-api-key: YOUR_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{}'
```

```json 201 Created theme={null}
{
  "api_version": "v3",
  "upload_id": "703c343c018b42ad88bdd56cc8175c0b",
  "kind": "jsonl",
  "upload_url": "https://example-bucket.s3.amazonaws.com/batch-uploads/703c343c018b42ad88bdd56cc8175c0b.jsonl?X-Amz-Algorithm=...",
  "upload_method": "PUT",
  "required_headers": {
    "Content-Type": "application/x-ndjson",
    "x-amz-meta-customer_id": "cust_123"
  },
  "expires_at": "2026-12-02T20:01:32Z",
  "max_upload_bytes": 268435456,
  "max_items": 100000
}
```

> [!WARNING]
>
> Send every header in `required_headers` exactly as given. A missing or changed header makes the upload fail with `SignatureDoesNotMatch`.


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