Test mode

You'll want to start building your integration in test mode.

Test mode is a "sandbox" which lets you use the Duffel API risk-free, with no danger of spending any money or booking flights you don't want!

You'll need to create a testing access token to use test mode. Head to your dashboard, make sure that you're in "Developer test mode" and create a token. Testing tokens are easy to recognize: they start with duffel_test_.

With a testing access token, you'll only be able to access resources created in test mode. With a live access token, you'll only be able to access resources created in live mode.

While using the Duffel API in test mode, you'll likely be interacting with airlines' sandbox environments. These environments are external to our systems so, unfortunately, we are not able to provide strong guarantees about their behaviour.

For example, an airline's sandbox might be out of action due to maintenance, or flight availability might be "used up" due to other users' bookings.

We want to make sure that you have a great integration experience, from your first requests all the way to production, and Duffel having no control over the airline sandboxes should not affect that. To help with this we have created our own sandbox "airline": Duffel Airways. Making this airline available in test mode means that the Duffel team can provide stronger guarantees around the behaviour as well as the reliability of this particular airline's sandbox, meaning that you can reliably search and book no matter what.

When you search for flights in the test mode, you'll see offers from Duffel Airways. You can identify these offers amongst the other search results by looking at their owner.

The owner is an airline object, and in this case, you'll see that its name will be Duffel Airways and its iata_code will be ZZ.

Starting from a Duffel Airways offer, you can:

  • list available services (that is, extra bags you can buy)
  • fetch a seat map, including free and paid seats
  • create an order for the offer and any services or seats
  • cancel your order for a refund
  • change your order, picking alternative flights

In the test mode, Duffel Airways is much more reliable than other airlines, but this comes with a significant trade-off: you won't see realistic flight schedules or prices.

Searching

To get started with Duffel Airways, you'll need to search for flights by creating an Offer Request. You can use the following request, replacing <YOUR_ACCESS_TOKEN> with your own access token:

curl --compressed "https://api.duffel.com/air/offer_requests" \
-H "Content-Type: application/json" \
-H "Accept-Encoding: gzip" \
-H "Duffel-Version: beta" \
-H "Authorization: Bearer <YOUR_ACCESS_TOKEN>" \
-d '{
"data": {
"cabin_class": "economy",
"slices": [
{
"departure_date": "2021-02-09",
"destination": "JFK",
"origin": "LHR"
}
],
"passengers": [
{
"type": "adult"
}
]
}
}'

For more information on creating offer requests, see 'Create an offer request'.

With the results from a search you will then be able to create orders, see 'Create an order'.

If you have any feedback on the Duffel Airways test mode, drop us a line.