Search for flights by creating offer requests.
An offer request describes the passengers and journeys (slices) you
want to search for; Duffel responds with offers from airlines.
See the Duffel documentation.
Summary
Functions
Creates an offer request and kicks off a flight search.
Retrieves a single offer request by ID.
Lists one page of offer requests.
Lazily streams all offer requests across pages.
Functions
@spec create(Duffel.Client.t(), map(), keyword()) :: {:ok, map()} | {:error, Duffel.Error.t()}
Creates an offer request and kicks off a flight search.
Build the params by hand or with Duffel.OfferRequests.SearchParams.
Options
:params- query string parameters, e.g.params: [return_offers: false, supplier_timeout: 10_000].return_offers: falseleaves the offers out of the response, to be listed withDuffel.Offers.list/2;supplier_timeoutis how long in milliseconds to wait for each airline, 2_000..60_000 (default 20_000);view: "itineraries"returns the grouped shape described inget/3
Examples
alias Duffel.OfferRequests.SearchParams
params =
SearchParams.new(
slices: [SearchParams.slice("LHR", "JFK", "2026-07-01")],
passengers: [SearchParams.passenger(type: "adult")],
cabin_class: "economy"
)
Duffel.OfferRequests.create(client, params)
@spec get(Duffel.Client.t(), String.t(), keyword()) :: {:ok, map()} | {:error, Duffel.Error.t()}
Retrieves a single offer request by ID.
Options
:params- query string parameters.view: "itineraries"groups the offers into slices, itineraries and brands with shared airlines, places and aircraft in top-level reference maps, instead of the flat list of offersview: "offers"(the default) returns
Examples
Duffel.OfferRequests.get(client, "orq_123", params: [view: "itineraries"])Decode that shape with Duffel.Schema.ItineraryView.from_map/1.
@spec list(Duffel.Client.t(), keyword() | map()) :: {:ok, Duffel.Page.t()} | {:error, Duffel.Error.t()}
Lists one page of offer requests.
Parameters
:limit- results per page, 1..200 (default 50):after/:before- pagination cursors (seeDuffel.Page)
@spec stream(Duffel.Client.t(), keyword() | map()) :: Enumerable.t()
Lazily streams all offer requests across pages.
Raises Duffel.Error if a page request fails.
Examples
client |> Duffel.OfferRequests.stream() |> Enum.take(100)