# POST /v1/batches/{batch_id}/cancel

> CancelBatch

- `operationId`: `V1BatchesBatchIdCancelCancelBatch`
- 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/V1BatchesBatchIdCancelCancelBatch

## Parameters

| Name | In | Type | Required | Description |
| --- | --- | --- | --- | --- |
| `batch_id` | path | string | yes | — |

## Responses

### `200` — Request fulfilled, document 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/V1BatchesBatchIdCancelCancelBatch
