Supported Google Locations API
SearchApi supported locations API uses /api/v1/locations
API endpoint and allows you to localize Google searches to particular geographic areas.
This API is completely free.
API Parameters
Search Parameters
-
- Name
-
q
- Required
- Required
- Description
-
The search query to use to search for locations. For example,
new york
andlondon
.
-
- Name
-
limit
- Required
- Optional
- Description
-
The maximum number of results to return. Defaults to
10
. Maximum is 100.
-
- Name
-
api_key
- Required
- Required
- Description
-
The
api_key
authenticates your requests. Use it as a query parameter (https://www.searchapi.io/api/v1/locations?api_key=YOUR_API_KEY
) or in the Authorization header (Bearer YOUR_API_KEY
).
API Examples
Get supported locations
This API example retrieves the top 10 largest locations that include the term london
in their name.
You can then use canonical_name
(e.g. London,England,United Kingdom
)
as the value of location
parameter in the Google Search API.
Response parameters:
google_id
- The unique identifier for the location as per Google's system.google_parent_id
- The unique identifier for the parent location of the current location in Google's system. This points to existinggoogle_id
.name
- the common name of the location.canonical_name
- the official, standardized name of the location. Use this value in in the Google Search API.target_type
- specific classification of the location. This can be one of the following:Postal Code
City
Municipality
Canton
Neighborhood
County
City Region
Airport
University
District
Region
Province
Borough
Prefecture
Autonomous Community
Country
Union Territory
Governorate
Department
TV Region
Okrug
National Park
Territory
Congressional District
country_code
- the ISO 3166-1 alpha-2 two-letter country code. You can view the full list of supported countries.reach
- the population size within the specified location.lat
(latitude) - the coordinate that represents the location's north-south position on the Earth's surface.lon
(longitude) - the coordinate that represents the location's east-west position on the Earth's surface.
https://www.searchapi.io/api/v1/locations?q=london
- Python
- Node
- Ruby
- Java
- Go
- PHP
- Bash
- R
- Kotlin
- Swift
- C#
- C
- C++
- requests
import requests
url = "https://www.searchapi.io/api/v1/locations"
params = {
"q": "london"
}
response = requests.get(url, params=params)
print(response.text)
[
{
"google_id": 9047013,
"google_parent_id": 20339,
"name": "London",
"canonical_name": "London TV Region,England,United Kingdom",
"target_type": "TV Region",
"country_code": "GB",
"reach": 49600000,
"lat": 51.5991266,
"lon": -0.0942157
},
{
"google_id": 9041106,
"google_parent_id": 20339,
"name": "Greater London",
"canonical_name": "Greater London,England,United Kingdom",
"target_type": "County",
"country_code": "GB",
"reach": 46600000,
"lat": 51.4309209,
"lon": -0.0936496
},
{
"google_id": 1006886,
"google_parent_id": 20339,
"name": "London",
"canonical_name": "London,England,United Kingdom",
"target_type": "City",
"country_code": "GB",
"reach": 40300000,
"lat": 51.5072178,
"lon": -0.1275862
},
{
"google_id": 1002316,
"google_parent_id": 20339,
"name": "London Borough of Lambeth",
"canonical_name": "London Borough of Lambeth,England,United Kingdom",
"target_type": "Municipality",
"country_code": "GB",
"reach": 879000,
"lat": 51.4571477,
"lon": -0.1230681
},
{
"google_id": 9041110,
"google_parent_id": 20339,
"name": "City of London",
"canonical_name": "City of London,England,United Kingdom",
"target_type": "County",
"country_code": "GB",
"reach": 767000,
"lat": 51.5123443,
"lon": -0.0909852
},
{
"google_id": 1002325,
"google_parent_id": 20121,
"name": "London",
"canonical_name": "London,Ontario,Canada",
"target_type": "City",
"country_code": "CA",
"reach": 662000,
"lat": 42.9849233,
"lon": -81.2452768
},
{
"google_id": 9057243,
"google_parent_id": 21139,
"name": "New London County",
"canonical_name": "New London County,Connecticut,United States",
"target_type": "County",
"country_code": "US",
"reach": 402000,
"lat": 41.5185189,
"lon": -72.0468164
},
{
"google_id": 9041230,
"google_parent_id": 20339,
"name": "London Stansted Airport",
"canonical_name": "London Stansted Airport,England,United Kingdom",
"target_type": "Airport",
"country_code": "GB",
"reach": 222000,
"lat": 51.8863747,
"lon": 0.2413158
},
{
"google_id": 1006887,
"google_parent_id": 20339,
"name": "London Colney",
"canonical_name": "London Colney,England,United Kingdom",
"target_type": "City",
"country_code": "GB",
"reach": 206000,
"lat": 51.7225824,
"lon": -0.2993177
},
{
"google_id": 1028620,
"google_parent_id": 21214,
"name": "East London",
"canonical_name": "East London,Eastern Cape,South Africa",
"target_type": "City",
"country_code": "ZA",
"reach": 206000,
"lat": -33.0198434,
"lon": 27.903905
}
]