Query object
The query object is used when querying the endpoint for data on your search criteria.
You can also find a guide on what queries we support and how to construct them in the What can you build with the API? section.
Layout
query object
├── currency
├── market
├── locale
├── queryLegs
│ ├── originPlace
│ │ │ queryPlace
│ │ ├── ├── iata
│ │ └── └── entityId
│ ├── destinationPlace
│ │ │ queryPlace
│ │ ├── ├── iata
│ │ └── └── entityId
│ └── date
└─── dateTimeGroupingType
Description
Parameter | Description | Example |
---|---|---|
market | The market/country your user is in | UK |
locale | The locale you want the results in (ISO locale) | en-GB |
currency | The currency you want the prices in | GBP |
queryLegs | The legs queried for inbound and outbound place and date. Its an array that can have 1 or two entries. Having two entries means the query will search for return flights | Query Leg |
dateTimeGroupingType | The way the quotes are grouped by in terms of dates. | Date Time Grouping Types |
Query leg
Parameter | Description | Example |
---|---|---|
originPlace | The origin place. It needs to contain either an IATA or an entity ID. | Place |
destinationPlace | The destination place. It needs to contain either an IATA or an entity ID. | Place |
dateRange, fixedDate, anytime | The date of flight. It can be a range of dates, a fixed date or anytime | Date |
Place
The place value can be either queryPlace
or anywhere
.
Here is an example of all the possible values:
queryPlace - IATA | queryPlace - entity ID | anywhere |
---|---|---|
|
|
|
QueryPlace
Parameter | Description | Example |
---|---|---|
iata | The IATA code of and origin or destination city or airport | LHR |
entityId | The internal Skyscanner ID for an origin or destination location | 95565050 |
The supported place types for the requests are cities and airports. Not all supported place types have IATA codes, so you can use entity IDs for them.
What are entity IDs?
Entity IDs are internal Skyscanner unique identifiers for places. We use them because not all places we support for our searches have industry-standard identifiers like IATA or ICAO.
You can use the Autosuggest API v1 to get entity IDs for places.
You can look up places with the Autosuggest API by:
- SKY codes (old internal Skyscanner IDs)
- IP addresses
- The coordinates of the place (we will return the nearest place)
- The name of the place (partial names are also supported)
For full details on the Autosuggest API v1 check out the full documentation.
Date
The date can be either dateRange
, fixedDate
, or anytime
.
All the dates must be in the future. Requests with dates in the past will fail.
Here are examples of all the possible values:
dateRange | fixedDate | anytime |
---|---|---|
|
|
|
The date ranges are considered from the first day of the startDate
month to the last day of the endDate
month.
Date Time Grouping Types
The following types are only working when searching in date ranges and not for fixed dates.
- When searching in date ranges one of the following date time grouping types is required, otherwise only two quotes will be returned.
- For
anytime
date search, the grouping typeDATE_TIME_GROUPING_TYPE_BY_MONTH
is required, otherwise only two quotes will be returned.
DATE_TIME_GROUPING_TYPE_BY_DATE
Grouping by date is used to get each combination of quotes from the start of the month with each other day of the month. It only works for single month date ranges (e.g. for October 2024).
Show request example
{
"query": {
"currency": "GBP",
"locale": "en-GB",
"market": "UK",
"dateTimeGroupingType": "DATE_TIME_GROUPING_TYPE_BY_DATE",
"query_legs": [
{
"destinationPlace": {
"query_place": {
"iata": "EDI"
}
},
"originPlace": {
"query_place": {
"iata": "LHR"
}
},
"dateRange": {
"startDate": {
"year": 2024,
"month": 12
},
"endDate": {
"year": 2024,
"month": 12
}
}
}
]
}
}
DATE_TIME_GROUPING_TYPE_BY_MONTH
Grouping by month is used to get each combination of quotes from different months, and would be the cheapest of each month. It only works when the date range is bigger than a whole month.
Show request example
{
"query": {
"currency": "GBP",
"locale": "en-GB",
"market": "UK",
"dateTimeGroupingType": "DATE_TIME_GROUPING_TYPE_BY_MONTH",
"query_legs": [
{
"destinationPlace": {
"query_place": {
"iata": "EDI"
}
},
"originPlace": {
"query_place": {
"iata": "LHR"
}
},
"dateRange": {
"startDate": {
"year": 2024,
"month": 11
},
"endDate": {
"year": 2024,
"month": 12
}
}
}
]
}
}