● Travel Never Stops. Neither Do We. 365 Days a Year.

Flight Search API Integration for Multi-City Journeys

Map requested journey legs to flight offers without confusing search slices, connecting segments and separate tickets.

Travel consultant and customer map a multi-city journey on a desk map

Multi-city flight search becomes difficult when an application treats every flight in a response as another journey leg. A traveler may request three journeys, yet the returned itinerary can contain five operating flights, a change of aircraft, and a final arrival on a different calendar date. Without a clear mapping, the interface may show the wrong route, omit a requested departure, or suggest that separately purchased tickets form one protected trip.

A dependable flight search api integration starts by separating traveler intent from supplier inventory. Requested legs describe what the traveler wants to accomplish. Search slices communicate that intent to an API. Offer slices describe what a particular returned offer covers. Segments describe the specific flights within those slices. The distinctions determine which results belong together and whether a selected offer is actually complete.

Start with the journey the traveler requested

Model the trip before creating an API request. Each requested leg needs a stable identifier, an origin, a destination, and an intended local departure date. Preserve the order in which the traveler entered those legs, even when the airports and dates could be rearranged into a more familiar round-trip pattern.

Use requested legs as the source of truth

A requested leg represents an intentional origin-to-destination movement, not necessarily a nonstop flight. For example, a traveler who enters Lisbon to Rome has requested one leg. If the airline returns Lisbon to Madrid followed by Madrid to Rome, the response contains two operating segments that satisfy that one leg.

Keep the requested leg's identifier after results arrive. It should anchor the search form, result headings, selected itinerary, and booking review. Do not recreate those identifiers from array positions alone, since filtering or refreshing results can change how data is displayed.

Preserve open-jaw travel as entered

An open-jaw journey uses different arrival and subsequent departure points, or different starting and final points. A traveler could arrive in Milan, travel independently to Venice, and fly onward from Venice. The gap is a deliberate surface-transfer or independently arranged movement unless the traveler explicitly requests transport for it.

Do not manufacture a Milan-to-Venice flight merely to make adjacent legs appear connected. Equally, do not reject a legitimate open-jaw request because one leg's destination differs from the next leg's origin. Represent the gap visibly, and validate each requested air movement on its own terms.

Understand how search slices become offer slices

In Duffel's offer-request schema, a flight search describes passengers and a list of slices representing where and when they intend to travel. The schema also includes optional criteria such as cabin class. It gives integration teams a concrete example of why request slices should be modeled distinctly from eventual flights.

For multi-city input, prepare the requested slices in their intended order and retain the exact request context. Each slice specifies the relevant origin, destination, and departure date. Passenger information belongs to the search as well; a result priced for one adult is not interchangeable with a result for a different passenger mix.

Search input is not a flight schedule

At request time, the traveler generally has not selected an operating carrier, connection airport, flight number, or precise arrival time. Those details belong to offers returned after the search. Avoid populating your requested-leg record with guessed intermediate airports or treating a preferred connection as a guaranteed part of the result.

Supply the origin and destination at the specificity your interface promises. An airport choice and a city-level choice can imply different acceptable results. Record the original selection and the resolved airport or city identifier, so later matching does not silently broaden or narrow the journey.

An offer describes a purchasable candidate

Duffel's offers schema describes an offer containing slices, with one or more flight segments inside each slice. An offer also contains commercial information, including its identifier, price, currency, and expiry. This hierarchy is the useful mental model: offer → offered slices → operating segments.

That model does not establish universal airline coverage or guarantee a complete multi-city result for every possible route. Search capabilities, returned inventory, and commercial conditions depend on actual provider responses. An integration should handle no-results, partial coverage in its own aggregation layer, and changed offers without inventing missing flights.

Do not confuse a connection with another requested leg

The most frequent mapping error is counting segments as requested legs. A three-leg search can legitimately display more than three flight numbers. Segment count tells you how many operating services are involved; requested-leg count tells you how many origin-to-destination movements the traveler asked the application to cover.

One leg can contain several segments

Imagine a requested leg from Paris to Athens. An offer might show Paris to Vienna and Vienna to Athens. Both operating segments sit under the offered slice representing Paris to Athens. The intermediate airport is a connection point, not a fourth city in the traveler's multi-city input.

