When you search for flights with Duffel by creating an offer request, by default we'll return all of the results (what we call "offers") in one response.
This can mean a lot of data - there could be as many as 10,000 offers for a single search, and this number is growing as we add more airlines.
If you'd prefer to handle offers in small batches, you'll need to use the API in a slightly different way:
- When you hit the "Create an offer request" API, set the `return_offers` querystring parameter to `true`.
- Take the `id` of the Offer Request you created from the response. The response you get back will not include any offers.
- Fetch the first "page" of offers using the "List offers" API, setting the `offer_request_id` querystring parameter to the `id` you get in step 2.
By default, we'll return 50 offers per page, but you can customise this with the `limit` querystring parameter, getting up to 200 offers per page.
You can choose how the offers are sorted using the `sort` querystring parameter. - If you only want the first page of results, you can stop here. But if you want to go beyond the first "page" of results and see all of your offers, you can make more requests to the "List offers" API using the `after` querystring parameter. You can learn more about how pagination works in the Duffel API here.