Google Flights Location Search API
Google Flights Location Search API allows to provide suggestions based on partial user input.
It returns detailed information including airport codes (IATA), city and airport titles, geographic context, and Knowledge Graph IDs (kgmid), supporting both airport and city-level matches.
API Parameters
Search Query
-
- Name
-
q - Required
- Required
- Description
-
Search query that would produce autocomplete suggestions.
Localization
-
- Name
-
hl - Required
- Optional
- Description
-
The default parameter
endefines the interface language of the search. Check the full list of supported Google Travelhllanguages.
Filters
-
- Name
-
search_type - Required
- Optional
- Description
-
Defines which flight box to autocomplete. Available options:
-
departureDefault arrival
-
Engine
-
- Name
-
engine - Required
- Required
- Description
-
Parameter defines an engine that will be used to retrieve real-time data. It must be set to
google_flights_location_search.
API key
-
- Name
-
api_key - Required
- Required
- Description
-
The
api_keyauthenticates your requests. Use it as a query parameter (https://www.searchapi.io/api/v1/search?api_key=YOUR_API_KEY) or in the Authorization header (Bearer YOUR_API_KEY).
Zero Data Retention
-
- Name
-
zero_retention - Enterprise Only
- Enterprise Only
- Required
- Optional
- Description
-
Set this parameter to
trueto disable all logging and persistent storage. No request parameters, HTML, or JSON responses are stored or logged. Suitable for high-compliance use cases. Debugging and support may be limited while enabled.
API Examples
Search Type - Departure
https://www.searchapi.io/api/v1/search?engine=google_flights_location_search&q=New
- Python
- Node
- Ruby
- Java
- Go
- PHP
- Bash
- R
- Kotlin
- Swift
- C#
- C
- C++
- requests
import requests
url = "https://www.searchapi.io/api/v1/search"
params = {
"engine": "google_flights_location_search",
"q": "New"
}
response = requests.get(url, params=params)
print(response.text)
{
...
"locations": [
{
"type": "city",
"kgmid": "/m/02_286",
"full_name": "New York",
"short_name": "New York",
"description": "City in New York State",
"airports": [
{
"type": "airport",
"kgmid": "/m/02_286",
"airport_code": "JFK",
"title": "John F. Kennedy International Airport",
"city": "New York",
"distance": "12 mi"
},
...
]
},
{
"type": "city",
"kgmid": "/m/0f2tj",
"full_name": "New Orleans, Louisiana",
"short_name": "New Orleans",
"description": "City in Louisiana",
"airports": [
{
"type": "airport",
"kgmid": "/m/0f2tj",
"airport_code": "MSY",
"title": "Louis Armstrong New Orleans International Airport",
"city": "New Orleans",
"distance": "11 mi"
}
]
},
...
]
}
Search Type - Arrival
https://www.searchapi.io/api/v1/search?engine=google_flights_location_search&q=New&search_type=arrival
- Python
- Node
- Ruby
- Java
- Go
- PHP
- Bash
- R
- Kotlin
- Swift
- C#
- C
- C++
- requests
import requests
url = "https://www.searchapi.io/api/v1/search"
params = {
"engine": "google_flights_location_search",
"q": "New",
"search_type": "arrival"
}
response = requests.get(url, params=params)
print(response.text)
{
"locations": [
{
"type": "city",
"kgmid": "/m/02_286",
"full_name": "New York, USA",
"short_name": "New York",
"description": "City in New York State",
"airports": [
{
"type": "airport",
"kgmid": "/m/02_286",
"airport_code": "JFK",
"title": "John F. Kennedy International Airport",
"city": "New York",
"distance": "20 km"
},
...
]
},
{
"type": "region",
"kgmid": "/m/0ctw_b",
"full_name": "New Zealand",
"short_name": "New Zealand",
"description": "Country in Oceania"
},
...
]
}