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
Search Query
q
Required
Parameter defines the search query. A query that would be used to provide completion options.
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 for a full list of supported Google countries.
hl
Optional
Parameter defines the language to use for the Google search. It's a two-letter lan guage code. (e.g., en
for English, es
for Spanish, or fr
for French) Head to the Google languages for a full list of supported Google languages.
Serpapi Parameters
engine
Required
Set parameter to google_autocomplete
to use the Google Autocomplete API engine.
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.
api_key
Optional
Parameter defines the SerpApi private key to use.
output
Optional
Parameter defines the final output you want. It can be set to json (default) to get a structured JSON
of the results, or html
to get the raw html retrieved.
Advanced Autocomplete Parameters
cp
Optional
Cursor pointer defines the position of cursor for the query provided, position starts from 0 which is a case where cursor is placed before the query |query
. If not provided acts as cursor is placed in the end of query query|
.
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
, verbatimrelevance
, clientdata
.
A search status is accessible through search_metadata.status
. It flows this way: Queued
-> Processing
-> Success
|| Error
. If a search has failed, error
will contain an error message. search_metadata.id
is the search ID inside SerpApi.
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.
Example with q
:"mega"
{
"search_metadata": {
"id": "5ea155a659603d433ae40557",
"status": "Success",
"json_endpoint": "https://serpapi.com/searches/cafb525a81190306/5ea155a659603d433ae40557.json",
"created_at": "2020-04-23 08:45:26 UTC",
"processed_at": "2020-04-23 08:45:26 UTC",
"google_autocomplete_url": "https://www.google.com/complete/search?q=mega&gl=us&hl=en&client=chrome",
"raw_html_file": "https://serpapi.com/searches/cafb525a81190306/5ea155a659603d433ae40557.html",
"total_time_taken": 2.77
},
"search_parameters": {
"engine": "google_autocomplete",
"q": "mega",
"gl": "us",
"hl": "en"
},
"search_information": {
"autocomplete_results_state": "Showing completion results.",
"query_displayed": "mega"
},
"suggestions": [
"mega millions",
"mega millions numbers",
"megan thee stallion",
"megan fox",
"megabus",
"megalodon",
"megamind",
"megans law"
]
}
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": "5ea1b98e59603df674837e66",
"status": "Success",
"json_endpoint": "https://serpapi.com/searches/c780d717d7f3edf2/5ea1b98e59603df674837e66.json",
"created_at": "2020-04-23 15:51:42 UTC",
"processed_at": "2020-04-23 15:51:42 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/c780d717d7f3edf2/5ea1b98e59603df674837e66.html",
"total_time_taken": 1.58
},
"search_parameters": {
"engine": "google_autocomplete",
"q": "t scott",
"cp": "1",
"gl": "us",
"hl": "en"
},
"search_information": {
"autocomplete_results_state": "Showing completion results.",
"query_displayed": "t scott"
},
"suggestions": [
"travis scott",
"travis scott net worth",
"travis scott tour",
"travis scott kylie jenner",
"travis scott instagram",
"tony scott",
"toilet paper scott",
"t scott jones"
]
}
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 1 meaning cursor would take place in the end t t scott|
{
"search_metadata": {
"id": "5ea1b9c459603df675fcad58",
"status": "Success",
"json_endpoint": "https://serpapi.com/searches/31c2f049b01c66bb/5ea1b9c459603df675fcad58.json",
"created_at": "2020-04-23 15:52:36 UTC",
"processed_at": "2020-04-23 15:52:36 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/31c2f049b01c66bb/5ea1b9c459603df675fcad58.html",
"total_time_taken": 2.83
},
"search_parameters": {
"engine": "google_autocomplete",
"q": "t scott",
"cp": "7",
"gl": "us",
"hl": "en"
},
"search_information": {
"autocomplete_results_state": "Showing completion results.",
"query_displayed": "t scott"
},
"suggestions": [
"t scott fortnite",
"t scott jones",
"t scott international",
"t scott ross",
"t scott dunks",
"t scott daniels",
"t scott cunningham",
"t scott jordan 1"
]
}
Example with q
:"pewdiepie" and client
:"chrome"
Changing client
param might affect completion results. Here is example for chrome
.
{
"search_metadata": {
"id": "5ea1be3e59603df677fd235e",
"status": "Success",
"json_endpoint": "https://serpapi.com/searches/09f88031a8680673/5ea1be3e59603df677fd235e.json",
"created_at": "2020-04-23 16:11:42 UTC",
"processed_at": "2020-04-23 16:11:42 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/09f88031a8680673/5ea1be3e59603df677fd235e.html",
"total_time_taken": 5.55
},
"search_parameters": {
"engine": "google_autocomplete",
"q": "pewdiepie",
"gl": "us",
"hl": "en",
"client": "chrome"
},
"search_information": {
"autocomplete_results_state": "Showing completion results.",
"query_displayed": "pewdiepie"
},
"suggestions": [
"pewdiepie net worth",
"pewdiepie merch",
"pewdiepie chair",
"pewdiepie height",
"pewdiepie twitter",
"pewdiepie sub count",
"pewdiepie age",
"pewdiepie headphones"
]
}
Example with q
:"pewdiepie" and client
:"safari"
Changing client
param might affect completion results. Here is example for safari
.
{
"search_metadata": {
"id": "5ea1be3359603df677fd235d",
"status": "Success",
"json_endpoint": "https://serpapi.com/searches/9426346d815ee390/5ea1be3359603df677fd235d.json",
"created_at": "2020-04-23 16:11:31 UTC",
"processed_at": "2020-04-23 16:11:31 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/9426346d815ee390/5ea1be3359603df677fd235d.html",
"total_time_taken": 2.52
},
"search_parameters": {
"engine": "google_autocomplete",
"q": "pewdiepie",
"gl": "us",
"hl": "en",
"client": "safari"
},
"search_information": {
"autocomplete_results_state": "Showing completion results.",
"query_displayed": "pewdiepie"
},
"suggestions": [
"pewdiepie",
"pewdiepie net worth",
"pewdiepie merch",
"pewdiepie chair",
"pewdiepie height",
"pewdiepie gaming chair",
"pewdiepie twitter",
"pewdiepie sub count",
"pewdiepie age",
"pewdiepie headphones"
]
}
Example with q
:"pewdiepie" and gl
:"au"
Changing gl
param affects completion results. Here is example for au
.
{
"search_metadata": {
"id": "5ea2b00159603d44701950ca",
"status": "Success",
"json_endpoint": "https://serpapi.com/searches/d2ad7c1ef5e8b8f0/5ea2b00159603d44701950ca.json",
"created_at": "2020-04-24 09:23:13 UTC",
"processed_at": "2020-04-24 09:23:13 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/d2ad7c1ef5e8b8f0/5ea2b00159603d44701950ca.html",
"total_time_taken": 2.76
},
"search_parameters": {
"engine": "google_autocomplete",
"q": "pewdiepie",
"gl": "au",
"hl": "en",
"client": "chrome"
},
"search_information": {
"autocomplete_results_state": "Showing completion results.",
"query_displayed": "pewdiepie"
},
"suggestions": [
"pewdiepie merch",
"pewdiepie net worth",
"pewdiepie chair",
"pewdiepie height",
"pewdiepie twitter",
"pewdiepie minecraft",
"pewdiepie age",
"pewdiepie reddit"
]
}
Example with q
:"pewdiepie" and hl
:"ja"
Changing hl
affects completion results in terms of language used.
{
"search_metadata": {
"id": "5ea2b07659603d446f11a8b3",
"status": "Success",
"json_endpoint": "https://serpapi.com/searches/bac52fa36d52a6ec/5ea2b07659603d446f11a8b3.json",
"created_at": "2020-04-24 09:25:10 UTC",
"processed_at": "2020-04-24 09:25:10 UTC",
"google_autocomplete_url": "https://www.google.com/complete/search?q=pewdiepie&hl=ja&client=chrome",
"raw_html_file": "https://serpapi.com/searches/bac52fa36d52a6ec/5ea2b07659603d446f11a8b3.html",
"total_time_taken": 5.73
},
"search_parameters": {
"engine": "google_autocomplete",
"q": "pewdiepie",
"hl": "ja",
"client": "chrome"
},
"search_information": {
"autocomplete_results_state": "Showing completion results.",
"query_displayed": "pewdiepie"
},
"suggestions": [
"pewdiepie net worth",
"pewdiepie japan",
"pewdiepie twitter",
"pewdiepie 日本",
"pewdiepie 年収",
"pewdiepie 意味",
"pewdiepie instagram",
"pewdiepie razer nari ultimate"
]
}
Search Query
q
Required
Parameter defines the search query. A query that would be used to provide completion options.
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 for a full list of supported Google countries.
hl
Optional
Parameter defines the language to use for the Google search. It's a two-letter lan guage code. (e.g., en
for English, es
for Spanish, or fr
for French) Head to the Google languages for a full list of supported Google languages.
Serpapi Parameters
engine
Required
Set parameter to google_autocomplete
to use the Google Autocomplete API engine.
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.
api_key
Optional
Parameter defines the SerpApi private key to use.
output
Optional
Parameter defines the final output you want. It can be set to json (default) to get a structured JSON
of the results, or html
to get the raw html retrieved.
Advanced Autocomplete Parameters
cp
Optional
Cursor pointer defines the position of cursor for the query provided, position starts from 0 which is a case where cursor is placed before the query |query
. If not provided acts as cursor is placed in the end of query query|
.
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
, verbatimrelevance
, clientdata
.
A search status is accessible through search_metadata.status
. It flows this way: Queued
-> Processing
-> Success
|| Error
. If a search has failed, error
will contain an error message. search_metadata.id
is the search ID inside SerpApi.
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.