Display the slice headline as Paris–Athens, followed by the actual flights and connection details. Calculate the displayed connection using the arrival of the first segment and departure of the next, accounting for local time zones. Validate airport changes and unusually long or short intervals rather than silently calling every sequence a standard connection.

A technical stop has a different meaning

A flight segment may itself have scheduled stops. A stop within one operating service is not necessarily a separate flight segment, a new requested leg, or a traveler-selected destination. Use the returned segment and stop data as supplied, and explain a stop without turning it into an invented change of aircraft.

Map every offered slice to an ordered request

Represent requested legs internally as an ordered collection with explicit identifiers, not a set of city pairs. Repeated routes are possible: a traveler might fly London–Paris twice on different dates. A hash keyed only by origin and destination would overwrite one of those requests and make completeness checks unreliable.

For each offered slice, compare its start, end, and departure context with the corresponding requested leg. Inspect the first and last operating segments as an additional consistency check. Retain the supplier's identifiers alongside your own identifiers, rather than replacing one system's identity with another's.

Keep order, but verify what order means

When integrating a documented response, its slice ordering may provide a useful first association to the ordered request. Still validate that the slice actually matches the expected origin, destination, and departure date. Never accept an apparent positional match that contradicts the route or conceals a missing slice.

Make unmatched and duplicate coverage explicit

Build a mapping record that relates each requested_leg_id to exactly the offered slice that satisfies it for a selected full-itinerary candidate. Record the offered slice's identifier or stable position within its parent offer, its endpoints, and its operating segments. The mapping is application logic, not an assumed provider field.

Flag missing coverage, duplicated associations, reordered results that cannot be reconciled, and routes with unexpected endpoints. A successful HTTP response only proves that a request was processed. It does not prove that your chosen candidate contains every leg the traveler intended to purchase.

Interpret dates in the airports' local time zones

Multi-city searches cross midnight, international date boundaries, and daylight-saving transitions. Store the traveler's requested departure date as a local calendar date associated with the departure location. Do not transform it into a UTC date and then compare the day number as though both represented the same local departure.

Separate a departure date from a timestamp

A requested departure date such as 12 September refers to the calendar date at that leg's origin. A returned flight departure is a specific local date and time, interpreted using the airport's time zone. Those values serve different purposes and need different validation rules.

For a multi-segment slice, assess the requested date against the departure of the first segment, not every connection segment. A connecting flight departing shortly after midnight on 13 September may still belong to a requested leg that began on 12 September. Rejecting it because of that second segment's date would discard a valid itinerary.

Check chronological consistency across legs

Compare actual instants when checking whether one selected leg concludes before the next begins. Local clock readings alone can mislead when countries have different offsets. If one requested leg reaches a city on Tuesday evening, an onward leg departing Tuesday morning in that city cannot form the stated chronological itinerary.

Distinguish impossible overlap from an intentional several-day stay. For open-jaw journeys, allow an unexplained location gap without pretending the system knows how the traveler will cross it. Show calendar dates, local departure and arrival times, and time-zone-aware connection durations wherever they affect a purchase decision.

Worked hypothetical: three requested legs, four operating flights

Consider an entirely fictional itinerary for one adult traveling in economy in September 2027. The traveler requests Lisbon to Rome on 12 September, Rome to Athens on 16 September, and Istanbul to Lisbon on 23 September. The gap between Athens and Istanbul is intentional: the traveler expects to arrange that movement separately.

Assume a search returns a candidate represented as one full offer with three offered slices. The first slice uses a connection through Madrid, while the other two are shown as nonstop. The flight numbers, dates, operating pattern, and commercial structure in this example are illustrative only. They do not describe a live fare or guarantee that a supplier can sell this itinerary.

Illustrative mapping of three requested air legs to slices and operating segments in one hypothetical selected offer
Requested leg Traveler's input Offered slice Operating segments Mapping result
Leg 1 Lisbon (LIS) → Rome (FCO), 12 Sep Slice A: LIS → FCO LIS → MAD; MAD → FCO One leg satisfied by two flights
Leg 2 Rome (FCO) → Athens (ATH), 16 Sep Slice B: FCO → ATH FCO → ATH One leg satisfied by one flight
Leg 3 Istanbul (IST) → Lisbon (LIS), 23 Sep Slice C: IST → LIS IST → LIS One leg satisfied by one flight
Travel analyst arranges three destination cards beside a trip planning sheet

