# Cancel a batch

> POST /api/v1/bulk-batches/{id}/cancel: Cancel a batch.

`POST https://appliflo.com/api/v1/bulk-batches/{id}/cancel`

Every row not sent yet is cancelled; envelopes already sent are untouched (void them one by one if needed). A batch that already finished is refused.

Send your API key in the `Authorization: Bearer` header. Every response is JSON: `{ success, data, error }`.

## Parameters

| Name | In | Required | Description |
| --- | --- | --- | --- |
| `id` | path | yes | batch_id from POST /templates/{id}/bulk |

## Responses

| Status | Description |
| --- | --- |
| 200 | The batch, cancelled. |
| 401 | Missing or invalid API key, or `api_key_expired` for a key past its expiry. |
| 403 | The API key's workspace does not have access to this resource, or `insufficient_scope` (with `required_scope`) for a key without the scope this route needs. |
| 404 | Resource not found in this workspace. |
| 409 | The batch already finished (code batch_finished). |
| 422 | Request failed validation. |
| 500 | Internal error. |

## 200 response

| Field | Type | Required | Description |
| --- | --- | --- | --- |
| `success` | true | yes |  |
| `data` | object | yes |  |
| `data.batch_id` | string | yes |  |
| `data.status` | string | yes | One of: cancelled |
| `data.cancelled` | integer | yes | At least 0 |
| `data.counts` | object | yes |  |
| `data.counts.total` | integer | yes |  |
| `data.counts.queued` | integer | yes |  |
| `data.counts.sent` | integer | yes |  |
| `data.counts.failed` | integer | yes |  |
| `data.counts.excluded` | integer | yes |  |
| `data.counts.cancelled` | integer | yes |  |

See also: [Errors](https://dev.appliflo.com/guides/errors), [Rate limits](https://dev.appliflo.com/guides/rate-limits), [Idempotency](https://dev.appliflo.com/guides/idempotency).
