> ## 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

> Check up to 100,000 messages in one job, from an uploaded file or inline items.

Creates a batch from an upload or from inline items. The batch starts as `validating` while its input is read. Poll [Get a Batch](https://docs.zerodrift.com/api-reference/batches/get-batch.md) until its `status` is `ended` or `failed`. A failed batch says why in `failure`.

Batches run detection and verification on Anchor 3.0 (`anchor_3_0`) against your managed rule packs. They don't rewrite, and they can't run custom rules or trained adapters yet. A batch expires 24 hours after it's created. For the whole flow, see [Audit Historical Messages](https://docs.zerodrift.com/guides/audit-historical-messages.md). Needs a full-access API key.

> [!NOTE]
>
> **This is how you start an audit.** There's no separate audit endpoint. Every batch gets an audit report, the workbook and PDF (see `report_status` on [Get a Batch](https://docs.zerodrift.com/api-reference/batches/get-batch.md)), when it ends, and appears under **Audits** in Command. Set `metadata.name` to name it there.

## Request Body

Send exactly one of `upload_id` or `items`.

**upload\_id** `string`

The `upload_id` from [Create a Batch Upload URL](https://docs.zerodrift.com/api-reference/batches/create-upload-url.md), after the file is uploaded. Files can be up to 256 MB.

**items** `array`

The messages inline, each in the same shape as a file line (`custom_id`, `content`, optional `metadata`). For batches that fit in one request, about 5 MB. Invalid items return `400 invalid_items` with each item's index.

**validation\_scope** `object`

Which rules to check, as on [Enforce Content](https://docs.zerodrift.com/api-reference/validate/validate-content.md): `rulepacks`, `rules`, `imports` or `managed_only`. Resolved once and applied to every message. Leave it out to check your active managed rule packs.

**skip\_problem\_rows** `boolean` (default: false)

When `true`, lines that break a per-line rule (invalid JSON, a bad or duplicate `custom_id`, empty or oversized `content`, invalid `metadata`) are dropped and counted in `skipped_items`, instead of failing the batch. For duplicate IDs, the first line is kept. Skipped lines aren't billed. The batch still fails if no line is usable or the file itself is invalid.

**metadata** `object`

Your own data about the batch, at most 16 KB, returned unchanged by [Get a Batch](https://docs.zerodrift.com/api-reference/batches/get-batch.md). Set `name` to label the batch in Command.

**model\_engine** `string` (default: anchor\_3\_0)

Only `anchor_3_0`.

## Response

**batch\_id** `string`

The batch's ID, `batch_` followed by 32 hex characters.

**status** `string`

Always `validating` on creation.

**created\_at** `string`

When the batch was created.

**expires\_at** `string`

24 hours after `created_at`. Messages not checked by then end as `expired` and aren't billed.

**poll** `object`

The request to poll for status.

```bash From an upload theme={null}
curl -X POST https://api.zerodrift.ai/api/v3/batches \
  -H "x-api-key: YOUR_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "upload_id": "703c343c018b42ad88bdd56cc8175c0b",
    "skip_problem_rows": true,
    "metadata": { "name": "Q4 outbound review" }
  }'
```

```bash Inline items theme={null}
curl -X POST https://api.zerodrift.ai/api/v3/batches \
  -H "x-api-key: YOUR_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "items": [
      { "custom_id": "email-001", "content": "Hi Dana, attached is the agenda for Thursday." },
      { "custom_id": "email-002", "content": "Returns of 12-14% are guaranteed." }
    ],
    "validation_scope": { "rulepacks": ["finra-2210"] },
    "metadata": { "name": "Spot check" }
  }'
```

```json 202 Accepted theme={null}
{
  "api_version": "v3",
  "batch_id": "batch_703c343c018b42ad88bdd56cc8175c0b",
  "status": "validating",
  "created_at": "2026-12-02T19:46:37Z",
  "expires_at": "2026-12-03T19:46:37Z",
  "poll": {
    "method": "GET",
    "url": "/api/v3/batches/batch_703c343c018b42ad88bdd56cc8175c0b"
  }
}
```

## Errors

No batch is created for these.

| Status | Code | Meaning |
| - | - | - |
| `400` | `invalid_items`, `invalid_validation_scope` | The body or scope is invalid. |
| `402` | | No credit left. |
| `404` | | No upload with this ID is yours. |
| `409` | | This upload has already been used for a batch. |
| `413` | | The upload is over 256 MB. |
| `422` | `batch_scope_unsupported` | The scope needs custom rule text or a trained adapter, which batches can't run, or resolves to no rules. |
| `422` | `rule_severity_unavailable` | A rule in scope has no severity set. `error.ids` lists them. |
| `429` | `batch_quota_exceeded` | You're at your plan's limit of running batches or messages in flight. `error.limits` and `error.current` show both. Wait for a batch to end, or cancel one. |

A batch can also be accepted and then fail while its file is read. See [When a batch fails](https://docs.zerodrift.com/guides/audit-historical-messages.md#when-a-batch-fails).


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