The matching summary is three requested legs, three offered slices, and four operating segments. The interface should retain all three requested-leg labels. Under the first label, it should show the Madrid connection and the actual local timings, including any arrival-date change if present. A simple counter reading “four legs” would be inaccurate.

The Athens-to-Istanbul gap requires separate treatment. It is not part of Slice B or Slice C, and the offer should not be described as covering it. The results screen can mark this as “travel between cities not included” without asserting which train, flight, ferry, or other transport the traveler will use.

Now imagine a second hypothetical result contains only Lisbon–Rome and Rome–Athens, with a lower displayed amount. It is not an alternative full-trip offer. Its price cannot be ranked against the three-slice offer as though both purchase options cover identical travel. Either exclude it from the complete-itinerary list or present it in a clearly labeled separate-ticket planning area.

Finally, suppose a refreshed response changes the first route to LIS–BCN–FCO. The request-to-slice association remains Leg 1 because the intended endpoints and origin departure date still match. Its operating segment list must be replaced with the current two flights; previously cached Madrid details cannot survive merely because the selected leg identifier stayed constant.

Validate completeness before showing a selectable itinerary

An itinerary is complete only when the selected candidate covers all requested air legs under the product's defined acceptance rules. For a conventional full-offer result, confirm the expected count of offered slices, a valid one-to-one mapping to requested legs, acceptable endpoints, and departure dates that respect each request.

Then inspect every slice for at least one operating segment and ensure the segment sequence connects its start to its end. Verify that the first departure and last arrival describe the actual slice journey. Within each slice, consecutive flights need sensible timing and airport transitions; any airport change should be apparent to the traveler.

Make completeness a specific state

Use internal states such as complete, incomplete, mismatch, and needs_review. A blank flight array, missing third slice, or unrecognized endpoint should not inherit a successful state because price and carrier fields exist. Treat unknown values as unknown, not as reassuring defaults.

Refresh the actual offer at selection time

An offer's displayed price and availability can change. Duffel documents an expires_at field and recommends retrieving a single offer for current information before booking; even that retrieval does not guarantee successful booking. Recheck the refreshed slices, segment times, total amount, currency, and applicable conditions rather than refreshing price alone.

If the itinerary changes materially, require the traveler to review the change before proceeding. Preserve the previously selected request context for comparison, but make the current provider response authoritative for what is being offered now. Never substitute an older flight merely to fill a newly missing leg.

Keep separate-ticket planning separate from a single offer

A multi-city interface may support two distinct experiences: searching for an offer covering the entire requested journey, and constructing a plan from independent flight purchases. Both can be useful, but the booking implications differ. A shared results card, total price, or visual timeline cannot by itself establish one ticket or protected connections.

If your application combines separately returned one-way offers, label the construction explicitly. Show each offer's covered leg, price, currency, and purchasing step. Explain that prices and availability may change independently. Do not imply that paying for several flights in one checkout automatically creates a through-ticket or common contractual protection.

Connection protection is not a visual property

Flights displayed consecutively may be separate tickets even if their airport and times appear to connect neatly. Whether a disrupted connection is protected depends on the actual booking and applicable airline terms, not on how a card groups flight details. Avoid badges such as “guaranteed connection” unless a verified, applicable arrangement justifies that specific claim.

Distinct carriers or a single marketing brand do not settle the ticketing question either. Confirm the commercial relationship through the booking flow and authoritative documents. Until then, present factual flight timing and clearly worded uncertainty rather than assurances about baggage transfer, rebooking, or liability.

Keep prices comparable only for equivalent coverage

For a full multi-city offer, display the total supplied for the applicable passengers and note any separately priced additions. For a composite of independent offers, show the component prices and a clearly identified calculated sum. Confirm currency treatment and avoid adding amounts in different currencies without an explicit conversion basis.

