# Filter examples

> Direct flights, refundable fares, checked bags, airline include and exclude, and flexible dates.

Source: https://fx-port.com/docs/flights/search/filters

All filters are optional and can be combined. Read the first section before you rely on one: **a filter is a request to the supplier, and the suppliers do not all honour it.** The numbers on this page are a measured search (`ALG` to `CDG`, one adult, 2026-12-15, sandbox, 2026-11-01); the offers of a given day differ, the behaviour does not.

## Filter reference

| Field | Type | What it does |
|---|---|---|
| `nonstop` | boolean | Non-stop offers only. Legacy name: `direct`. |
| `refundable` | boolean | Asks for refundable fares. |
| `checked_bags` | boolean | Asks for fares that include a checked bag. |
| `max_price` | number | A price ceiling. `0`, an empty text or `null` means no ceiling. |
| `included_airlines` | string[] or text | Only these carriers (IATA codes, up to 20; as a text, separated by commas, semicolons, bars or spaces). |
| `excluded_airlines` | string[] or text | Remove these carriers. |
| `preferred_airlines` | string[] or text | Exactly like `included_airlines`. |
| `flexible` | boolean | Add the date matrix from capable suppliers. |

## What is enforced

`suppliers[n].filtersApplied` and `offers[n].filtersApplied` echo **the filters you asked for**, for every supplier. They do not prove that the supplier applied them.

| Filter | Amadeus Algeria | Duffel | Measured |
|---|---|---|---|
| `nonstop` | Enforced | Enforced | 70 to 12 offers and 92 to 31; every offer has `stops: 0` |
| `checked_bags` | Enforced | **Ignored** | Duffel: 92 offers, 24 of them with **no** checked bag |
| `refundable` | Hint: the result is **mixed** | **Ignored** | Amadeus: 54 offers, 44 refundable and 10 not. Duffel: 92 offers, 14 refundable |
| `max_price` | Sent in the supplier's currency, **not enforced in the sandbox** | Never sent | `max_price: 40000`: offers up to 242,844 DZD (Amadeus) and 280,279 DZD (Duffel) were still returned |
| `included_airlines` | Native: the validating airline is in the list | Post-filter: an offer stays when **any** carrier of any segment matches | Duffel with `["AH","AF"]`: 48 offers, 9 of them validated by `TK` or `QR` because `AH` operates a leg |
| `excluded_airlines` | Native | Post-filter | `["AH"]`: no offer is validated by `AH`; 85 and 68 offers |

So: treat `nonstop`, `included_airlines` and `excluded_airlines` as reliable for the **validating airline**, and everything else as a **hint**. When a filter is a hard requirement, check the offers yourself:

- baggage: `travelerPricing[n].fareDetailsBySegment[m].includedCheckedBags.quantity`;
- refundability: `conditions.refundBeforeDeparture.allowed` (indicative);
- price: `pricing.finalPrice` and `pricing.b2bPrice`, in the agency currency;
- carriers: `itinerary[n].segments[m].flight.carrierCode` and `operatingCarrier`.

You can send `included_airlines` and `excluded_airlines` together: FX-Port takes the excluded codes out of the included list and never forwards both lists to a supplier.


> [!NOTE]
> `preferred_airlines` is **not** a ranking. It is an alias of `included_airlines` and restricts the results to the listed carriers (`["AF"]` returned only `AF` offers: 6 and 24). Do not send it with different carriers than `included_airlines`.


## Non-stop only


**Request**

```bash
curl https://api.fx-port.com/api/v1/get_flights \
  -H "Authorization: Bearer fxp_test_YOUR_KEY" \
  -H "Content-Type: application/json" \
  -d '{
  "origin": "ALG",
  "destination": "CDG",
  "departure_date": "2026-12-15",
  "cabin_class": "economy",
  "passengers": {
    "adults": 1
  },
  "nonstop": true
}'
```


Both suppliers honour it, and `filtersApplied` says `"maxStops": 0`. There is no filter for exactly one or two stops: read `itinerary[n].stops`.

## Refundable only


**Request**

```bash
curl https://api.fx-port.com/api/v1/get_flights \
  -H "Authorization: Bearer fxp_test_YOUR_KEY" \
  -H "Content-Type: application/json" \
  -d '{
  "origin": "ALG",
  "destination": "CDG",
  "departure_date": "2026-12-15",
  "cabin_class": "economy",
  "passengers": {
    "adults": 1
  },
  "refundable": true
}'
```

