Google Autocomplete API
Google Autocomplete API allows you to get suggestions for a keyword. The API is accessed through the following endpoint: /search?engine=google_autocomplete
.
A user may query the following: https://serpapi.com/search?engine=google_autocomplete
utilizing a GET
request. Head to the playground for a live and interactive demo.
API Parameters
Localization
gl
Optional
Parameter defines the country to use for the Google 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 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.
Advanced Autocomplete Parameters
Serpapi Parameters
no_cache
Optional
Parameter will force SerpApi to fetch the Google 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.
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. chrome
and chrome-omni
clients also have omnibox related metadata - suggesttype
, verbatim_relevance
, clientdata
.
A search status is accessible through search_metadata.status
. It flows this way: Processing
-> Success
|| Error
. If a search has failed, error
will contain an error message. search_metadata.id
is the search ID inside SerpApi.
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
Example with q: coffee
parameter
{
"search_metadata": {
"id": "605881c3de9834001cb9a014",
"status": "Success",
"json_endpoint": "https://serpapi.com/searches/e577b8c1681b6153/605881c3de9834001cb9a014.json",
"created_at": "2021-03-22 11:38:43 UTC",
"processed_at": "2021-03-22 11:38:44 UTC",
"google_autocomplete_url": "https://www.google.com/complete/search?q=coffee&gl=us&hl=en&client=chrome",
"raw_html_file": "https://serpapi.com/searches/e577b8c1681b6153/605881c3de9834001cb9a014.html",
"prettify_html_file": "https://serpapi.com/searches/e577b8c1681b6153/605881c3de9834001cb9a014.prettify",
"total_time_taken": 0.26
},
"search_parameters": {
"engine": "google_autocomplete",
"q": "coffee",
"gl": "us",
"hl": "en"
},
"search_information": {
"autocomplete_results_state": "Showing completion results."
},
"suggestions": [
{
"value": "mega millions",
"relevance": 1250,
"type": "QUERY",
"serpapi_link": "https://serpapi.com/search.json?engine=google_autocomplete&q=mega+millions"
},
{
"value": "megan fox",
"relevance": 601,
"type": "QUERY",
"serpapi_link": "https://serpapi.com/search.json?engine=google_autocomplete&q=megan+fox"
},
{
"value": "megan thee stallion",
"relevance": 600,
"type": "QUERY",
"serpapi_link": "https://serpapi.com/search.json?engine=google_autocomplete&q=megan+tree+stallion"
},
...
],
"verbatim_relevance": 886
}
Example with q: t scott
and cp: 1
cp param can be used to refine completion. It stands for "cursor pointer". In this case it would be set to 1 meaning cursor would take place right after first "t" t| scott
{
"search_metadata": {
"id": "605882f5de98340020c8e942",
"status": "Success",
"json_endpoint": "https://serpapi.com/searches/ee108fda921ed872/605882f5de98340020c8e942.json",
"created_at": "2021-03-22 11:43:49 UTC",
"processed_at": "2021-03-22 11:43:50 UTC",
"google_autocomplete_url": "https://www.google.com/complete/search?q=t+scott&cp=1&gl=us&hl=en&client=chrome",
"raw_html_file": "https://serpapi.com/searches/ee108fda921ed872/605882f5de98340020c8e942.html",
"prettify_html_file": "https://serpapi.com/searches/ee108fda921ed872/605882f5de98340020c8e942.prettify",
"total_time_taken": 1.30
},
"search_parameters": {
"engine": "google_autocomplete",
"q": "t scott",
"cp": "1",
"gl": "us",
"hl": "en"
},
"search_information": {
"autocomplete_results_state": "Showing completion results."
},
"suggestions": [
{
"value": "travis scott",
"relevance": 601,
"type": "QUERY",
"serpapi_link": "https://serpapi.com/search.json?engine=google_autocomplete&q=travis+scott"
},
{
"value": "travis scott burger",
"relevance": 600,
"type": "QUERY",
"serpapi_link": "https://serpapi.com/search.json?engine=google_autocomplete&q=travis+scott+burger"
},
{
"value": "tim scott",
"relevance": 555,
"type": "QUERY",
"serpapi_link": "https://serpapi.com/search.json?engine=google_autocomplete&q=tim+scott"
},
...
],
"verbatim_relevance": 851
}
Example with q: t scott
and cp: 7
cp param can be used to refine completion. It stands for "cursor pointer". In this case it would be set to 7 meaning cursor would take place after the last "t" t scott|
{
"search_metadata": {
"id": "60588431de9834001e2a3d72",
"status": "Success",
"json_endpoint": "https://serpapi.com/searches/9071926fbf9dad59/60588431de9834001e2a3d72.json",
"created_at": "2021-03-22 11:49:05 UTC",
"processed_at": "2021-03-22 11:49:05 UTC",
"google_autocomplete_url": "https://www.google.com/complete/search?q=t+scott&cp=7&gl=us&hl=en&client=chrome",
"raw_html_file": "https://serpapi.com/searches/9071926fbf9dad59/60588431de9834001e2a3d72.html",
"prettify_html_file": "https://serpapi.com/searches/9071926fbf9dad59/60588431de9834001e2a3d72.prettify",
"total_time_taken": 1.03
},
"search_parameters": {
"engine": "google_autocomplete",
"q": "t scott",
"cp": "7",
"gl": "us",
"hl": "en"
},
"search_information": {
"autocomplete_results_state": "Showing completion results."
},
"suggestions": [
{
"value": "t scott jones",
"relevance": 1250,
"type": "QUERY",
"serpapi_link": "https://serpapi.com/search.json?engine=google_autocomplete&q=t+scott+jones"
},
{
"value": "t scott law",
"relevance": 700,
"type": "QUERY",
"serpapi_link": "https://serpapi.com/search.json?engine=google_autocomplete&q=t+scott+law"
},
{
"value": "t scott construction",
"relevance": 601,
"type": "QUERY",
"serpapi_link": "https://serpapi.com/search.json?engine=google_autocomplete&q=t+scott+construction"
},
...
],
"verbatim_relevance": 1300
}
Example with q: pewdiepie
and client: chrome
Changing client param might affect completion results. Here is example for chrome
.
{
"search_metadata": {
"id": "60588593de9834001e2a3d73",
"status": "Success",
"json_endpoint": "https://serpapi.com/searches/17723d4e141789e0/60588593de9834001e2a3d73.json",
"created_at": "2021-03-22 11:54:59 UTC",
"processed_at": "2021-03-22 11:54:59 UTC",
"google_autocomplete_url": "https://www.google.com/complete/search?q=pewdiepie&gl=us&hl=en&client=chrome",
"raw_html_file": "https://serpapi.com/searches/17723d4e141789e0/60588593de9834001e2a3d73.html",
"prettify_html_file": "https://serpapi.com/searches/17723d4e141789e0/60588593de9834001e2a3d73.prettify",
"total_time_taken": 1.15
},
"search_parameters": {
"engine": "google_autocomplete",
"q": "pewdiepie",
"gl": "us",
"hl": "en",
"client": "chrome"
},
"search_information": {
"autocomplete_results_state": "Showing completion results."
},
"suggestions": [
{
"value": "pewdiepie net worth",
"relevance": 1050,
"type": "QUERY",
"serpapi_link": "https://serpapi.com/search.json?engine=google_autocomplete&q=pewdiepie+net+worth"
},
{
"value": "pewdiepie merch",
"relevance": 601,
"type": "QUERY",
"serpapi_link": "https://serpapi.com/search.json?engine=google_autocomplete&q=pewdiepie+merch"
},
{
"value": "pewdiepie chair",
"relevance": 600,
"type": "QUERY",
"serpapi_link": "https://serpapi.com/search.json?engine=google_autocomplete&q=pewdiepie+chair"
},
...
],
"verbatim_relevance": 1300
}
Example with q: Coffee
and client: gws-wiz
Changing client param might affect completion results. Here is example for gws-wiz
.
{
"search_metadata": {
"id": "64fe624615afff16a04bf354",
"status": "Success",
"json_endpoint": "https://serpapi.com/searches/cbbccd07f13c20bf/64fe624615afff16a04bf354.json",
"created_at": "2023-09-11 00:41:42 UTC",
"processed_at": "2023-09-11 00:41:42 UTC",
"google_autocomplete_url": "https://www.google.com/complete/search?q=Coffee&hl=en&client=gws-wiz-serp&dpr=1",
"raw_html_file": "https://serpapi.com/searches/cbbccd07f13c20bf/64fe624615afff16a04bf354.html",
"prettify_html_file": "https://serpapi.com/searches/cbbccd07f13c20bf/64fe624615afff16a04bf354.prettify",
"total_time_taken": 0.54
},
"search_parameters": {
"engine": "google_autocomplete",
"q": "Coffee",
"hl": "en"
},
"search_information": {
"autocomplete_results_state": "Showing completion results."
},
"suggestions": [
{
"value": "coffee near me",
"serpapi_link": "https://serpapi.com/search.json?engine=google_autocomplete&hl=en&q=coffee%3Cb%3E+near+me%3C%2Fb%3E",
"value_highlight": "near me"
},
{
"value": "coffee",
"title": "Coffee",
"subtitle": "Beverage",
"thumbnail": "https://encrypted-tbn0.gstatic.com/images?q=tbn:ANd9GcQsWWsLtHHCkiTeIl_-9-5GiAAJveQ1nhcJzrPeKXIVuRKnmgQQEPGpANPEFg&s=10",
"serpapi_link": "https://serpapi.com/search.json?engine=google_autocomplete&hl=en&q=coffee"
},
{
"value": "coffee shop near me",
"serpapi_link": "https://serpapi.com/search.json?engine=google_autocomplete&hl=en&q=coffee%3Cb%3E+shop+near+me%3C%2Fb%3E",
"value_highlight": "shop near me"
},
{
"value": "coffee shop",
"serpapi_link": "https://serpapi.com/search.json?engine=google_autocomplete&hl=en&q=coffee%3Cb%3E+shop%3C%2Fb%3E",
"value_highlight": "shop"
},
{
"value": "coffee meets bagel",
"serpapi_link": "https://serpapi.com/search.json?engine=google_autocomplete&hl=en&q=coffee%3Cb%3E+meets+bagel%3C%2Fb%3E",
"value_highlight": "meets bagel"
},
{
"value": "coffee machine",
"serpapi_link": "https://serpapi.com/search.json?engine=google_autocomplete&hl=en&q=coffee%3Cb%3E+machine%3C%2Fb%3E",
"value_highlight": "machine"
},
{
"value": "coffee jelly",
"title": "Coffee jelly",
"subtitle": "Jelly dessert",
"thumbnail": "https://encrypted-tbn0.gstatic.com/images?q=tbn:ANd9GcTheVfygTXPDVVsHZP9FUObBCShcMlybdM2mTQQVPvPsN2fZR2OuuDvbIWejg&s=10",
"serpapi_link": "https://serpapi.com/search.json?engine=google_autocomplete&hl=en&q=coffee+jelly"
},
...
]
}
Example with q: pewdiepie
and client: safari
Changing client param might affect completion results. Here is example for safari
.
{
"search_metadata": {
"id": "60588679de9834001e2a3d74",
"status": "Success",
"json_endpoint": "https://serpapi.com/searches/1909edfac7e1512d/60588679de9834001e2a3d74.json",
"created_at": "2021-03-22 11:58:49 UTC",
"processed_at": "2021-03-22 11:58:49 UTC",
"google_autocomplete_url": "https://www.google.com/complete/search?q=pewdiepie&gl=us&hl=en&client=safari",
"raw_html_file": "https://serpapi.com/searches/1909edfac7e1512d/60588679de9834001e2a3d74.html",
"prettify_html_file": "https://serpapi.com/searches/1909edfac7e1512d/60588679de9834001e2a3d74.prettify",
"total_time_taken": 1.13
},
"search_parameters": {
"engine": "google_autocomplete",
"q": "pewdiepie",
"gl": "us",
"hl": "en",
"client": "safari"
},
"search_information": {
"autocomplete_results_state": "Showing completion results."
},
"suggestions": [
{
"value": "pewdiepie net worth",
"relevance": 1050,
"type": "QUERY",
"serpapi_link": "https://serpapi.com/search.json?engine=google_autocomplete&q=pewdiepie+net+worth"
},
{
"value": "pewdiepie merch",
"relevance": 601,
"type": "QUERY",
"serpapi_link": "https://serpapi.com/search.json?engine=google_autocomplete&q=pewdiepie+merch"
},
{
"value": "pewdiepie chair",
"relevance": 600,
"type": "QUERY",
"serpapi_link": "https://serpapi.com/search.json?engine=google_autocomplete&q=pewdiepie+chair"
},
...
],
"verbatim_relevance": 1300
}
Example for Google Local
Changing client param might affect completion results. Here is example for Google Local
with q: Coffee
and client: gws-wiz-local
.
{
"search_metadata": {
"id": "6479b27815afff3cf45e2a1f",
"status": "Success",
"json_endpoint": "https://serpapi.com/searches/7aa6a786ba7778c7/6479b27815afff3cf45e2a1f.json",
"created_at": "2023-06-02 09:12:24 UTC",
"processed_at": "2023-06-02 09:12:24 UTC",
"google_autocomplete_url": "https://www.google.com/complete/search?q=Coffee&gl=us&hl=en&client=gws-wiz-local&pq=Coffee",
"raw_html_file": "https://serpapi.com/searches/7aa6a786ba7778c7/6479b27815afff3cf45e2a1f.html",
"prettify_html_file": "https://serpapi.com/searches/7aa6a786ba7778c7/6479b27815afff3cf45e2a1f.prettify",
"total_time_taken": 0.30
},
"search_parameters": {
"engine": "google_autocomplete",
"q": "Coffee",
"gl": "us",
"hl": "en",
"client": "gws-wiz-local"
},
"suggestions": [
{
"value": "coffee",
"serpapi_link": "https://serpapi.com/search.json?client=gws-wiz-local&engine=google_autocomplete&gl=us&hl=en&q=coffee"
},
{
"value": "coffee near me",
"serpapi_link": "https://serpapi.com/search.json?client=gws-wiz-local&engine=google_autocomplete&gl=us&hl=en&q=coffee+near+me",
"value_highlight": "near me"
},
{
"value": "coffee nearby",
"serpapi_link": "https://serpapi.com/search.json?client=gws-wiz-local&engine=google_autocomplete&gl=us&hl=en&q=coffee+nearby",
"value_highlight": "nearby"
},
...
],
"search_information": {
"autocomplete_results_state": "Showing completion results."
}
}
Example with q: pewdiepie
and gl: au
Changing gl param affects completion results. Here is example for au
.
{
"search_metadata": {
"id": "6058874ede98340020c8e943",
"status": "Success",
"json_endpoint": "https://serpapi.com/searches/bd1194ee7b29e346/6058874ede98340020c8e943.json",
"created_at": "2021-03-22 12:02:22 UTC",
"processed_at": "2021-03-22 12:02:22 UTC",
"google_autocomplete_url": "https://www.google.com/complete/search?q=pewdiepie&gl=au&hl=en&client=chrome",
"raw_html_file": "https://serpapi.com/searches/bd1194ee7b29e346/6058874ede98340020c8e943.html",
"prettify_html_file": "https://serpapi.com/searches/bd1194ee7b29e346/6058874ede98340020c8e943.prettify",
"total_time_taken": 1.21
},
"search_parameters": {
"engine": "google_autocomplete",
"q": "pewdiepie",
"gl": "au",
"hl": "en",
"client": "chrome"
},
"search_information": {
"autocomplete_results_state": "Showing completion results."
},
"suggestions": [
{
"value": "pewdiepie net worth",
"relevance": 1100,
"type": "QUERY",
"serpapi_link": "https://serpapi.com/search.json?engine=google_autocomplete&q=pewdiepie+net+worth"
},
{
"value": "pewdiepie sub count",
"relevance": 601,
"type": "QUERY",
"serpapi_link": "https://serpapi.com/search.json?engine=google_autocomplete&q=pewdiepie+sub+count"
},
{
"value": "pewdiepie merch",
"relevance": 600,
"type": "QUERY",
"serpapi_link": "https://serpapi.com/search.json?engine=google_autocomplete&q=pewdiepie+merch"
},
...
],
"verbatim_relevance": 1300
}
Example with q: pewdiepie
and hl: ja
Changing hl affects completion results in terms of language used.
{
"search_metadata": {
"id": "6058882ede9834002292ab3a",
"status": "Success",
"json_endpoint": "https://serpapi.com/searches/5c2fb9ce14ffbd58/6058882ede9834002292ab3a.json",
"created_at": "2021-03-22 12:06:06 UTC",
"processed_at": "2021-03-22 12:06:06 UTC",
"google_autocomplete_url": "https://www.google.com/complete/search?q=pewdiepie&hl=ja&client=chrome",
"raw_html_file": "https://serpapi.com/searches/5c2fb9ce14ffbd58/6058882ede9834002292ab3a.html",
"prettify_html_file": "https://serpapi.com/searches/5c2fb9ce14ffbd58/6058882ede9834002292ab3a.prettify",
"total_time_taken": 1.04
},
"search_parameters": {
"engine": "google_autocomplete",
"q": "pewdiepie",
"hl": "ja",
"client": "chrome"
},
"search_information": {
"autocomplete_results_state": "Showing completion results."
},
"suggestions": [
{
"value": "pewdiepie net worth",
"relevance": 1000,
"type": "QUERY",
"serpapi_link": "https://serpapi.com/search.json?engine=google_autocomplete&q=pewdiepie+net+worth"
},
{
"value": "pewdiepie なぜ人気",
"relevance": 601,
"type": "QUERY",
"serpapi_link": "https://serpapi.com/search.json?engine=google_autocomplete&q=pewdiepie+なぜ人気"
},
{
"value": "pewdiepie 年収",
"relevance": 600,
"type": "QUERY",
"serpapi_link": "https://serpapi.com/search.json?engine=google_autocomplete&q=pewdiepie+年収"
},
...
],
"verbatim_relevance": 1290
}