Google Trends API
Our Google Trends API allows you to scrape results from the Google Trends search page. The API is accessed through the following endpoint: /search?engine=google_trends
.
A user may query the following: https://serpapi.com/search?engine=google_trends
utilizing a GET
request. Head to the playground for a live and interactive demo.
API Parameters
Search Query
q
Required
Parameter defines the query or queries you want to search. You can use anything that you would use in a regular Google Trends search. The maximum number of queries per search is 5
(this only applies to "Interest over time" and "Compared breakdown by region" data_type, other types of data will only accept 1
query per search).
When passing multiple queries you need to use a comma (,
) to separate them (e.g. coffee,pizza,dark chocolate,/m/027lnzs,bread
).
Query can be a "Search term" (e.g. World Cup
, Eminem
, iPhone
, etc.) or a "Topic" (e.g. /m/0663v
, /m/027lnzs
, /g/11mw8j71m4
, etc.). Queries that are "Topics" are encoded. To retrieve these values you can use our Google Trends Autocomplete API.
Geographic Location
geo
Optional
Parameter defines the location from where you want the search to originate. It defaults to Worldwide
(activated when the value of geo parameter is not set or empty). Head to the Google Trends Locations for a full list of supported Google Trends locations.
region
Optional
Parameter is used for getting more specific results when using "Compared breakdown by region" and "Interest by region" data_type charts. Other data_type charts do not accept region parameter. The default value depends on the geo location that is set. Available options:COUNTRY
- CountryREGION
- SubregionDMA
- MetroCITY
- City
Not all region options will return results for every geo location.
Search Type
data_type
Optional
Parameter defines the type of search you want to do. Available options:TIMESERIES
- Interest over time (default) - Accepts both single and multiple queries per search.GEO_MAP
- Compared breakdown by region - Accepts only multiple queries per search.GEO_MAP_0
- Interest by region - Accepts only single query per search.RELATED_TOPICS
- Related topics - Accepts only single query per search.RELATED_QUERIES
- Related queries - Accepts only single query per search.
Advanced Google Trends Parameters
tz
Optional
Parameter is used to define a time zone. The default value is set to 420
(Pacific Day Time(PDT): -07:00). Value is shown in minutes and can span from -1439
to 1439
.
tz can be calculated using the time difference between UTC +0 and desired timezone.
Example: 60 x ((Time in UTC+0 Now) - (Time in PDT Now)) = 420
will give results for PDT now. Because the reference point is UTC+0, the positive time zones will result in negative tz whereas negative time zones will result in positive tz.
tz parameter also affects timestamps in response.
cat
Optional
Parameter is used to define a search category. The default value is set to 0
("All categories"). Head to the Google Trends Categories for a full list of supported Google Trends Categories.
gprop
Optional
Parameter is used for sorting results by property. The default property is set to Web Search
(activated when the value of gprop parameter is not set or empty). Other available options:images
- Image Searchnews
- News Searchfroogle
- Google Shoppingyoutube
- YouTube Search
date
Optional
Parameter is used to define a date. Available options:now 1-H
- Past hournow 4-H
- Past 4 hoursnow 1-d
- Past daynow 7-d
- Past 7 daystoday 1-m
- Past 30 daystoday 3-m
- Past 90 daystoday 12-m
- Past 12 monthstoday 5-y
- Past 5 yearsall
- 2004 - present
You can also pass custom values:
Dates from 2004 to present: yyyy-mm-dd yyyy-mm-dd
(e.g. 2021-10-15 2022-05-25
)
Dates with hours within a week range: yyyy-mm-ddThh yyyy-mm-ddThh
(e.g. 2022-05-19T10 2022-05-24T22
). Hours will be calculated depending on the tz (time zone) parameter.
Serpapi Parameters
no_cache
Optional
Parameter will force SerpApi to fetch the Google Trends 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.
API Results
JSON Results
JSON output includes structured data for Interest over time, Compared breakdown by region, Interest by region, Related queries and Related topics.
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
Interest over time chart with q: coffee,milk,bread,pasta,steak
and data_type: TIMESERIES

