Supported Google Locations API
SearchApi supported locations API 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 yorkandlondon.
-
- 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_keyauthenticates 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).
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
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 CodeCityMunicipalityCantonNeighborhoodCountyCity RegionAirportUniversityDistrictRegionProvinceBoroughPrefectureAutonomous CommunityCountryUnion TerritoryGovernorateDepartmentTV RegionOkrugNational ParkTerritoryCongressional 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
},
...
]