Duffel API Multi-Step Search

Number of APIs: 4

A walkthrough on how to go from nothing to your first booking using the Duffel API.

In order to follow this guide, you'll need to:

* Sign up for a Duffel Account (it takes about 1 minute!) * Create a test token from the Access Tokens page in your Dashboard and paste it in the Authorization section of the Qodex Collection (Don't forget to hit save afterwards)

Overview

Multi-step search allows integrators to easily implement a flow that involves a traveller selecting one slice of their flight at a time as they build their whole flight itinerary. This enhances the search experience as the whole flow feels faster and intuitive.

There will be significantly fewer offers returned overall, and at each stage. As an integrator with Duffel, this would simplify your job to process and display these offers and will aid the traveller in making a selection from the offers presented to them.

How does the flow work?

The entire flow takes 4 steps:

  1. Outbound search: You pass the origin and destination slices and passengers and get back a list of partial offers for the outbound slice of your journey by creating a partial offer request. A partial offer is an offer that can’t be booked directly but can be passed to the next endpoint: show partial offer request. A partial offer contains only one slice, even if the search is for multiple slices. At the end of the flow (at fare selection), you pass in the partial offers for each of the slices in your journey to obtain a full offer that you can book.
  2. Inbound search: You pass in the offer from the previous outbound search into the endpoint for the inbound search. This will be through the partial offer request show endpoint. You’ll get back partial offers for the next slice of your journey.
  3. Fare selection: You pass in the chosen partial offers obtained from the outbound and inbound search, to obtain a list of full offers. This will be through the fares endpoint.
  4. Create order: Finally you make a booking by passing in the full offer ID obtained at fare selection while creating an order.

NOTE: By running the requests in the sequence mentioned above, you'll get most fields automatically pre-filled for you.

  1. Outbound Search POST https://api.duffel.com/air/partial_offer_requests

  2. Inbound Search GET https://api.duffel.com/air/partial_offer_requests/{{OUTBOUND_OFFER_REQUEST_ID}}?selected_partial_offer[]={{OUTBOUND_OFFER_ID}}

  3. Select Fares GET https://api.duffel.com/air/partial_offer_requests/{{OUTBOUND_OFFER_REQUEST_ID}}/fares?selected_partial_offer[]={{OUTBOUND_OFFER_ID}}&selected_partial_offer[]={{INBOUND_OFFER_ID}}

  4. Creating a booking using the selected offer POST https://api.duffel.com/air/orders