Skip to main content

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

ParameterDescriptionExample
marketThe market/country your user is inUK
localeThe locale you want the results in (ISO locale)en-GB
currencyThe currency you want the prices inGBP
queryLegsThe 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 flightsQuery Leg
dateTimeGroupingTypeThe way the quotes are grouped by in terms of dates.Date Time Grouping Types

Query leg

ParameterDescriptionExample
originPlaceThe origin place. It needs to contain either an IATA or an entity ID.Place
destinationPlaceThe destination place. It needs to contain either an IATA or an entity ID.Place
dateRange, fixedDate, anytimeThe date of flight. It can be a range of dates, a fixed date or anytimeDate

Place

The place value can be either queryPlace or anywhere.

Here is an example of all the possible values:

queryPlace - IATAqueryPlace - entity IDanywhere
{
"queryPlace": {
"iata": "EDI"
}
}
{
"queryPlace": {
"entityId": "27544008"
}
}
{
"anywhere": true
}

QueryPlace

ParameterDescriptionExample
iataThe IATA code of and origin or destination city or airportLHR
entityIdThe internal Skyscanner ID for an origin or destination location95565050
info

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:

  1. SKY codes (old internal Skyscanner IDs)
  2. IP addresses
  3. The coordinates of the place (we will return the nearest place)
  4. 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:

dateRangefixedDateanytime
{
"dateRange": {
"startDate": {
"year": 2024,
"month": 8
},
"endDate": {
"year": 2024,
"month": 8
}
}
}
{
"fixedDate": {
"year": 2024,
"month": 8,
"day": 11
}
}
{
"anytime": "true"
}

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 type DATE_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
}
}
}
]
}
}