Google Trends Autocomplete API
Our Google Trends Autocomplete API allows you to scrape suggested searches from the Google Trends search page. The API is accessed through the following endpoint: /search?engine=google_trends_autocomplete
.
A user may query the following: https://serpapi.com/search?engine=google_trends_autocomplete
utilizing a GET
request. Head to the playground for a live and interactive demo.
API Parameters
Localization
hl
Optional
Parameter defines the language to use for the Google Trends 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_trends_autocomplete
to use the Google Trends Autocomplete API engine.
no_cache
Optional
Parameter will force SerpApi to fetch the Google Trends 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 suggested searches.
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
HTML output is useful to debug JSON results or support features not supported yet by SerpApi. HTML output gives you the raw HTML results from Google Trends.
This API does not have html response, just a text. search_metadata.prettify_html_file
contains prettified version of the result. It is displayed in the playground.
API Examples
Example with q: Stripe
{
"search_metadata": {
"id": "62cc0e6bde983400ad34aa10",
"status": "Success",
"json_endpoint": "https://serpapi.com/searches/35e2720c05f9fe48/62cc0e6bde983400ad34aa10.json",
"created_at": "2022-07-11 11:50:03 UTC",
"processed_at": "2022-07-11 11:50:03 UTC",
"google_trends_autocomplete_url": "https://trends.google.com/trends/api/autocomplete/Stripe?hl=en",
"raw_html_file": "https://serpapi.com/searches/35e2720c05f9fe48/62cc0e6bde983400ad34aa10.html",
"prettify_html_file": "https://serpapi.com/searches/35e2720c05f9fe48/62cc0e6bde983400ad34aa10.prettify",
"total_time_taken": 0.85
},
"search_parameters": {
"engine": "google_trends_autocomplete",
"q": "Stripe",
"hl": "en"
},
"suggestions": [
{
"q": "Stripe",
"title": "Stripe",
"type": "Search term",
"link": "https://trends.google.com/trends/explore?q=Stripe",
"serpapi_link": "https://serpapi.com/search.json?data_type=TIMESERIES&date=today+12-m&engine=google_trends&q=Stripe&tz=420"
},
{
"q": "/m/0h3qnb8",
"title": "Stripe, Inc.",
"type": "Company",
"link": "https://trends.google.com/trends/explore?q=/m/0h3qnb8",
"serpapi_link": "https://serpapi.com/search.json?data_type=TIMESERIES&date=today+12-m&engine=google_trends&q=%2Fm%2F0h3qnb8&tz=420"
},
{
"q": "/g/1217c9tz",
"title": "Stripe",
"type": "Pattern",
"link": "https://trends.google.com/trends/explore?q=/g/1217c9tz",
"serpapi_link": "https://serpapi.com/search.json?data_type=TIMESERIES&date=today+12-m&engine=google_trends&q=%2Fg%2F1217c9tz&tz=420"
},
{
"q": "/m/06gwss",
"title": "Skipjack tuna",
"type": "Fish",
"link": "https://trends.google.com/trends/explore?q=/m/06gwss",
"serpapi_link": "https://serpapi.com/search.json?data_type=TIMESERIES&date=today+12-m&engine=google_trends&q=%2Fm%2F06gwss&tz=420"
},
{
"q": "/m/02w59b",
"title": "C.D. Guadalajara",
"type": "Football club",
"link": "https://trends.google.com/trends/explore?q=/m/02w59b",
"serpapi_link": "https://serpapi.com/search.json?data_type=TIMESERIES&date=today+12-m&engine=google_trends&q=%2Fm%2F02w59b&tz=420"
},
{
"q": "/m/03h3tkj",
"title": "Pin-stripe calathea",
"type": "Plant",
"link": "https://trends.google.com/trends/explore?q=/m/03h3tkj",
"serpapi_link": "https://serpapi.com/search.json?data_type=TIMESERIES&date=today+12-m&engine=google_trends&q=%2Fm%2F03h3tkj&tz=420"
}
]
}