Sorting logic must respect coverage. A two-leg result is not a cheaper version of a three-leg result. Similarly, an itinerary excluding the Athens-to-Istanbul gap is not equivalent to an imagined plan that includes that extra movement. Define what is and is not included before presenting a “best price” comparison.

Design a results screen that explains the mapping

A traveler should be able to trace each input row to the matching output row without understanding API vocabulary. Keep headings such as “Leg 1: Lisbon to Rome” and show the date alongside the route. Under the heading, list the real flights in sequence, with connection airports, local times, and any terminal or airport changes known from the response.

Separate the overview from operational detail. A compact overview can display three requested legs, four flights, and the count of connections. Expanded sections can reveal flight numbers, operating airlines where provided, airport codes, elapsed time, and baggage information. Missing details should be marked as unavailable rather than silently invented.

Use unambiguous labels for travel gaps

In an open-jaw itinerary, insert a neutral explanation between the affected legs: “Athens to Istanbul: not included in these flights.” This prevents travelers from assuming a hidden transfer exists. The same principle applies when a route begins at one airport and its next flight leaves from another airport in the same city.

Prevent stale selection across search edits

If the traveler changes the third requested leg from Istanbul–Lisbon to Athens–Lisbon, invalidate any selected candidate associated with the old request. Do not keep the previous total and silently attach it to the new route. Compare request version, passenger mix, cabin, and dates before allowing a stored selection to proceed.

On mobile, preserve the same hierarchy instead of flattening every operating segment into a separate card. Accessibility also matters: use descriptive headings, readable airport names with codes, and explicit text for connections and exclusions. Do not rely exclusively on colored lines or route icons to communicate which flights belong together.

Test the awkward cases, not only successful searches

A robust test suite should cover a single nonstop segment, one slice with two connecting segments, and one slice with three or more segments. Include multi-city trips whose routes repeat, whose dates cross month boundaries, and whose connection flights depart after midnight. The implementation must continue associating flights with the correct requested leg.

Test open-jaw gaps separately from connection gaps. One should be an intentional difference between requested legs; the other occurs within the offered segments for a single leg. Create cases with airport-specific input, city-level input where supported, missing slices, extra slices, empty segments, and segments that do not form a continuous route.

Use negative assertions as well as positive ones

Assertions should verify what the application refuses to do. A missing third leg must not be labeled complete. A five-segment response must not become a five-leg itinerary. A search returning no valid offers must not borrow a flight from a previous search. A combined display must not automatically claim through-ticketing or protected connections.

Include independent-offer test data with different currencies and expiry times. Confirm that a component expiration prompts revalidation of the composite. Simulate price changes after selection, shifts in local departure dates, and replacement of one connecting airport. Validate both machine-readable state and what the user actually sees.

Log evidence without exposing sensitive data

Useful diagnostic records include a correlation identifier, request version, requested-leg identifiers, provider offer identifier, mapping outcome, count of slices, and count of segments. Capture mismatch reasons such as missing_requested_leg or unexpected_endpoint. Keep passenger details and authentication credentials out of routine diagnostic output.

Put a validation boundary before the booking handoff

At the final review stage, show a leg-by-leg summary built from the current selected offer rather than from the original search form alone. The request establishes intent; the refreshed offer establishes the flights currently presented for purchase. Differences should be visible before the traveler commits.

Validate the passenger set, offer expiry, mapped slice coverage, airport endpoints, dates, segment continuity, prices, currency, and applicable terms. Where additional services or baggage information are available, tie them to the correct passenger and flight or slice instead of displaying a generic entitlement that might not apply throughout the itinerary.

If a requirement cannot be confirmed, stop the normal purchase path or ask for an explicit review as appropriate. A booking error after payment is more costly to resolve than a clear pre-purchase warning. Maintain a traceable record of which refreshed offer and mapping supported the final displayed itinerary.

For travel platforms built with TravelTech365, this separation provides a practical specification for engineering, QA, and interface design: preserve requested legs, interpret offer slices, expand operating segments, validate completeness, and communicate ticketing boundaries accurately. It supports a more dependable multi-city search experience without claiming coverage, ticket protection, or airline capabilities that the live response has not established.