# POST /v1/batches

> CreateBatch

- `operationId`: `V1BatchesCreateBatch`
- Group: [Batch API](https://sference.com/docs/api-reference/batch-api.md)
- API spec (machine-readable): https://sference.com/openapi.json
- HTML version: https://sference.com/docs/api-reference/batch-api/V1BatchesCreateBatch

## Request body (required)

Content type `application/json`. Schema: `BatchCreateRequest`

| Field | Type | Required | Constraints | Description |
| --- | --- | --- | --- | --- |
| `window` | string | no | default `"24h"` | Completion window for every row in the batch (`"24h"` is the only supported value). |
| `requests` | array<InferenceRequest> | yes | — | One or more inference rows sharing the same `body.model`. Each `body` is normalized to chat-completions shape at create (Responses `input` → `messages`), validated, then enqueued. Invalid rows return HTTP 400 with `requests[i]` and optional `custom_id`. |

## Responses

### `201` — Document created, URL follows

Schema: `BatchResponse`

| Field | Type | Required | Constraints | Description |
| --- | --- | --- | --- | --- |
| `id` | string | yes | — | — |
| `status` | string | yes | enum: pending | running | completed | failed | cancelled | — |
| `window` | string | yes | — | — |
| `request_count` | integer | yes | — | — |
| `created_at` | string | yes | — | — |
| `updated_at` | string | yes | — | — |
| `completed_at` | string \| null | no | — | — |
| `total_prompt_tokens` | integer | no | default `0` | — |
| `total_completion_tokens` | integer | no | default `0` | — |
| `total_tokens` | integer | no | default `0` | — |
| `total_cost_micros` | integer | no | default `0` | — |

### `400` — Bad request syntax or unsupported method

Schema: `object`

| Field | Type | Required | Constraints | Description |
| --- | --- | --- | --- | --- |
| `status_code` | integer | yes | — | — |
| `detail` | string | yes | — | — |
| `extra` | null \| object \| array | no | — | — |

Source: https://sference.com/docs/api-reference/batch-api/V1BatchesCreateBatch
