Getting Started with Flight Search
This page covers the essential information needed to get started with Flight Search using the ORX API. We'll explain how to use the POST /flight/search
endpoint to search for flights, what the required payload is, what the expected response looks like, and how to manage your session.
Search for Flights
POST /flight/search
This endpoint specifies the criteria for your flight search. It will return a session public ID that you can use to manage your itinerary, including adding flights, passengers, and more.
Payload
The payload for POST /flight/search
should include the following:
{
"queries": [
{
"departure_airport": "LAX",
"arrival_airport": "YVR",
"departure_date": "2033-03-26"
},
{
"departure_airport": "YVR",
"arrival_airport": "LAX",
"departure_date": "2033-03-28"
}
],
"passengers": [
{
"code": "ADT"
},
{
"code": "CHD"
}
]
}
This payload may include the following fields:
-
queries
: An array of objects that represents the flight search query. The example above searches for flights from LAX to YVR on March 26th, 2023.-
The dates provided are supposed to be in the ISO8601 (opens in a new tab) format.
-
Airport codes should be provided in the 3-letter IATA (opens in a new tab) format.
-
-
passengers
: An array of objects that representing each passenger. The example above includes one adult passenger.code
is of type Passenger Code.
-
preferences
: An object that represents additional search preferences. It could be used to specify a suppression method and discount codes. See advanced usage for more info.
Response
The response for POST /flight/search
will include a session public ID that you can use to manage the entire itinerary. The response will look like this:
{
"flow": "FLIGHT",
"expireAt": "2023-03-25T01:37:28.949Z",
"createdAt": "2023-03-24T23:37:28.949Z",
"public": "14a010e5-6d9e-4acd-8979-625cb003ece8"
}
The public
property is what you'll use to identify the session. You can retrieve the same information about your session using the GET /session
endpoint.
Possible Errors
Status Code | Error | Reason |
---|---|---|
400 | [VALIDATION ERROR] | Failed Validation |
500 | NDCx Internal Error | Unknown |
Advanced Usage
You can also pass in additional search preferences in the preferences
object in the payload.
{
"queries": [
//query
],
"passengers": [
//versions/v2/passengers
],
"preferences": {
"suppression": "NO_SUPPRESSION",
"discount_codes": ["discount"]
}
}
🛎 Note that these preferences will override your default settings. We recommend only customizing these if you have a specific need.
Suppression
The suppression property controls duplicate suppression for the search results. It can take one of the following values:
FIRST_BOUND
: This is the default behavior and will remove duplicates based on the first bound found.REDEMPTIVE
: This will remove duplicates based on all bounds.NO_SUPPRESSION
: This will not suppress duplicate flights at all.
Discount Codes
he discount_codes
property can accept an array or a single string.
"preferences": {
"discount_codes": ["discount"]
}
🛎 We recommend only using proper values as discount codes, as some sources will deny any response for invalid codes.