> [!WARNING]
> `refundable: true` is forwarded to the supplier, not applied by FX-Port. Amadeus Algeria narrowed 70 offers to 54 and **kept 10 non-refundable ones**; Duffel ignored the filter. Read `conditions.refundBeforeDeparture.allowed` on each offer, and tell the traveler the fare is "refundable for a fee": the amounts in `conditions` are indicative.


## Checked baggage


**Request**

```bash
curl https://api.fx-port.com/api/v1/get_flights \
  -H "Authorization: Bearer fxp_test_YOUR_KEY" \
  -H "Content-Type: application/json" \
  -d '{
  "origin": "ALG",
  "destination": "CDG",
  "departure_date": "2026-12-15",
  "return_date": "2026-12-22",
  "cabin_class": "economy",
  "passengers": {
    "adults": 1
  },
  "checked_bags": true
}'
```


Amadeus Algeria applies the filter at the supplier. **Duffel ignores it**: with `checked_bags: true` its response had 92 offers and 24 of them had `travelerPricing[n].fareDetailsBySegment[m].includedCheckedBags.quantity` equal to `0`, and `filtersApplied.checkedBagsOnly` still said `true`. Check the quantity on the offers you show.

## Price ceiling

`max_price` is accepted (a positive number; `0`, an empty text and `null` mean no ceiling and the field is ignored, a negative or non-numeric value is `400 invalid_field_type`) and echoed in `filtersApplied.maxPrice`, but **it does not cap the results in the sandbox**. It is passed to Amadeus Algeria in the **supplier's** currency (DZD), not your agency's, and it is never sent to Duffel. Filter on `pricing.finalPrice` (the traveler's price) or `pricing.b2bPrice` (your debit) on your side.

## Include airlines (allow-list)


**Request**

```bash
curl https://api.fx-port.com/api/v1/get_flights \
  -H "Authorization: Bearer fxp_test_YOUR_KEY" \
  -H "Content-Type: application/json" \
  -d '{
  "origin": "ALG",
  "destination": "CDG",
  "departure_date": "2026-12-15",
  "cabin_class": "economy",
  "passengers": {
    "adults": 1
  },
  "included_airlines": [
    "AF",
    "AH"
  ]
}'
```


Amadeus Algeria restricts the search to those carriers: every offer has `validatingAirline[0].code` `AF` or `AH`. Duffel has no carrier filter: FX-Port keeps the offers where **any** marketing, operating or validating carrier of any segment matches, so an offer validated by `TK` or `QR` can come back because `AH` flies one leg of it. The lists also accept a comma separated text (`"AF,AH"`) and up to 20 codes.

## Exclude airlines (block-list)


**Request**

```bash
curl https://api.fx-port.com/api/v1/get_flights \
  -H "Authorization: Bearer fxp_test_YOUR_KEY" \
  -H "Content-Type: application/json" \
  -d '{
  "origin": "ALG",
  "destination": "CDG",
  "departure_date": "2026-12-15",
  "cabin_class": "economy",
  "passengers": {
    "adults": 1
  },
  "excluded_airlines": [
    "IB"
  ]
}'
```


None of the listed carriers is the validating airline of a returned offer. (Amadeus Algeria also never returns `BA`, whatever you send.)

## Flexible dates across all suppliers


**Request**

```bash
curl https://api.fx-port.com/api/v1/get_flights \
  -H "Authorization: Bearer fxp_test_YOUR_KEY" \
  -H "Content-Type: application/json" \
  -d '{
  "origin": "ALG",
  "destination": "CDG",
  "departure_date": "2026-12-15",
  "return_date": "2026-12-22",
  "cabin_class": "economy",
  "passengers": {
    "adults": 1
  },
  "flexible": true
}'
```


Every compatible supplier still returns its regular offers under `results`. Only suppliers with the flexible-dates capability (Amadeus Algeria) add a `flexPrices` key to their entry; Duffel echoes `filtersApplied.flexible: true` and returns **no matrix**. Check that `flexPrices` is there before you read it. See [Flexible-date search](https://fx-port.com/docs/flights/flexible-search.md), and use `POST /flights/flexible_search` when you want the matrix **only**.

## Country hints

`from_cc` and `to_cc` (ISO country codes) and `countries` take part in the choice of suppliers; see [Supplier selection](https://fx-port.com/docs/flights/search/suppliers.md). Send them only if you know why.

## Related

- [Search flights](https://fx-port.com/docs/flights/search.md#filters): the request fields and the offer.
- [Supplier selection](https://fx-port.com/docs/flights/search/suppliers.md).
