# Confirm the cancellation of an order

> Confirm the cancellation you quoted with cancel_quote: the Duffel order is cancelled at the airline and the refund is credited to your FX-Port balance.

Endpoint: `POST /flights/confirm_cancel`

Source: https://fx-port.com/docs/api/confirm-cancel

`POST /api/v1/flights/confirm_cancel`

Requires an API key with **Read+Write** permission: a Read key is refused with `read_write_permission_required`.

**This cannot be undone.**

Show the amount of `cancel_quote` to your customer before you call this endpoint, and call it once: a second call answers `already_cancelled`. Send `cancellation_id` (the `ore_...` id of the quote) **and** `order_id` (or `booking_id` or `pnr`): the order id makes FX-Port check that the booking is yours and update the booking and the balance, so a call without it is `400 missing_field` and nothing is cancelled. An unknown order and the order of another agency answer the same `404 booking_not_found`. **Read `success`**: a refusal of the supplier is HTTP `200` with `success: false`.

## Request

### Body

Required, JSON.

- `cancellation_id` (string, required): The `ore_...` id of `cancel_quote` (`cancellation.cancellationId`).
- `order_id` (string, optional): The supplier's order id of the booking (`booking_id` and `pnr` are accepted as other names). **Required**: it makes FX-Port check that the booking is yours and update it.
- `booking_id` (string, optional): Another name of `order_id`.
- `pnr` (string, optional): Another name of `order_id`.
- `supplier_id` (string, optional): Default `duffel_1`.
- `agency_id` (string, optional): Not needed: the agency of a call is always the one of your API key. The field is accepted so that older clients keep working, and it is ignored.
- `cancellationId` (string, deprecated, optional): Legacy name: use `cancellation_id`. The previous spelling of `cancellation_id`: The `ore_...` id of `cancel_quote` (`cancellation.cancellationId`).
- `orderId` (string, deprecated, optional): Legacy name: use `order_id`. The previous spelling of `order_id`: The supplier's order id of the booking (`booking_id` and `pnr` are accepted as other names).
- `bookingId` (string, deprecated, optional): Legacy name: use `booking_id`. The previous spelling of `booking_id`: Another name of `order_id`.
- `supplierId` (string, deprecated, optional): Legacy name: use `supplier_id`. The previous spelling of `supplier_id`: Default `duffel_1`.
- `agencyId` (string, deprecated, optional): Legacy name: use `agency_id`. The previous spelling of `agency_id`: Not needed: the agency of a call is always the one of your API key.

### Example request

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

## Response

### 200: The order is cancelled and the refund is on its way to your balance. `success: false` with `error` when the supplier refuses.

- `environment` (string): The environment of the key that made the call: `sandbox` for fxp_test_ keys, `live` for fxp_live_ keys. Present in every JSON body. One of `sandbox`, `live`.
- `request_id` (string): The id of the request, also in the `X-Request-Id` header.
- `warnings` (array of object): Present only when the request used a previous spelling of a field or something the endpoint ignored.
  - `code` (string): What the warning is about. One of `deprecated_field`, `ignored_field`, `coerced_value`, `deprecated_value`, `deprecated_endpoint`.
  - `field` (string): The request field the warning is about.
  - `replacement` (string): The name to use instead, for `deprecated_*` warnings.
  - `message` (string): A sentence that says what happened and what to do.
  - `documentation_url` (string): Where the naming rules are explained.