{
"search_metadata": {
"id": "628e1083de983400a3b29c2e",
"status": "Success",
"json_endpoint": "https://serpapi.com/searches/c1bde9cbd0a44437/628e1083de983400a3b29c2e.json",
"created_at": "2022-05-25 11:18:27 UTC",
"processed_at": "2022-05-25 11:18:27 UTC",
"google_trends_url": "https://trends.google.com/trends/api/explore?tz=420&req=%7B%22comparisonItem%22%3A%5B%7B%22keyword%22%3A%22coffee%22%2C%22geo%22%3A%22%22%2C%22time%22%3A%22today+12-m%22%7D%2C%7B%22keyword%22%3A%22milk%22%2C%22geo%22%3A%22%22%2C%22time%22%3A%22today+12-m%22%7D%2C%7B%22keyword%22%3A%22bread%22%2C%22geo%22%3A%22%22%2C%22time%22%3A%22today+12-m%22%7D%2C%7B%22keyword%22%3A%22pasta%22%2C%22geo%22%3A%22%22%2C%22time%22%3A%22today+12-m%22%7D%2C%7B%22keyword%22%3A%22steak%22%2C%22geo%22%3A%22%22%2C%22time%22%3A%22today+12-m%22%7D%5D%2C%22category%22%3A0%2C%22property%22%3A%22%22%7D",
"raw_html_file": "https://serpapi.com/searches/c1bde9cbd0a44437/628e1083de983400a3b29c2e.html",
"prettify_html_file": "https://serpapi.com/searches/c1bde9cbd0a44437/628e1083de983400a3b29c2e.prettify",
"total_time_taken": 1.89
},
"search_parameters": {
"engine": "google_trends",
"q": "coffee,milk,bread,pasta,steak",
"date": "today 12-m",
"tz": "420",
"data_type": "TIMESERIES"
},
"interest_over_time": {
"timeline_data": [
{
"date": "May 30 – Jun 5, 2021",
"timestamp": "1622304000",
"values": [
{
"query": "coffee",
"value": "80",
"extracted_value": 80
},
{
"query": "milk",
"value": "58",
"extracted_value": 58
},
{
"query": "bread",
"value": "35",
"extracted_value": 35
},
...
]
},
{
"date": "Jun 6 – 12, 2021",
"timestamp": "1622822400",
"values": [
{
"query": "coffee",
"value": "75",
"extracted_value": 75
},
{
"query": "milk",
"value": "54",
"extracted_value": 54
},
{
"query": "bread",
"value": "35",
"extracted_value": 35
},
...
]
},
{
"date": "Jun 13 – 19, 2021",
"timestamp": "1623513600",
"values": [
{
"query": "coffee",
"value": "78",
"extracted_value": 78
},
{
"query": "milk",
"value": "54",
"extracted_value": 54
},
{
"query": "bread",
"value": "35",
"extracted_value": 35
},
...
]
},
...
],
"averages": [
{
"query": "coffee",
"value": 84
},
{
"query": "milk",
"value": 55
},
{
"query": "bread",
"value": 39
},
...
]
}
}
Compared breakdown by region chart with q: coffee,milk,bread,pasta,steak
and data_type: GEO_MAP

