# POST /batches/{id}/cancel

This operation allows you to cancel a Batch which is in DRAFT status.

All Payments associated to the Batch will also be cancelled.&#x20;

### Request

Ensure the bearer token is included in the Header of the POST operation:

<table><thead><tr><th width="197.33333333333331">Header</th><th width="120">Mandatory</th><th>Description</th></tr></thead><tbody><tr><td><code>Authorization</code></td><td>Yes</td><td>Bearer token from <a href="../../redemptions-api/authentication/post-authentication-gettoken">/authentication/getToken</a></td></tr></tbody></table>

<table><thead><tr><th width="199.33333333333331">Parameter</th><th width="118">Mandatory</th><th>Description</th></tr></thead><tbody><tr><td><code>id</code></td><td>Yes</td><td>The Batch ID to cancel</td></tr></tbody></table>

### Response

If the Batch was in DRAFT status, and the Batch could be successfully cancelled, the Batch details will return, including a Batch Summary:

```
{
  "id": "string($guid)",
  "name": "string",
  "statusCode": "string",
  "externalId": "string",
  "createdAt": "string($date-time)",
  "summary": {
    "paymentsAmount": decimal,
    "paymentsCount": int32,
    "referralsAmount": decimal,
    "settledAmount": decimal,
    "settledCount": int32,
    "cancelledAmount": decimal,
    "cancelledCount": int32
  }
}
```

Refer to [`GET /batches/{id}`](https://6dot50.gitbook.io/6dot50-apis/pay-api/batches/get-batches-id) for details on the field values.

{% hint style="info" %}
The `statusCode` for the Batch will return as CANCELLED. In addition, `cancelledAmount` and `cancelledCount` for the Batch Summary will be populated.
{% endhint %}

{% code title="Sample Response" %}

```
{
  "id": "f945d71c-b00f-4e77-8175-253093157a2f",
  "name": "Test",
  "statusCode": "CANCELLED",
  "createdAt": "2022-06-14T06:26:43.473",
  "summary": {
    "paymentsAmount": 18500,
    "paymentsCount": 185,
    "referralsAmount": 0,
    "settledAmount": 0,
    "settledCount": 0,
    "cancelledAmount": 18500,
    "cancelledCount": 185
  }
}
```

{% endcode %}

{% hint style="info" %}
You can use [`GET /batches/{id}/payments`](https://6dot50.gitbook.io/6dot50-apis/pay-api/batches/get-batches-id-payments) to get further details on the individual Payments that were cancelled.
{% endhint %}