Example with q
:"mega"
{
"search_metadata": {
"id": "5ea155a659603d433ae40557",
"status": "Success",
"json_endpoint": "https://serpapi.com/searches/cafb525a81190306/5ea155a659603d433ae40557.json",
"created_at": "2020-04-23 08:45:26 UTC",
"processed_at": "2020-04-23 08:45:26 UTC",
"google_autocomplete_url": "https://www.google.com/complete/search?q=mega&gl=us&hl=en&client=chrome",
"raw_html_file": "https://serpapi.com/searches/cafb525a81190306/5ea155a659603d433ae40557.html",
"total_time_taken": 2.77
},
"search_parameters": {
"engine": "google_autocomplete",
"q": "mega",
"gl": "us",
"hl": "en"
},
"search_information": {
"autocomplete_results_state": "Showing completion results.",
"query_displayed": "mega"
},
"suggestions": [
"mega millions",
"mega millions numbers",
"megan thee stallion",
"megan fox",
"megabus",
"megalodon",
"megamind",
"megans law"
]
}
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": "5ea1b98e59603df674837e66",
"status": "Success",
"json_endpoint": "https://serpapi.com/searches/c780d717d7f3edf2/5ea1b98e59603df674837e66.json",
"created_at": "2020-04-23 15:51:42 UTC",
"processed_at": "2020-04-23 15:51:42 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/c780d717d7f3edf2/5ea1b98e59603df674837e66.html",
"total_time_taken": 1.58
},
"search_parameters": {
"engine": "google_autocomplete",
"q": "t scott",
"cp": "1",
"gl": "us",
"hl": "en"
},
"search_information": {
"autocomplete_results_state": "Showing completion results.",
"query_displayed": "t scott"
},
"suggestions": [
"travis scott",
"travis scott net worth",
"travis scott tour",
"travis scott kylie jenner",
"travis scott instagram",
"tony scott",
"toilet paper scott",
"t scott jones"
]
}
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 1 meaning cursor would take place in the end t t scott|
{
"search_metadata": {
"id": "5ea1b9c459603df675fcad58",
"status": "Success",
"json_endpoint": "https://serpapi.com/searches/31c2f049b01c66bb/5ea1b9c459603df675fcad58.json",
"created_at": "2020-04-23 15:52:36 UTC",
"processed_at": "2020-04-23 15:52:36 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/31c2f049b01c66bb/5ea1b9c459603df675fcad58.html",
"total_time_taken": 2.83
},
"search_parameters": {
"engine": "google_autocomplete",
"q": "t scott",
"cp": "7",
"gl": "us",
"hl": "en"
},
"search_information": {
"autocomplete_results_state": "Showing completion results.",
"query_displayed": "t scott"
},
"suggestions": [
"t scott fortnite",
"t scott jones",
"t scott international",
"t scott ross",
"t scott dunks",
"t scott daniels",
"t scott cunningham",
"t scott jordan 1"
]
}
Example with q
:"pewdiepie" and client
:"chrome"
Changing client
param might affect completion results. Here is example for chrome
.
{
"search_metadata": {
"id": "5ea1be3e59603df677fd235e",
"status": "Success",
"json_endpoint": "https://serpapi.com/searches/09f88031a8680673/5ea1be3e59603df677fd235e.json",
"created_at": "2020-04-23 16:11:42 UTC",
"processed_at": "2020-04-23 16:11:42 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/09f88031a8680673/5ea1be3e59603df677fd235e.html",
"total_time_taken": 5.55
},
"search_parameters": {
"engine": "google_autocomplete",
"q": "pewdiepie",
"gl": "us",
"hl": "en",
"client": "chrome"
},
"search_information": {
"autocomplete_results_state": "Showing completion results.",
"query_displayed": "pewdiepie"
},
"suggestions": [
"pewdiepie net worth",
"pewdiepie merch",
"pewdiepie chair",
"pewdiepie height",
"pewdiepie twitter",
"pewdiepie sub count",
"pewdiepie age",
"pewdiepie headphones"
]
}
Example with q
:"pewdiepie" and client
:"safari"
Changing client
param might affect completion results. Here is example for safari
.
{
"search_metadata": {
"id": "5ea1be3359603df677fd235d",
"status": "Success",
"json_endpoint": "https://serpapi.com/searches/9426346d815ee390/5ea1be3359603df677fd235d.json",
"created_at": "2020-04-23 16:11:31 UTC",
"processed_at": "2020-04-23 16:11:31 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/9426346d815ee390/5ea1be3359603df677fd235d.html",
"total_time_taken": 2.52
},
"search_parameters": {
"engine": "google_autocomplete",
"q": "pewdiepie",
"gl": "us",
"hl": "en",
"client": "safari"
},
"search_information": {
"autocomplete_results_state": "Showing completion results.",
"query_displayed": "pewdiepie"
},
"suggestions": [
"pewdiepie",
"pewdiepie net worth",
"pewdiepie merch",
"pewdiepie chair",
"pewdiepie height",
"pewdiepie gaming chair",
"pewdiepie twitter",
"pewdiepie sub count",
"pewdiepie age",
"pewdiepie headphones"
]
}
Example with q
:"pewdiepie" and gl
:"au"
Changing gl
param affects completion results. Here is example for au
.
{
"search_metadata": {
"id": "5ea2b00159603d44701950ca",
"status": "Success",
"json_endpoint": "https://serpapi.com/searches/d2ad7c1ef5e8b8f0/5ea2b00159603d44701950ca.json",
"created_at": "2020-04-24 09:23:13 UTC",
"processed_at": "2020-04-24 09:23:13 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/d2ad7c1ef5e8b8f0/5ea2b00159603d44701950ca.html",
"total_time_taken": 2.76
},
"search_parameters": {
"engine": "google_autocomplete",
"q": "pewdiepie",
"gl": "au",
"hl": "en",
"client": "chrome"
},
"search_information": {
"autocomplete_results_state": "Showing completion results.",
"query_displayed": "pewdiepie"
},
"suggestions": [
"pewdiepie merch",
"pewdiepie net worth",
"pewdiepie chair",
"pewdiepie height",
"pewdiepie twitter",
"pewdiepie minecraft",
"pewdiepie age",
"pewdiepie reddit"
]
}
Example with q
:"pewdiepie" and hl
:"ja"
Changing hl
affects completion results in terms of language used.
{
"search_metadata": {
"id": "5ea2b07659603d446f11a8b3",
"status": "Success",
"json_endpoint": "https://serpapi.com/searches/bac52fa36d52a6ec/5ea2b07659603d446f11a8b3.json",
"created_at": "2020-04-24 09:25:10 UTC",
"processed_at": "2020-04-24 09:25:10 UTC",
"google_autocomplete_url": "https://www.google.com/complete/search?q=pewdiepie&hl=ja&client=chrome",
"raw_html_file": "https://serpapi.com/searches/bac52fa36d52a6ec/5ea2b07659603d446f11a8b3.html",
"total_time_taken": 5.73
},
"search_parameters": {
"engine": "google_autocomplete",
"q": "pewdiepie",
"hl": "ja",
"client": "chrome"
},
"search_information": {
"autocomplete_results_state": "Showing completion results.",
"query_displayed": "pewdiepie"
},
"suggestions": [
"pewdiepie net worth",
"pewdiepie japan",
"pewdiepie twitter",
"pewdiepie 日本",
"pewdiepie 年収",
"pewdiepie 意味",
"pewdiepie instagram",
"pewdiepie razer nari ultimate"
]
}