{
"search_metadata": {
"id": "628e1291de983400a5961cdc",
"status": "Success",
"json_endpoint": "https://serpapi.com/searches/c1bde9cbd0a44437/628e1291de983400a5961cdc.json",
"created_at": "2022-05-25 11:27:13 UTC",
"processed_at": "2022-05-25 11:27:14 UTC",
"google_trends_url": "https://trends.google.com/trends/api/explore?tz=420&req=%7B%22comparisonItem%22%3A%5B%7B%22keyword%22%3A%22coffee%22%2C%22geo%22%3A%22%22%2C%22time%22%3A%22today+12-m%22%7D%2C%7B%22keyword%22%3A%22milk%22%2C%22geo%22%3A%22%22%2C%22time%22%3A%22today+12-m%22%7D%2C%7B%22keyword%22%3A%22bread%22%2C%22geo%22%3A%22%22%2C%22time%22%3A%22today+12-m%22%7D%2C%7B%22keyword%22%3A%22pasta%22%2C%22geo%22%3A%22%22%2C%22time%22%3A%22today+12-m%22%7D%2C%7B%22keyword%22%3A%22steak%22%2C%22geo%22%3A%22%22%2C%22time%22%3A%22today+12-m%22%7D%5D%2C%22category%22%3A0%2C%22property%22%3A%22%22%7D",
"raw_html_file": "https://serpapi.com/searches/c1bde9cbd0a44437/628e1291de983400a5961cdc.html",
"prettify_html_file": "https://serpapi.com/searches/c1bde9cbd0a44437/628e1291de983400a5961cdc.prettify",
"total_time_taken": 1.73
},
"search_parameters": {
"engine": "google_trends",
"q": "coffee,milk,bread,pasta,steak",
"date": "today 12-m",
"tz": "420",
"data_type": "GEO_MAP"
},
"compared_breakdown_by_region": [
{
"geo": "SG",
"location": "Singapore",
"max_value_index": 0,
"values": [
{
"query": "coffee",
"value": "43%",
"extracted_value": 43
},
{
"query": "milk",
"value": "25%",
"extracted_value": 25
},
{
"query": "bread",
"value": "16%",
"extracted_value": 16
},
...
]
},
{
"geo": "IT",
"location": "Italy",
"max_value_index": 3,
"values": [
{
"query": "coffee",
"value": "5%",
"extracted_value": 5
},
{
"query": "milk",
"value": "3%",
"extracted_value": 3
},
{
"query": "bread",
"value": "2%",
"extracted_value": 2
},
...
]
},
{
"geo": "AU",
"location": "Australia",
"max_value_index": 0,
"values": [
{
"query": "coffee",
"value": "38%",
"extracted_value": 38
},
{
"query": "milk",
"value": "21%",
"extracted_value": 21
},
{
"query": "bread",
"value": "17%",
"extracted_value": 17
},
...
]
},
...
]
}
Interest by region chart with q: coffee
and data_type: GEO_MAP_0

{
"search_metadata": {
"id": "628e13d2de983400a5961cdf",
"status": "Success",
"json_endpoint": "https://serpapi.com/searches/15f6e17aed843e35/628e13d2de983400a5961cdf.json",
"created_at": "2022-05-25 11:32:34 UTC",
"processed_at": "2022-05-25 11:32:34 UTC",
"google_trends_url": "https://trends.google.com/trends/api/explore?tz=420&req=%7B%22comparisonItem%22%3A%5B%7B%22keyword%22%3A%22coffee%22%2C%22geo%22%3A%22%22%2C%22time%22%3A%22today+12-m%22%7D%5D%2C%22category%22%3A0%2C%22property%22%3A%22%22%7D",
"raw_html_file": "https://serpapi.com/searches/15f6e17aed843e35/628e13d2de983400a5961cdf.html",
"prettify_html_file": "https://serpapi.com/searches/15f6e17aed843e35/628e13d2de983400a5961cdf.prettify",
"total_time_taken": 1.85
},
"search_parameters": {
"engine": "google_trends",
"q": "coffee",
"date": "today 12-m",
"tz": "420",
"data_type": "GEO_MAP_0"
},
"interest_by_region": [
{
"geo": "SG",
"location": "Singapore",
"max_value_index": 0,
"value": "100",
"extracted_value": 100
},
{
"geo": "AU",
"location": "Australia",
"max_value_index": 0,
"value": "87",
"extracted_value": 87
},
{
"geo": "NZ",
"location": "New Zealand",
"max_value_index": 0,
"value": "77",
"extracted_value": 77
},
...
]
}