Orders
Once you've searched for flights by creating an offer request, and you've chosen which offer you want to book, you'll then want to create an order.
To create an order, you just need to provide the offer ID, payment details and some additional information on the passengers (e.g. their full name and date of birth).
Schema
The base price of the order for all flights and services booked, excluding taxes
"30.20"
The currency of the base_amount
, as an ISO 4217 currency code.
It will match your organisation's billing currency unless you’re using Duffel as an accredited IATA agent, in which case it will be in the currency provided by the airline (which will usually be based on the country where your IATA agency is registered).
"GBP"
The airline's reference for the order, sometimes known as a "passenger name record" (PNR) or "record locator". Your customers can use this to check in and manage their booking on the airline's website.
"RZPNX8"
The ISO 8601 datetime at which the order was cancelled, if it has been cancelled
"2020-04-11T15:48:11.642Z"
The conditions associated with this order, describing the kinds of modifications you can make to it and any penalties that will apply to those modifications.
This information assumes the condition is applied to all of the slices and passengers associated with this order - for information at the slice level (e.g. "what happens if I just want to change the first slice?") refer to the slices
.
If a particular kind of modification is allowed, you may not always be able to take action through the Duffel API. In some cases, you may need to contact the Duffel support team or the airline directly.
The ISO 8601 datetime at which the order was created
"2020-04-11T15:48:11.642Z"
The documents issued for this order.
Duffel's unique identifier for the order
"ord_00009hthhsUZ8W4LxQgkjo"
Whether the order was created in live mode. This field will be set to true
if the order was created in live mode, or false
if it was created in test mode.
false
The airline who owns the order
The passengers who are travelling
The payment status for this order
The services booked along with this order
The slices that make up the itinerary of this order. One-way journeys can be expressed using one slice, whereas return trips will need two.
The amount of tax payable on the order for all the flights booked
"30.20"
The currency of the tax_amount
, as an ISO 4217 currency code.
It will match your organisation's billing currency unless you’re using Duffel as an accredited IATA agent, in which case it will be in the currency provided by the airline (which will usually be based on the country where your IATA agency is registered).
"GBP"
The total price of the order for all the flights and services booked, including taxes
"90.80"
The currency of the total_amount
, as an ISO 4217 currency code.
It will match your organisation's billing currency unless you’re using Duffel as an accredited IATA agent, in which case it will be in the currency provided by the airline (which will usually be based on the country where your IATA agency is registered).
"GBP"
List orders
Retrieves a paginated list of all orders. The results may be returned in any order.
You can optionally filter the results by the awaiting_payment
state and
sort by the payment_required_by
date.
Endpoint
Query Parameters
A cursor pointing to the previous page of records. For more information on how to paginate through records, see the Pagination section.
"g2wAAAACbQAAABBBZXJvbWlzdC1LaGFya2l2bQAAAB="
A cursor pointing to the next page of records. For more information on how to paginate through records, see the Pagination section.
"g2wAAAACbQAAABBBZXJvbWlzdC1LaGFya2l2bQAAAB="
The maximum number of records to return per page. Defaults to 50
.
May be set to any integer between 1
and 200
. For more information on how to paginate through records, see the Pagination section.
1
Whether to filter orders that are awaiting payment or not. If not specified, all orders regardless of their payment state will be returned.
false
By default, orders aren't returned in any specific order. This parameter
allows you to sort the list of orders by the payment_required_by
date. If you wish
to sort in descending order, a -
prefix will be needed (i.e. -payment_required_by
).
"payment_required_by"
Request example
curl -X GET --compressed "https://api.duffel.com/air/orders" \-H "Accept-Encoding: gzip" \-H "Accept: application/json" \-H "Duffel-Version: beta" \-H "Authorization: Bearer <YOUR_ACCESS_TOKEN>"
Response example
{"meta": {"limit": 50,"after": "g2wAAAACbQAAABBBZXJvbWlzdC1LaGFya2l2bQAAAB="},"data": [{"total_currency": "GBP","total_amount": "90.80","tax_currency": "GBP","tax_amount": "30.20","slices": [{"segments": [{"passengers": [{"seat": {"name": "Exit row seat","disclosures": ["Do not seat children in exit row seats","Do not seat passengers with special needs in exit row seats"],"designator": "14B"},"passenger_id": "passenger_0","cabin_class_marketing_name": "Economy Basic","cabin_class": "economy","baggages": [{"type": "checked","quantity": 1}]}],"origin_terminal": "B","origin": {"time_zone": "Europe/London","name": "Heathrow","longitude": -141.951519,"latitude": 64.068865,"id": "arp_lhr_gb","icao_code": "EGLL","iata_country_code": "GB","iata_code": "LHR","city_name": "London","city": {"name": "London","id": "cit_lon_gb","iata_country_code": "GB","iata_code": "LON"}},"operating_carrier_flight_number": "4321","operating_carrier": {"name": "British Airways","id": "aln_00001876aqC8c5umZmrRds","iata_code": "BA"},"marketing_carrier_flight_number": "1234","marketing_carrier": {"name": "British Airways","id": "aln_00001876aqC8c5umZmrRds","iata_code": "BA"},"id": "seg_00009htYpSCXrwaB9Dn456","duration": "PT02H26M","distance": "424.2","destination_terminal": "5","destination": {"time_zone": "Europe/London","name": "Heathrow","longitude": -141.951519,"latitude": 64.068865,"id": "arp_lhr_gb","icao_code": "EGLL","iata_country_code": "GB","iata_code": "LHR","city_name": "London","city": {"name": "London","id": "cit_lon_gb","iata_country_code": "GB","iata_code": "LON"}},"departure_terminal": "B","departure_datetime": "2020-06-13T16:38:02","departing_at": "2020-06-13T16:38:02","arriving_at": "2020-06-13T16:38:02","arrival_terminal": "5","arrival_datetime": "2020-06-13T16:38:02","aircraft": {"name": "Airbus Industries A380","id": "arc_00009UhD4ongolulWd91Ky","iata_code": "380"}}],"origin_type": "airport","origin": {"type": "airport","time_zone": "Europe/London","name": "Heathrow","longitude": -141.951519,"latitude": 64.068865,"id": "arp_lhr_gb","icao_code": "EGLL","iata_country_code": "GB","iata_code": "LHR","iata_city_code": "LON","city_name": "London","city": {"name": "London","id": "cit_lon_gb","iata_country_code": "GB","iata_code": "LON"},"airports": [{"time_zone": "Europe/London","name": "Heathrow","longitude": -141.951519,"latitude": 64.068865,"id": "arp_lhr_gb","icao_code": "EGLL","iata_country_code": "GB","iata_code": "LHR","city_name": "London","city": {"name": "London","id": "cit_lon_gb","iata_country_code": "GB","iata_code": "LON"}}]},"id": "sli_00009htYpSCXrwaB9Dn123","duration": "PT02H26M","destination_type": "airport","destination": {"type": "airport","time_zone": "Europe/London","name": "Heathrow","longitude": -141.951519,"latitude": 64.068865,"id": "arp_lhr_gb","icao_code": "EGLL","iata_country_code": "GB","iata_code": "LHR","iata_city_code": "LON","city_name": "London","city": {"name": "London","id": "cit_lon_gb","iata_country_code": "GB","iata_code": "LON"},"airports": [{"time_zone": "Europe/London","name": "Heathrow","longitude": -141.951519,"latitude": 64.068865,"id": "arp_lhr_gb","icao_code": "EGLL","iata_country_code": "GB","iata_code": "LHR","city_name": "London","city": {"name": "London","id": "cit_lon_gb","iata_country_code": "GB","iata_code": "LON"}}]},"conditions": {"change_before_departure": {"penalty_currency": "GBP","penalty_amount": "100.00","allowed": true}},"changeable": false}],"services": [{"type": "baggage","total_currency": "GBP","total_amount": "15.00","segment_ids": ["seg_00009hj8USM7Ncg31cB456"],"quantity": 1,"passenger_ids": ["pas_00009hj8USM7Ncg31cBCLL"],"id": "ser_00009UhD4ongolulWd9123"}],"payment_status": {"price_guarantee_expires_at": "2020-01-17T10:42:14.545Z","payment_required_by": "2020-01-17T10:42:14.545Z","awaiting_payment": true},"passengers": [{"type": "adult","title": "mrs","infant_passenger_id": "pas_00009hj8USM8Ncg32aTGHL","id": "pas_00009hj8USM7Ncg31cBCLL","given_name": "Amelia","gender": "f","family_name": "Earhart","born_on": "1987-07-24"}],"owner": {"name": "British Airways","id": "aln_00001876aqC8c5umZmrRds","iata_code": "BA"},"live_mode": false,"id": "ord_00009hthhsUZ8W4LxQgkjo","documents": [{"unique_identifier": "1252106312810"}],"created_at": "2020-04-11T15:48:11.642Z","conditions": {"refund_before_departure": {"penalty_currency": "GBP","penalty_amount": "100.00","allowed": true},"change_before_departure": {"allowed": true}},"cancelled_at": "2020-04-11T15:48:11.642Z","booking_reference": "RZPNX8","base_currency": "GBP","base_amount": "30.20"}]}
Create an order
Creates a booking with an airline based on an offer. You must pay for the order at the time of creation.
When presenting an order confirmation to your customers (e.g. on screen or in an email), you should include
the booking_reference
and details of the full itinerary and show the full name of the operating carrier
of each segment (slices[].segments[].operating_carrier.name
) in order to comply with US regulations.
If you receive a 500 Internal Server Error
when trying to create an order, it may have still been created on
the airline’s side. Please contact Duffel support before trying the request again.
Endpoint
Body parameters
The personal details of the passengers, expanding on the information initially provided when creating the offer request
The payment details to use to pay for the order
The id
s of the offers you want to book. You must specify an array containing exactly one selected offer.
["off_00009htyDGjIfajdNBZRlw"]
The services you want to book along with the first selected offer.
The payment action you want to take for your order. You can only use pay_later
with offers that contain requires_instant_payment: false
.
"instant"
or "pay_later"
Request example
curl -X POST --compressed "https://api.duffel.com/air/orders" \-H "Accept-Encoding: gzip" \-H "Accept: application/json" \-H "Content-Type: application/json" \-H "Duffel-Version: beta" \-H "Authorization: Bearer <YOUR_ACCESS_TOKEN>" \-d '{"data": {"type": "instant","services": [{"quantity": 1,"id": "ase_00009hj8USM7Ncg31cB123"}],"selected_offers": ["off_00009htyDGjIfajdNBZRlw"],"payments": [{"type": "balance","currency": "GBP","amount": "30.20"}],"passengers": [{"type": "adult","title": "mrs","phone_number": "+442080160509","infant_passenger_id": "pas_00009hj8USM8Ncg32aTGHL","identity_documents": [{"unique_identifier": "19KL56147","type": "passport","issuing_country_code": "GB","expires_on": "2025-04-25"}],"id": "pas_00009hj8USM7Ncg31cBCLL","given_name": "Amelia","gender": "f","family_name": "Earhart","email": "amelia@duffel.com","born_on": "1987-07-24"}]}}'
Response example
{"data": {"total_currency": "GBP","total_amount": "90.80","tax_currency": "GBP","tax_amount": "30.20","slices": [{"segments": [{"passengers": [{"seat": {"name": "Exit row seat","disclosures": ["Do not seat children in exit row seats","Do not seat passengers with special needs in exit row seats"],"designator": "14B"},"passenger_id": "passenger_0","cabin_class_marketing_name": "Economy Basic","cabin_class": "economy","baggages": [{"type": "checked","quantity": 1}]}],"origin_terminal": "B","origin": {"time_zone": "Europe/London","name": "Heathrow","longitude": -141.951519,"latitude": 64.068865,"id": "arp_lhr_gb","icao_code": "EGLL","iata_country_code": "GB","iata_code": "LHR","city_name": "London","city": {"name": "London","id": "cit_lon_gb","iata_country_code": "GB","iata_code": "LON"}},"operating_carrier_flight_number": "4321","operating_carrier": {"name": "British Airways","id": "aln_00001876aqC8c5umZmrRds","iata_code": "BA"},"marketing_carrier_flight_number": "1234","marketing_carrier": {"name": "British Airways","id": "aln_00001876aqC8c5umZmrRds","iata_code": "BA"},"id": "seg_00009htYpSCXrwaB9Dn456","duration": "PT02H26M","distance": "424.2","destination_terminal": "5","destination": {"time_zone": "Europe/London","name": "Heathrow","longitude": -141.951519,"latitude": 64.068865,"id": "arp_lhr_gb","icao_code": "EGLL","iata_country_code": "GB","iata_code": "LHR","city_name": "London","city": {"name": "London","id": "cit_lon_gb","iata_country_code": "GB","iata_code": "LON"}},"departure_terminal": "B","departure_datetime": "2020-06-13T16:38:02","departing_at": "2020-06-13T16:38:02","arriving_at": "2020-06-13T16:38:02","arrival_terminal": "5","arrival_datetime": "2020-06-13T16:38:02","aircraft": {"name": "Airbus Industries A380","id": "arc_00009UhD4ongolulWd91Ky","iata_code": "380"}}],"origin_type": "airport","origin": {"type": "airport","time_zone": "Europe/London","name": "Heathrow","longitude": -141.951519,"latitude": 64.068865,"id": "arp_lhr_gb","icao_code": "EGLL","iata_country_code": "GB","iata_code": "LHR","iata_city_code": "LON","city_name": "London","city": {"name": "London","id": "cit_lon_gb","iata_country_code": "GB","iata_code": "LON"},"airports": [{"time_zone": "Europe/London","name": "Heathrow","longitude": -141.951519,"latitude": 64.068865,"id": "arp_lhr_gb","icao_code": "EGLL","iata_country_code": "GB","iata_code": "LHR","city_name": "London","city": {"name": "London","id": "cit_lon_gb","iata_country_code": "GB","iata_code": "LON"}}]},"id": "sli_00009htYpSCXrwaB9Dn123","duration": "PT02H26M","destination_type": "airport","destination": {"type": "airport","time_zone": "Europe/London","name": "Heathrow","longitude": -141.951519,"latitude": 64.068865,"id": "arp_lhr_gb","icao_code": "EGLL","iata_country_code": "GB","iata_code": "LHR","iata_city_code": "LON","city_name": "London","city": {"name": "London","id": "cit_lon_gb","iata_country_code": "GB","iata_code": "LON"},"airports": [{"time_zone": "Europe/London","name": "Heathrow","longitude": -141.951519,"latitude": 64.068865,"id": "arp_lhr_gb","icao_code": "EGLL","iata_country_code": "GB","iata_code": "LHR","city_name": "London","city": {"name": "London","id": "cit_lon_gb","iata_country_code": "GB","iata_code": "LON"}}]},"conditions": {"change_before_departure": {"penalty_currency": "GBP","penalty_amount": "100.00","allowed": true}},"changeable": false}],"services": [{"type": "baggage","total_currency": "GBP","total_amount": "15.00","segment_ids": ["seg_00009hj8USM7Ncg31cB456"],"quantity": 1,"passenger_ids": ["pas_00009hj8USM7Ncg31cBCLL"],"id": "ser_00009UhD4ongolulWd9123"}],"payment_status": {"price_guarantee_expires_at": "2020-01-17T10:42:14.545Z","payment_required_by": "2020-01-17T10:42:14.545Z","awaiting_payment": true},"passengers": [{"type": "adult","title": "mrs","infant_passenger_id": "pas_00009hj8USM8Ncg32aTGHL","id": "pas_00009hj8USM7Ncg31cBCLL","given_name": "Amelia","gender": "f","family_name": "Earhart","born_on": "1987-07-24"}],"owner": {"name": "British Airways","id": "aln_00001876aqC8c5umZmrRds","iata_code": "BA"},"live_mode": false,"id": "ord_00009hthhsUZ8W4LxQgkjo","documents": [{"unique_identifier": "1252106312810"}],"created_at": "2020-04-11T15:48:11.642Z","conditions": {"refund_before_departure": {"penalty_currency": "GBP","penalty_amount": "100.00","allowed": true},"change_before_departure": {"allowed": true}},"cancelled_at": "2020-04-11T15:48:11.642Z","booking_reference": "RZPNX8","base_currency": "GBP","base_amount": "30.20"}}
Get a single order
Retrieves an order by its ID
Endpoint
URL parameters
Duffel's unique identifier for the order
"ord_00009hthhsUZ8W4LxQgkjo"
Request example
curl -X GET --compressed "https://api.duffel.com/air/orders/{id}" \-H "Accept-Encoding: gzip" \-H "Accept: application/json" \-H "Duffel-Version: beta" \-H "Authorization: Bearer <YOUR_ACCESS_TOKEN>"
Response example
{"data": {"total_currency": "GBP","total_amount": "90.80","tax_currency": "GBP","tax_amount": "30.20","slices": [{"segments": [{"passengers": [{"seat": {"name": "Exit row seat","disclosures": ["Do not seat children in exit row seats","Do not seat passengers with special needs in exit row seats"],"designator": "14B"},"passenger_id": "passenger_0","cabin_class_marketing_name": "Economy Basic","cabin_class": "economy","baggages": [{"type": "checked","quantity": 1}]}],"origin_terminal": "B","origin": {"time_zone": "Europe/London","name": "Heathrow","longitude": -141.951519,"latitude": 64.068865,"id": "arp_lhr_gb","icao_code": "EGLL","iata_country_code": "GB","iata_code": "LHR","city_name": "London","city": {"name": "London","id": "cit_lon_gb","iata_country_code": "GB","iata_code": "LON"}},"operating_carrier_flight_number": "4321","operating_carrier": {"name": "British Airways","id": "aln_00001876aqC8c5umZmrRds","iata_code": "BA"},"marketing_carrier_flight_number": "1234","marketing_carrier": {"name": "British Airways","id": "aln_00001876aqC8c5umZmrRds","iata_code": "BA"},"id": "seg_00009htYpSCXrwaB9Dn456","duration": "PT02H26M","distance": "424.2","destination_terminal": "5","destination": {"time_zone": "Europe/London","name": "Heathrow","longitude": -141.951519,"latitude": 64.068865,"id": "arp_lhr_gb","icao_code": "EGLL","iata_country_code": "GB","iata_code": "LHR","city_name": "London","city": {"name": "London","id": "cit_lon_gb","iata_country_code": "GB","iata_code": "LON"}},"departure_terminal": "B","departure_datetime": "2020-06-13T16:38:02","departing_at": "2020-06-13T16:38:02","arriving_at": "2020-06-13T16:38:02","arrival_terminal": "5","arrival_datetime": "2020-06-13T16:38:02","aircraft": {"name": "Airbus Industries A380","id": "arc_00009UhD4ongolulWd91Ky","iata_code": "380"}}],"origin_type": "airport","origin": {"type": "airport","time_zone": "Europe/London","name": "Heathrow","longitude": -141.951519,"latitude": 64.068865,"id": "arp_lhr_gb","icao_code": "EGLL","iata_country_code": "GB","iata_code": "LHR","iata_city_code": "LON","city_name": "London","city": {"name": "London","id": "cit_lon_gb","iata_country_code": "GB","iata_code": "LON"},"airports": [{"time_zone": "Europe/London","name": "Heathrow","longitude": -141.951519,"latitude": 64.068865,"id": "arp_lhr_gb","icao_code": "EGLL","iata_country_code": "GB","iata_code": "LHR","city_name": "London","city": {"name": "London","id": "cit_lon_gb","iata_country_code": "GB","iata_code": "LON"}}]},"id": "sli_00009htYpSCXrwaB9Dn123","duration": "PT02H26M","destination_type": "airport","destination": {"type": "airport","time_zone": "Europe/London","name": "Heathrow","longitude": -141.951519,"latitude": 64.068865,"id": "arp_lhr_gb","icao_code": "EGLL","iata_country_code": "GB","iata_code": "LHR","iata_city_code": "LON","city_name": "London","city": {"name": "London","id": "cit_lon_gb","iata_country_code": "GB","iata_code": "LON"},"airports": [{"time_zone": "Europe/London","name": "Heathrow","longitude": -141.951519,"latitude": 64.068865,"id": "arp_lhr_gb","icao_code": "EGLL","iata_country_code": "GB","iata_code": "LHR","city_name": "London","city": {"name": "London","id": "cit_lon_gb","iata_country_code": "GB","iata_code": "LON"}}]},"conditions": {"change_before_departure": {"penalty_currency": "GBP","penalty_amount": "100.00","allowed": true}},"changeable": false}],"services": [{"type": "baggage","total_currency": "GBP","total_amount": "15.00","segment_ids": ["seg_00009hj8USM7Ncg31cB456"],"quantity": 1,"passenger_ids": ["pas_00009hj8USM7Ncg31cBCLL"],"id": "ser_00009UhD4ongolulWd9123"}],"payment_status": {"price_guarantee_expires_at": "2020-01-17T10:42:14.545Z","payment_required_by": "2020-01-17T10:42:14.545Z","awaiting_payment": true},"passengers": [{"type": "adult","title": "mrs","infant_passenger_id": "pas_00009hj8USM8Ncg32aTGHL","id": "pas_00009hj8USM7Ncg31cBCLL","given_name": "Amelia","gender": "f","family_name": "Earhart","born_on": "1987-07-24"}],"owner": {"name": "British Airways","id": "aln_00001876aqC8c5umZmrRds","iata_code": "BA"},"live_mode": false,"id": "ord_00009hthhsUZ8W4LxQgkjo","documents": [{"unique_identifier": "1252106312810"}],"created_at": "2020-04-11T15:48:11.642Z","conditions": {"refund_before_departure": {"penalty_currency": "GBP","penalty_amount": "100.00","allowed": true},"change_before_departure": {"allowed": true}},"cancelled_at": "2020-04-11T15:48:11.642Z","booking_reference": "RZPNX8","base_currency": "GBP","base_amount": "30.20"}}