> ## Documentation Index
> Fetch the complete documentation index at: https://docs.pageonetravel.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Cancel API

> Cancel a booking by booking reference.

## Endpoint

```http theme={null}
POST /api/cancel
```

## Authentication

* Required header: `api-key: <partner-api-key>`
* Required body field: `settings.access.code`

## Headers

| Header            | Required | Description               |
| ----------------- | -------- | ------------------------- |
| `Content-Type`    | Yes      | `application/json`        |
| `api-key`         | Yes      | Partner API key           |
| `connection-code` | Optional | Auto-filled from body     |
| `session-id`      | Optional | Auto-generated if missing |

## Request Body

### Top-level fields

| Field      | Type   | Required | Notes                      |
| ---------- | ------ | -------- | -------------------------- |
| `input`    | object | Yes      | Cancel input               |
| `settings` | object | Yes      | Must include `access.code` |

### `input` fields

| Field                        | Type   | Required | Notes                                        |
| ---------------------------- | ------ | -------- | -------------------------------------------- |
| `accommodation.type`         | string | No       | Optional, currently not used in cancel logic |
| `accommodation.code`         | string | No       | Optional, currently not used in cancel logic |
| `language`                   | string | No       | Optional                                     |
| `reference.bookingReference` | string | Yes      | Booking reference to cancel                  |

## Example Request

```json theme={null}
{
  "input": {
    "reference": {
      "bookingReference": "BK_EXAMPLE_001"
    },
    "language": "EN"
  },
  "settings": {
    "access": {
      "code": 10001
    }
  }
}
```

## Success Response

```json theme={null}
{
  "data": {
    "status": "cancelled",
    "cancelledAt": "2026-02-11T18:46:12.201Z"
  },
  "message": "success"
}
```

## Response Fields

| Field                | Type     | Notes                  |
| -------------------- | -------- | ---------------------- |
| `data.status`        | string   | `cancelled`            |
| `data.cancelledAt`   | datetime | Cancellation timestamp |
| `data.cancelLocator` | string   | Optional (reserved)    |
| `data.reference`     | object   | Optional (reserved)    |
| `data.bookPrice`     | object   | Optional (reserved)    |
| `data.cancelPrice`   | object   | Optional (reserved)    |

## Cancellation Rules Enforced by Backend

* Connection code must belong to current partner
* Booking must exist
* Booking must belong to current partner
* Booking status must be `success` before cancel
* Cancel is rejected on/after check-in date
* Booking must be refundable according to stored cancellation policy

## Common Errors

* `400 bookingReference is required for cancellation`
* `400 Booking cannot be cancelled. Current status: ...`
* `400 This booking can no longer be cancelled after the check-in date`
* `400 Cancellation policy not found for this booking`
* `400 This booking is not refundable according to the cancellation policy`
* `403 Invalid connection code.`
* `403 This booking does not belong to the current partner`
* `404 Booking not found with bookingReference: ...`