- `success` (boolean): `true` when the cancellation was confirmed.
- `requestId` (string, deprecated): Legacy name: use `request_id`. The id of this request, 8 characters, for support.
- `orderId` (string, deprecated): Legacy name: use `order_id`. The supplier's order id.
- `order_id` (string): The supplier's order id. The snake_case twin of `orderId`, with the same value: use this name.
- `cancellationId` (string): Only when `success` is `false`: the cancellation you tried to confirm.
- `processingTime` (number, deprecated): Legacy name: use `processing_time`. Seconds spent.
- `processing_time` (number): Seconds spent. The snake_case twin of `processingTime`, with the same value: use this name.
- `confirmation` (object): A cancellation of an issued Duffel order.
  - `cancellationId` (string, deprecated): Legacy name: use `cancellation_id`. The `ore_...` id of the cancellation. Send it to `confirm_cancel`.
  - `cancellation_id` (string): The `ore_...` id of the cancellation. Send it to `confirm_cancel`. The snake_case twin of `cancellationId`, with the same value: use this name.
  - `orderId` (string, deprecated): Legacy name: use `order_id`. The supplier's order id.
  - `order_id` (string): The supplier's order id. The snake_case twin of `orderId`, with the same value: use this name.
  - `status` (string): `pending` for a quote, `confirmed` once confirmed.
  - `refund` (object): The refund of a cancellation.
    - `originalRefundCurrency` (string): Currency of the airline's refund.
    - `originalRefundAmount` (number): The airline's refund, in its currency.
    - `refundCurrency` (string): Currency of your balance.
    - `refundAmount` (number): What is credited to your balance.
    - `refundTo` (string): Where the refund goes: `FX-Port Balance`.
    - `refundToRaw` (string): `balance`.
    - `convertedSupplierRefundAmount` (number): The airline's refund converted to your currency.
    - `isFullBalanceRefund` (boolean): Whether the whole payment is refunded.
    - `kioskCommissionRefund` (number): Commission taken back.
  - `expiresAt` (string): A quote is valid until this moment (one hour).
  - `confirmedAt` (string, nullable): When it was confirmed.
  - `createdAt` (string): When the quote was created.
  - `airlineCredits` (object, nullable): Credits the airline issues instead of a refund.
  - `liveMode` (boolean): `false` in the sandbox.
  - `message` (string): A sentence about the result (`confirm_cancel`).
- `supplier` (object): The supplier of the order.
  - `id` (string, deprecated): Legacy name: use `supplier_id`. Id of the supplier.
  - `supplier_id` (string): Id of the supplier. The snake_case twin of `id`, with the same value: use this name.
  - `technology` (string): The technology of the supplier: `amadeus_aqc` or `duffel`.
  - `name` (string, deprecated): Legacy name: use `supplier_name`. Name of the supplier.
  - `supplier_name` (string): Name of the supplier. The snake_case twin of `name`, with the same value: use this name.
  - `offerId` (string, nullable, deprecated): Legacy name: use `supplier_offer_id`. The supplier's own id of the offer.
  - `supplier_offer_id` (string, nullable): The supplier's own id of the offer. The snake_case twin of `offerId`, with the same value: use this name.
- `agency` (object): Your agency. The id of the agency is not returned: you know it.
  - `currency` (string): ISO 4217 currency of your agency. Every amount of the response is in it.
- `exchangeRate` (object, deprecated): Legacy name: use `exchange_rate`. The exchange rate used for the refund.
  - `rate` (number): Units of the target currency for one unit of the source currency.
  - `marginPercent` (number): The margin included in the rate.
  - `fromCurrency` (string): Supplier currency.
  - `toCurrency` (string): Your currency.
- `exchange_rate` (object): . The snake_case twin of `exchangeRate`, with the same value: use this name.
  - `rate` (number): Units of the target currency for one unit of the source currency.
  - `marginPercent` (number): The margin included in the rate.
  - `fromCurrency` (string): Supplier currency.
  - `toCurrency` (string): Your currency.
- `meta` (object): `cancellationConfirmedAt` and `refundProcessing`.
- `postProcessing` (object): What FX-Port did after the supplier call.
  - `bookingDbId` (string): The FX-Port id of the booking (a UUID). **The best key to store**: it is accepted as `booking_id` by `get_booking`.
  - `bucketLink` (string, nullable): Address of the PDF of the ticket, `null` until it is generated. A public link.
  - `emailSent` (boolean): Whether the confirmation e-mail went out.
  - `bookingStatusUpdated` (boolean): `cancel_order`: whether the FX-Port booking was updated.
  - `refundMethod` (string): `confirm_cancel`: where the refund went: `balance`.
