# Open-jaw and multi-city searches

> Search open-jaw trips and multi-city itineraries of three to six flights with the segments array.

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

Send `segments` instead of `origin`, `destination`, `departure_date` and `return_date` when the trip is not a plain one-way or return: an **open-jaw** (you fly back from another airport) or a **multi-city** trip (three or more flights). The search type comes from the segments you send.

| Segments | Rule | `searchType` |
|---|---|---|
| 1 | A single flight | `ONE_WAY` |
| 2 | The second is the exact reverse of the first | `ROUND_TRIP` |
| 2 | The second is **not** the reverse of the first | `OPEN_JAW` |
| 3 to 6 | Any sequence of flights | `MULTI_CITY` |

Each segment needs:

| Field | Description |
|---|---|
| `origin` | Departure IATA code (three letters) |
| `destination` | Arrival IATA code; must differ from `origin` |
| `departure_date` | Local departure date, `YYYY-MM-DD`. The dates must not go backwards: each is on or after the one before. Legacy names: `date`, `departureDate`, `departure` |

The same limits as a plain search apply to each date (from yesterday up to 365 days ahead).


> [!WARNING]
> **Multi-city is supported by Duffel only.** Amadeus Algeria does not search three or more segments: it fails and appears in `failures[]` (`"cause": "supplier_error"`), while Duffel answers. Send `"supplier_id": "duffel_1"` to skip the failing call. Open-jaw and round-trip searches work on both suppliers.


## Open-jaw

The outbound arrives at one airport; the return leaves from another.


**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 '{
  "segments": [
    {
      "origin": "ALG",
      "destination": "CDG",
      "departure_date": "2026-12-15"
    },
    {
      "origin": "ORY",
      "destination": "ALG",
      "departure_date": "2026-12-22"
    }
  ],
  "cabin_class": "economy",
  "passengers": {
    "adults": 1
  }
}'
```


FX-Port recognises an open-jaw because the second segment is not the reverse of the first. Both sandbox suppliers answered (129 offers from Amadeus Algeria and 196 from Duffel in our test).

### Response example

`searchType` is `"OPEN_JAW"` and each offer has one `itinerary` entry per direction. The second entry departs from `ORY`, not from `CDG`: that is the open-jaw. The example is the Duffel offer, trimmed to the airports:

~~~json
{
  "success": true,
  "searchType": "OPEN_JAW",
  "suppliers": [
    {
      "success": true,
      "results": {
        "totalOffers": 196,
        "offers": [
          {
            "itinerary": [
              { "direction": "outbound", "segments": [{ "departure": { "airportCode": "ALG" }, "arrival": { "airportCode": "CDG" } }] },
              { "direction": "return", "segments": [{ "departure": { "airportCode": "ORY" }, "arrival": { "airportCode": "ALG" } }] }
            ]
          }
        ]
      }
    }
  ]
}
~~~

## Multi-city

Three or more flights, in order:


**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 '{
  "segments": [
    {
      "origin": "ALG",
      "destination": "CDG",
      "departure_date": "2026-12-15"
    },
    {
      "origin": "CDG",
      "destination": "MAD",
      "departure_date": "2026-12-18"
    },
    {
      "origin": "MAD",
      "destination": "ALG",
      "departure_date": "2026-12-22"
    }
  ],
  "cabin_class": "economy",
  "passengers": {
    "adults": 1
  },
  "supplier_id": "duffel_1"
}'
```


`searchType` is `"MULTI_CITY"`. Duffel returned 568 offers in a 4.6 MB response (80 KB with `Accept-Encoding: gzip`). The legs of an offer are named **`outbound`**, **`return`** and then **`segment_3`**, `segment_4` ...: the second leg of a multi-city offer is called `return` even though it is not a return, so use the **order** of `itinerary`, not the name, to follow the trip:

~~~json
{
  "itinerary": [
    { "direction": "outbound", "duration": "PT2H24M", "stops": 0, "segments": [{ "departure": { "airportCode": "ALG" }, "arrival": { "airportCode": "CDG" } }] },
    { "direction": "return", "duration": "PT1H59M", "stops": 0, "segments": [{ "departure": { "airportCode": "CDG" }, "arrival": { "airportCode": "MAD" } }] },
    { "direction": "segment_3", "duration": "PT1H32M", "stops": 0, "segments": [{ "departure": { "airportCode": "MAD" }, "arrival": { "airportCode": "ALG" } }] }
  ]
}
~~~

An offer is one fare for the whole trip: price it and book it as a whole.

## Notes

- A search with `segments` ignores `origin`, `destination`, `departure_date` and `return_date`.
- Each selected supplier receives every segment.
- To fly two separate one-way trips at two different fares, make two searches.

## Related

- [Search flights](https://fx-port.com/docs/flights/search.md) and [Basic routes](https://fx-port.com/docs/flights/search/basic-routes.md).
- [Supplier selection](https://fx-port.com/docs/flights/search/suppliers.md).
