# Cancel a held booking

> Cancel a held (unpaid) flight reservation to release the PNR. This is not a refund.

Endpoint: `POST /api/v1/flights/cancel_order`

Source: https://fx-port.com/docs/flights/cancel-order

Cancel a **held (unpaid)** reservation. The reservation is deleted at the supplier and the **PNR is released**.

**Permission:** Read+Write. **Rate group:** booking (1,200 requests per minute per key).


> [!CAUTION]
> **This is not a refund and it does not apply to issued (paid) tickets.** A held reservation was never paid, so nothing is refunded: the reservation is deleted and the PNR released. To get money back for an issued **Duffel** order use [Cancel quote](https://fx-port.com/docs/flights/cancel-quote.md) and [Confirm cancel](https://fx-port.com/docs/flights/confirm-cancel.md); void, exchange or refund of an issued **Amadeus Algeria** ticket is manual: see [Post-booking operations](https://fx-port.com/docs/flights/post-booking.md).


## Why cancel a hold

If you create a hold and abandon it, the airline can **refuse a new booking for the same passenger** on the same route while the old reservation is pending. Cancel the old hold to release the PNR before you book that passenger again.

## Identifying the order

| Field | Description |
|---|---|
| `order_id` | The supplier's order id returned when the hold was created (`booking.reference`). **Preferred.** |
| `booking_id` | The PNR of the booking. |
| `pnr` | The airline record locator. |

Send one: the first one present wins, in this order, and another one that holds a different value is dropped with an `ignored_field` warning. PNRs are not unique across suppliers: prefer `order_id`. Legacy names: `orderId`, `bookingId`.

## Conditions

The call is refused unless **all** of these hold:

- the booking belongs to your agency (another agency's booking is answered like an unknown one);
- the supplier is Amadeus Algeria or Travelport (a Duffel order is answered with `400`: Duffel has no holds);
- the booking status is `awaiting_payment` (a `confirmed` or already `cancelled` booking is `409 invalid_booking_status`).

## Request example


**Request**

```bash
curl https://api.fx-port.com/api/v1/flights/cancel_order \
  -H "Authorization: Bearer fxp_test_YOUR_KEY" \
  -H "Content-Type: application/json" \
  -d '{
  "order_id": "eJzTd9ePNA90dHUGAAsuAlA"
}'
```


## Response example

Real response of 2026-11-01 for a hold created two seconds earlier:

~~~json
{
  "environment": "sandbox",
  "success": true,
  "requestId": "11487aa1",
  "orderId": "eJzTd9ePNA90dHUGAAsuAlA",
  "processingTime": 2.147,
  "booking": {
    "reference": "Y7QAEC",
    "status": "cancelled",
    "pnr": "Y7QAEC",
    "type": "hold",
    "createdAt": "2026-11-01T15:26:27.977426+00:00",
    "cancelledAt": "2026-11-01T15:26:30.748257",
    "content": "managed",
    "syncedAt": "2026-11-01T15:26:30.748257",
    "availableActions": [],
    "voidableUntil": null,
    "cancellation": { "type": "void", "deleted": true, "deletedAt": "2026-11-01T15:26:30.748257" }
  },
  "supplier": { "id": "amadeus_aqc_dz_1", "technology": "amadeus_aqc", "name": "Amadeus Algeria", "offerId": null },
  "agency": { "currency": "DZD" },
  "cancellation": {
    "status": "deleted",
    "deleted": true,
    "deletedAt": "2026-11-01T15:26:30.748257",
    "refundAmount": 0,
    "refundCurrency": "DZD",
    "refundTo": null,
    "message": "Reservation deleted successfully."
  },
  "meta": {
    "supportHold": true,
    "supportVoid": true,
    "voidDeadline": "2026-11-01T23:00:00Z",
    "voidWindowEndsAt": null,
    "airlineInitiatedChanges": [],
    "changes": [],
    "users": [],
    "orderMetadata": { "supplierStatusCode": 204, "supplierDeleteErrorIgnored": false, "supplierDeleteErrorCode": 204, "supplierDeleteErrorMessage": null }
  },
  "postProcessing": { "bookingStatusUpdated": true }
}
~~~

## Field meanings

| Field | Meaning |
|---|---|
| `orderId` | The supplier's order id of the booking (twin: `order_id`). |
| `booking.reference` | **The PNR in this endpoint** (in the book and pay responses it is the order id): read `orderId` for the order. |
| `booking.status` | `cancelled` on success. |
| `booking.availableActions` | Empty: nothing more can be done with this order. |
| `booking.cancellation` and `cancellation` | `deleted: true` when the reservation was released at the supplier. |
| `cancellation.refundAmount` | Always `0` here: a hold was never paid. |
| `cancellation.message` | A human-readable outcome, for your logs. |
| `postProcessing.bookingStatusUpdated` | `true` when the FX-Port booking is now `cancelled`. |

Cancelling a hold does not touch your balance: nothing was ever debited. The booking stays readable with `get_booking` (status `cancelled`).

## Errors

| Status | Code | When | What to do |
|---|---|---|---|
| `400` | `bad_request` | None of `order_id`, `booking_id`, `pnr` (`Missing required parameter: order_id (or booking_id / pnr)`). | Send one. |
| `400` | `bad_request` | The booking is not an Amadeus Algeria or Travelport hold (for example a Duffel order). Message: "Delete reservation is currently only supported for Amadeus Algeria and Travelport hold bookings." | For an issued Duffel order see [Cancel quote](https://fx-port.com/docs/flights/cancel-quote.md). |
| `403` | `read_write_permission_required` | A read-only key. | Use a read+write key. |
| `404` | `not_found` | The booking is unknown for your agency and environment: `Booking not found for order_id: <id>`. The booking of another agency is answered the same. | Check the id. |
| `409` | `invalid_booking_status` | The booking is not `awaiting_payment`: it is `confirmed` (paid) or already `cancelled`. | Read it with `get_booking`. |
| `500` | `booking_update_failed` | The reservation was deleted but the FX-Port booking could not be updated. | Read the booking; contact support with the `request_id` if it is still `awaiting_payment`. |

A supplier failure while deleting is answered with the supplier's status and message.

## Related

- [Book a flight](https://fx-port.com/docs/flights/book.md) (hold), [Pay a held booking](https://fx-port.com/docs/flights/pay-order.md) and [Booking flows](https://fx-port.com/docs/flights/booking-flows.md#cancelling).
