> ## Documentation Index
> Fetch the complete documentation index at: https://developers.ttool.travel/llms.txt
> Use this file to discover all available pages before exploring further.

# Round trips

> Handle the combined, packed and split round-trip shapes.

A round-trip search sends exactly two segments: the outbound first, then the return with origin and destination swapped.

```json theme={null}
{
  "adults": 1,
  "cabinType": "Economy",
  "flightType": "RoundTrip",
  "segments": [
    { "origin": "BGW", "destination": "DXB", "departureDate": "2026-12-07" },
    { "origin": "DXB", "destination": "BGW", "departureDate": "2026-12-14" }
  ]
}
```

Results come back in one of two shapes. Your code has to handle both. Branch on `returningRequestId`: if it's set and `returningOffers` isn't empty, you have a split result.

**Combined (most routes)**

`offers` holds complete round-trip offers with `tripType = RoundTrip` and two entries in `journeys`: outbound, then inbound. `returningRequestId` is `null` and `returningOffers` is empty.

[Create the order](https://developers.ttool.travel/api-reference/book.md) with one offer:

```json theme={null}
{ "requestId": "{requestId}", "flightProposalId": "{offer.offerId}" }
```

Some combined offers are **packed** from two one-way fares. After a [details](https://developers.ttool.travel/api-reference/details.md) call they also carry `leavingOfferId` and `returningOfferId`. You can create the order for a packed offer with its own `offerId` or with the two halves.

**Split (departing Iran)**

The outbound and return legs are searched separately. `offers` holds one-way outbound offers, `returningOffers` holds one-way return offers, and `returningRequestId` identifies the return search.

Let the customer pick one from each list, then create the order with all four ids:

```json theme={null}
{
  "leavingRequestId": "{requestId}",
  "leavingFlightProposalId": "{outbound offerId}",
  "returningRequestId": "{returningRequestId}",
  "returningFlightProposalId": "{return offerId}"
}
```

For [details](https://developers.ttool.travel/api-reference/details.md), pass `returningRequestId` and `returningProposalId` together with the outbound pair.

> [!WARNING]
>
> Sending both offer shapes to create order, or only part of one, is a validation error.

## Detecting the shape

```javascript theme={null}
const result = await search(request);
const split = result.returningRequestId && (result.returningOffers ?? []).length > 0;

if (split) {
  renderTwoLists(result.offers, result.returningOffers, result.dictionaries);
} else {
  renderCombined(result.offers, result.dictionaries);
}
```

An empty `offers` array with HTTP 200 means no availability. It isn't an error.


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.