# Cancel reservation

`POST /v2/bob-box/reservations/cancel`

**Base URLs:**

- Production: `https://api.bobbox.co.za`

**Authentication:** Bearer token required (see the Authentication page).

## Example request

```bash
curl -X POST 'https://api.bobbox.co.za/v2/bob-box/reservations/cancel' \
  -H "content-type: application/json" \
  -H "Authorization: Bearer <API_KEY>" \
  -d '{
    "reservation_id": 3475
}'
```

Cancel a reservation that has not been dropped off yet, freeing up the compartment.

> **Only a reservation still in `waiting-for-dropoff` can be cancelled.** Once the parcel is in the locker there is nothing to cancel — every other status, `waiting-for-pickup` included, is rejected.

### Request

**Method:** POST
**URL:** `https://api.bobbox.co.za/v2/bob-box/reservations/cancel`

#### Request body parameters

| Key | Description | Type | Required |
| --- | --- | --- | --- |
| reservation_id | The ID of the reservation to cancel. | integer | Conditional* |
| id | Alias for `reservation_id`. | integer | Conditional* |

\* Send either `reservation_id` or `id`. If you send both, `id` wins.

### Response

**Status code:** 200 OK
**Content-Type:** application/json

**Response body:**

```json
"success"
```

The body is a plain JSON string, not an object.

#### Errors

| Status | Message | Cause |
| --- | --- | --- |
| 400 | `id is required` | Neither `reservation_id` nor `id` was sent. |
| 400 | `could not find reservation` | No reservation with that ID. |
| 400 | `cannot cancel a reservation that is not waiting for dropoff` | The reservation is already dropped off, complete, expired, cancelled, returned, or cleared. |
| 403 | `cannot cancel reservations for a different account` | The reservation belongs to another account. |