- `error` (object): Only when `success` is `false`: the refusal of the supplier for `confirm_cancel`.
  - `message` (string): The supplier's message.
  - `code` (string): The supplier's code: a number as text for Amadeus (`4926`), a name for Duffel (`order_not_cancellable`).
  - `type` (string): The supplier's error type.
  - `details` (array of object): The supplier's details, in its own format.
  - `userMessage` (string): A sentence the supplier wrote for the traveler, when there is one.
- `errors` (array of object): Only when `success` is `false`: the unified error list. `errors[0].code` is the supplier's code in lower case and `errors[0].type` is `supplier_error`.
  - `code` (string): Stable, machine-readable code in snake_case. Branch on this, never on the message.
  - `type` (string): The family of the error: tells you how to react. One of `authentication_error`, `permission_error`, `validation_error`, `not_found`, `conflict`, `payment_error`, `rate_limit_error`, `supplier_error`, `internal_error`.
  - `title` (string): A short label of the error.
  - `message` (string): A sentence for a human: what is wrong and how to fix it. Wording can change; the code does not.
  - `field` (string, nullable): The request field the error is about, when there is one.
  - `details` (object, nullable): Structured extras of the error (for example `available` and `required` for an insufficient balance).
  - `documentation_url` (string): The documentation of this error code.

```json
{
  "environment": "sandbox",
  "success": true,
  "requestId": "64666d3c",
  "orderId": "ord_0000BC0VDONwA54LrfoCkm",
  "processingTime": 0.245,
  "confirmation": {
    "cancellationId": "ore_0000BC0VG9WBaFAZ83u3yy",
    "orderId": "ord_0000BC0VDONwA54LrfoCkm",
    "status": "confirmed",
    "refund": {
      "originalRefundCurrency": "USD",
      "originalRefundAmount": 76.86,
      "refundCurrency": "DZD",
      "refundAmount": 19215,
      "refundTo": "FX-Port Balance",
      "refundToRaw": "balance",
      "convertedSupplierRefundAmount": 19215,
      "isFullBalanceRefund": false,
      "kioskCommissionRefund": 0
    },
    "confirmedAt": "2026-11-01T14:30:04.851325Z",
    "createdAt": "2026-11-01T14:28:32.488592Z",
    "airlineCredits": null,
    "liveMode": false,
    "message": "Order cancellation confirmed. Refund will be processed."
  },
  "supplier": {
    "id": "duffel_1",
    "technology": "duffel",
    "name": "Duffel"
  },
  "agency": {
    "currency": "DZD"
  },
  "exchangeRate": {
    "rate": 250,
    "marginPercent": 0,
    "fromCurrency": "USD",
    "toCurrency": "DZD"
  },
  "meta": {
    "cancellationConfirmedAt": "2026-11-01T14:30:04.851325Z",
    "refundProcessing": {
      "method": "FX-Port Balance",
      "estimatedDays": "Immediate",
      "description": "Refund credited to your FX-Port balance"
    }
  },
  "postProcessing": {
    "refundMethod": "balance",
    "emailSent": false
  }
}
```

## Errors

| Status | Code | Example message |
| --- | --- | --- |
| 400 | `bad_request` | Missing required parameter: cancellation_id |
| 400 | `missing_field` | `order_id` (or `booking_id` / `pnr`) is required together with `cancellation_id`. |
| 400 | `invalid_cancellation_id` | `cancellation_id` is not a valid identifier (letters, digits and - _ . : = ~ only, up to 128 characters). |
| 403 | `read_write_permission_required` | This endpoint requires an API key with read_write permission. |
| 404 | `booking_not_found` | No booking found for 'ZZZZZZ' |

See [Errors](https://fx-port.com/docs/errors.md) for every code and how to react.

## Related guides

- [Confirm a cancellation](https://fx-port.com/docs/flights/confirm-cancel.md)
- [Quote a cancellation](https://fx-port.com/docs/flights/cancel-quote.md)
- [Post-booking operations](https://fx-port.com/docs/flights/post-booking.md)
