# Quote a cancellation

> Ask what cancelling an issued Duffel order would refund. Nothing is cancelled until you confirm it.

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

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

Ask what cancelling an **issued Duffel order** would refund. The call creates a **pending cancellation** at the supplier with the refund amount; nothing is cancelled and no money moves until you confirm it with [`confirm_cancel`](https://fx-port.com/docs/flights/confirm-cancel.md).

**Permission:** Read. **Rate group:** default (6,000 requests per minute per key). Only **Duffel** orders: an order of another supplier is answered `400`.


> [!CAUTION]
> **Only the confirmation cancels.** A quote is valid for one hour (`cancellation.expiresAt`). The amount is the supplier's offer **for that moment**: ask again if you wait. Whether an order can be cancelled at all depends on the airline and the fare: many fares answer `order_not_cancellable`.


This is the self-serve refund path of Duffel orders. Held reservations are cancelled with [`cancel_order`](https://fx-port.com/docs/flights/cancel-order.md); void, exchange and refund of Amadeus Algeria tickets are manual: see [Post-booking operations](https://fx-port.com/docs/flights/post-booking.md).

## Request body

| Field | Type | Required | Description |
|---|---|---|---|
| `order_id` | string | Yes | The **supplier's order id** of the booking (`ord_...`, the `booking.reference` of the booking response, `amadeus_id` in `get_booking`). `booking_id` and `pnr` are accepted as other names of the same field (the first one present wins): FX-Port finds the booking of your agency and sends the supplier's own order id to Duffel, so a PNR works too. Prefer the order id: a PNR is not unique. |
| `supplier_id` | string | No | Default `duffel_1`. A value that does not start with `duffel` is `400`. |

Legacy names: `orderId`, `bookingId`, `supplierId`. If `order_id`, `booking_id` and `pnr` hold different values, the first one wins and an `ignored_field` warning names the others. Only bookings of your agency in the environment of your key can be quoted: an unknown order and the order of another agency are both `404 booking_not_found`, before the supplier is asked.

## Request example


**Request**

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


## Response example

A refundable Duffel order (real response of 2026-11-01). The airline refunds USD 76.86, FX-Port credits DZD 19,215.00 to the balance of the agency:

~~~json
{
  "environment": "sandbox",
  "success": true,
  "requestId": "2cb63f69",
  "orderId": "ord_0000BC0VDONwA54LrfoCkm",
  "processingTime": 0.128,
  "cancellation": {
    "cancellationId": "ore_0000BC0VG9WBaFAZ83u3yy",
    "orderId": "ord_0000BC0VDONwA54LrfoCkm",
    "status": "pending",
    "refund": {
      "originalRefundCurrency": "USD",
      "originalRefundAmount": 76.86,
      "refundCurrency": "DZD",
      "refundAmount": 19215.0,
      "refundTo": "FX-Port Balance",
      "refundToRaw": "balance",
      "convertedSupplierRefundAmount": 19215.0,
      "isFullBalanceRefund": false,
      "kioskCommissionRefund": 0.0
    },
    "expiresAt": "2026-11-01T15:28:32Z",
    "confirmedAt": null,
    "createdAt": "2026-11-01T14:28:32.488592Z",
    "airlineCredits": null,
    "liveMode": false
  },
  "supplier": { "id": "duffel_1", "technology": "duffel", "name": "Duffel" },
  "agency": { "currency": "DZD" },
  "exchangeRate": { "rate": 250.0, "marginPercent": 0.0, "fromCurrency": "USD", "toCurrency": "DZD" },
  "meta": { "quoteValidUntil": "2026-11-01T15:28:32Z", "isConfirmed": false, "canConfirm": true }
}
~~~

## Field meanings

| Field | Meaning |
|---|---|
| `cancellation.cancellationId` | `ore_...`: the id to send to `confirm_cancel` (twin: `cancellation_id`). |
| `cancellation.status` | `pending` until confirmed. |
| `cancellation.refund.refundAmount`, `refundCurrency` | What your balance receives, in the agency currency. |
| `cancellation.refund.originalRefundAmount`, `originalRefundCurrency` | The airline's amount in the supplier's currency. |
| `cancellation.refund.refundTo`, `refundToRaw` | `FX-Port Balance` and `balance`: the refund goes to your FX-Port balance. |
| `cancellation.refund.isFullBalanceRefund` | Whether the refund covers the whole price. |
| `cancellation.refund.kioskCommissionRefund` | A commission refund, when there is one. |
| `cancellation.expiresAt`, `meta.quoteValidUntil` | The end of the validity of the quote, in UTC. |
| `cancellation.airlineCredits` | An airline credit instead of money, when the airline offers one; `null` otherwise. |
| `meta.canConfirm` | `true` when `confirm_cancel` will be accepted. |
| `exchangeRate` | The rate between the supplier's currency and yours, as an **object**. |

## Errors

The supplier's refusals are `200` answers with `success: false` (read `success`): `errors[0].type` is `supplier_error`.

| Where | `error.code` | Meaning |
|---|---|---|
| `200`, `success: false` | `order_not_cancellable` | "This order cannot be cancelled through the API." The airline or the fare does not allow it; use [Post-booking operations](https://fx-port.com/docs/flights/post-booking.md). |
| `200`, `success: false` | `already_cancelled` | The order was cancelled before. |
| `200`, `success: false` | `not_found` | FX-Port knows the booking but Duffel does not know the order. |
| `400` | `bad_request` | None of `order_id`, `booking_id` and `pnr` was sent (`Missing required parameter: order_id`), or the supplier is not Duffel. |
| `400` | `invalid_booking_id`, `invalid_supplier_selection` | An id or the `supplier_id` is not a valid token. |
| `404` | `booking_not_found` | No booking of your agency in this environment has this reference. An unknown order and the order of another agency are answered the same. |

## Related

- [Confirm cancel](https://fx-port.com/docs/flights/confirm-cancel.md) (the next step) and [Post-booking operations](https://fx-port.com/docs/flights/post-booking.md).
- [Get a flight booking](https://fx-port.com/docs/flights/get-booking.md): after the confirmation the status is `partial_refund`.
