Google Maps Autocomplete API
Google Maps Autocomplete API allows you to get suggestions for a keyword. The API is accessed through the following endpoint: /search?engine=google_maps_autocomplete
.
A user may query the following: https://serpapi.com/search?engine=google_maps_autocomplete
utilizing a GET
request. Head to the playground for a live and interactive demo.
API Parameters
Geographic Location
ll
Required
Parameter defines GPS coordinates of location where you want your q (query) to be applied. It has to be constructed in the next sequence:@
+ latitude
+ ,
+ longitude
+ ,
+ zoom
This will form a string that looks like this:
e.g. @40.7455096,-74.0083012,14z
. The zoom
parameter ranges from 3z
, map completely zoomed out - to 21z
, map completely zoomed in.
Localization
gl
Optional
Parameter defines the country to use for the Google Maps Autocomplete search. It's a two-letter country code. (e.g., us
for the United States, uk
for United Kingdom, or fr
for France) Head to the Google countries page for a full list of supported Google countries.
hl
Optional
Parameter defines the language to use for the Google Maps Autocomplete search. It's a two-letter language code. (e.g., en
for English, es
for Spanish, or fr
for French). Head to the Google languages page for a full list of supported Google languages.
Serpapi Parameters
engine
Required
Set parameter to google_maps_autocomplete
to use the Google Maps Autocomplete API engine.
no_cache
Optional
Parameter will force SerpApi to fetch the Google Maps Autocomplete results even if a cached version is already present. A cache is served only if the query and all parameters are exactly the same. Cache expires after 1h. Cached searches are free, and are not counted towards your searches per month. It can be set to false
(default) to allow results from the cache, or true
to disallow results from the cache. no_cache and async parameters should not be used together.
async
Optional
Parameter defines the way you want to submit your search to SerpApi. It can be set to false
(default) to open an HTTP connection and keep it open until you got your search results, or true
to just submit your search to SerpApi and retrieve them later. In this case, you'll need to use our Searches Archive API to retrieve your results. async and no_cache parameters should not be used together. async should not be used on accounts with Ludicrous Speed enabled.
zero_trace
Optional
Enterprise only. Parameter enables ZeroTrace mode. It can be set to false
(default) or true
. Enable this mode to skip storing search parameters, search files, and search metadata on our servers. This may make debugging more difficult.
API Results
JSON Results
JSON output includes structured data for suggestions
- list of completions for provided keyword. Some of the results are places, which additionally include latitude
, longitude
and subtext
(typically their addresses).
HTML Results
This API does not have html response, just a text. search_metadata.prettify_html_file
contains prettified version of result. It is displayed in playground.
API Examples
JSON structure overview
{
...
"suggestions": {
"value": "String - The suggested keyword",
"serpapi_link": "String - URL to SerpApi Google Maps Autocomplete API",
"maps_serpapi_link": "String - URL to SerpApi Google Maps API",
"subtext": "String - Subtext of the suggested keyword, it's typically the address of the place when type is `place`",
"type": "String - The type of the result, one of `keyword` and `place`",
"latitude": "Float - Latitude of the place",
"longitude": "Float - Longitude of the place",
"data_id": "String - Data ID to the place, can be used in Google Maps API, Google Maps Photos API and Google Maps Reviews API",
"reviews_serpapi_link": "String - URL to Google Maps Reviews API",
"photos_serpapi_link": "String - URL to Google Maps Photos API"
},
...
}
Example with q: cafe
parameter
{
"search_metadata": {
"id": "647fe65215afff0e8865e016",
"status": "Success",
"json_endpoint": "https://serpapi.com/searches/dadbc290840cdd30/647fe65215afff0e8865e016.json",
"created_at": "2023-06-07 02:07:14 UTC",
"processed_at": "2023-06-07 02:07:14 UTC",
"google_maps_autocomplete_url": "https://www.google.com/s?q=cafe&tbm=map&gs_ri=maps&suggest=p&gl=us&pb=<pb_parameter>",
"raw_html_file": "https://serpapi.com/searches/57faa0cf77de0682/647fe65215afff0e8865e016.html",
"prettify_html_file": "https://serpapi.com/searches/fba917b8f26fd68e/647fe65215afff0e8865e016.prettify",
"total_time_taken": 0.28
},
"search_parameters": {
"engine": "google_maps_autocomplete",
"q": "cafe",
"gl": "us",
"ll": "@40.7455096,-74.0083012,14z"
},
"search_information": {
"query_displayed": "cafe"
},
"suggestions": [
{
"value": "cafe",
"serpapi_link": "https://serpapi.com/search.json?engine=google_maps_autocomplete&gl=us&ll=%4040.7455096%2C-74.0083012%2C14z&q=cafe",
"maps_serpapi_link": "https://serpapi.com/search.json?engine=google_maps&google_domain=google.com&hl=en&ll=%4040.7455096%2C-74.0083012%2C14z&q=cafe&type=search",
"type": "keyword"
},
{
"value": "Café Lyria",
"serpapi_link": "https://serpapi.com/search.json?engine=google_maps_autocomplete&gl=us&ll=%4040.7455096%2C-74.0083012%2C14z&q=Caf%C3%A9+Lyria",
"subtext": "Crosby Street, New York, NY",
"type": "place",
"latitude": 40.725846,
"longitude": -73.995426,
"data_id": "0x89c259f56e035771:0x1a404262f72adc1f",
"reviews_serpapi_link": "https://serpapi.com/search.json?data_id=0x89c259f56e035771%3A0x1a404262f72adc1f&engine=google_maps_reviews&hl=en",
"photos_serpapi_link": "https://serpapi.com/search.json?data_id=0x89c259f56e035771%3A0x1a404262f72adc1f&engine=google_maps_photos&hl=en",
"maps_serpapi_link": "https://serpapi.com/search.json?data=%214m5%213m4%211s0x89c259f56e035771%3A0x1a404262f72adc1f%218m2%213d40.725846%214d-73.995426&engine=google_maps&google_domain=google.com&hl=en&ll=%4040.7455096%2C-74.0083012%2C14z&q=Caf%C3%A9+Lyria&type=place"
},
{
"value": "Cafe Wha?",
"serpapi_link": "https://serpapi.com/search.json?engine=google_maps_autocomplete&gl=us&ll=%4040.7455096%2C-74.0083012%2C14z&q=Cafe+Wha%3F",
"subtext": "MacDougal Street, New York, NY",
"type": "place",
"latitude": 40.730084,
"longitude": -74.00055789999999,
"data_id": "0x89c259922a0f1d41:0x871f2073371fb93e",
"reviews_serpapi_link": "https://serpapi.com/search.json?data_id=0x89c259922a0f1d41%3A0x871f2073371fb93e&engine=google_maps_reviews&hl=en",
"photos_serpapi_link": "https://serpapi.com/search.json?data_id=0x89c259922a0f1d41%3A0x871f2073371fb93e&engine=google_maps_photos&hl=en",
"maps_serpapi_link": "https://serpapi.com/search.json?data=%214m5%213m4%211s0x89c259922a0f1d41%3A0x871f2073371fb93e%218m2%213d40.730084%214d-74.00055789999999&engine=google_maps&google_domain=google.com&hl=en&ll=%4040.7455096%2C-74.0083012%2C14z&q=Cafe+Wha%3F&type=place"
},
{
"value": "Café China",
"serpapi_link": "https://serpapi.com/search.json?engine=google_maps_autocomplete&gl=us&ll=%4040.7455096%2C-74.0083012%2C14z&q=Caf%C3%A9+China",
"subtext": "West 37th Street, New York, NY",
"type": "place",
"latitude": 40.751571299999995,
"longitude": -73.9858221,
"data_id": "0x89c25900adca7485:0x1d4ea398ad50e0c",
"reviews_serpapi_link": "https://serpapi.com/search.json?data_id=0x89c25900adca7485%3A0x1d4ea398ad50e0c&engine=google_maps_reviews&hl=en",
"photos_serpapi_link": "https://serpapi.com/search.json?data_id=0x89c25900adca7485%3A0x1d4ea398ad50e0c&engine=google_maps_photos&hl=en",
"maps_serpapi_link": "https://serpapi.com/search.json?data=%214m5%213m4%211s0x89c25900adca7485%3A0x1d4ea398ad50e0c%218m2%213d40.751571299999995%214d-73.9858221&engine=google_maps&google_domain=google.com&hl=en&ll=%4040.7455096%2C-74.0083012%2C14z&q=Caf%C3%A9+China&type=place"
},
{
"value": "Cafe Mogador",
"serpapi_link": "https://serpapi.com/search.json?engine=google_maps_autocomplete&gl=us&ll=%4040.7455096%2C-74.0083012%2C14z&q=Cafe+Mogador",
"subtext": "Saint Marks Place, New York, NY",
"type": "place",
"latitude": 40.7274314,
"longitude": -73.98431149999999,
"data_id": "0x89c2599d133e8f2b:0x2df7f1a7bf3e00bc",
"reviews_serpapi_link": "https://serpapi.com/search.json?data_id=0x89c2599d133e8f2b%3A0x2df7f1a7bf3e00bc&engine=google_maps_reviews&hl=en",
"photos_serpapi_link": "https://serpapi.com/search.json?data_id=0x89c2599d133e8f2b%3A0x2df7f1a7bf3e00bc&engine=google_maps_photos&hl=en",
"maps_serpapi_link": "https://serpapi.com/search.json?data=%214m5%213m4%211s0x89c2599d133e8f2b%3A0x2df7f1a7bf3e00bc%218m2%213d40.7274314%214d-73.98431149999999&engine=google_maps&google_domain=google.com&hl=en&ll=%4040.7455096%2C-74.0083012%2C14z&q=Cafe+Mogador&type=place"
}
]
}