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.

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 use autocomplete feature on the Google Trends website and copy the encoded query to our Google Trends 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 - Country
REGION - Subregion
DMA - Metro
CITY - 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 time zone: -07:00). Value is shown in minutes and can span from -1439 to 1439. tz parameter 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 Search
news - News Search
froogle - Google Shopping
youtube - YouTube Search

date

Optional

Parameter is used to define a date. Available options:

now 1-H - Past hour
now 4-H - Past 4 hours
now 1-d - Past day
now 7-d - Past 7 days
today 1-m - Past 30 days
today 3-m - Past 90 days
today 12-m - Past 12 months
today 5-y - Past 5 years
all - 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.

csv

Optional

Parameter is used for retrieving the CSV results. Set the parameter to true to retrieve CSV results as an array.

Serpapi Parameters

engine

Required

Set parameter to google_trends to use the Google Trends API engine.

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_key

Required

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.

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.

Interest over time chart with q: coffee,milk,bread,pasta,steak and data_type: TIMESERIES

Interest over time chart with q: coffee,milk,bread,pasta,steak and data_type: TIMESERIES

JSON Example

{
  "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",
        "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",
        "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",
        "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

Compared breakdown by region chart with q: coffee,milk,bread,pasta,steak and data_type: GEO_MAP

JSON Example

{
  "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

Interest by region chart with q: coffee and data_type: GEO_MAP_0

JSON Example

{
  "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
    },
    ...
  ]
}

Related topics chart with q: coffee and data_type: RELATED_TOPICS

Related topics chart with q: coffee and data_type: RELATED_TOPICS

JSON Example

{
  "search_metadata": {
    "id": "628e148bde983400a3b29c2f",
    "status": "Success",
    "json_endpoint": "https://serpapi.com/searches/15f6e17aed843e35/628e148bde983400a3b29c2f.json",
    "created_at": "2022-05-25 11:35:39 UTC",
    "processed_at": "2022-05-25 11:35:39 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/628e148bde983400a3b29c2f.html",
    "prettify_html_file": "https://serpapi.com/searches/15f6e17aed843e35/628e148bde983400a3b29c2f.prettify",
    "total_time_taken": 1.92
  },
  "search_parameters": {
    "engine": "google_trends",
    "q": "coffee",
    "date": "today 12-m",
    "tz": "420",
    "data_type": "RELATED_TOPICS"
  },
  "related_topics": {
    "rising": [
      {
        "topic": {
          "value": "/g/11qrhc4zy2",
          "title": "Coffee and lemon",
          "type": "Food"
        },
        "value": "+2,300%",
        "extracted_value": 2300,
        "link": "https://trends.google.com/trends/explore?q=/g/11qrhc4zy2&date=today+12-m",
        "serpapi_link": "https://serpapi.com/search.json?data_type=RELATED_TOPICS&date=today+12-m&engine=google_trends&q=/g/11qrhc4zy2&tz=420"
      },
      {
        "topic": {
          "value": "/m/09k_b",
          "title": "Lemon",
          "type": "Fruit"
        },
        "value": "+450%",
        "extracted_value": 450,
        "link": "https://trends.google.com/trends/explore?q=/m/09k_b&date=today+12-m",
        "serpapi_link": "https://serpapi.com/search.json?data_type=RELATED_TOPICS&date=today+12-m&engine=google_trends&q=/m/09k_b&tz=420"
      },
      {
        "topic": {
          "value": "/m/0cp66xy",
          "title": "Tata Coffee",
          "type": "Company"
        },
        "value": "+80%",
        "extracted_value": 80,
        "link": "https://trends.google.com/trends/explore?q=/m/0cp66xy&date=today+12-m",
        "serpapi_link": "https://serpapi.com/search.json?data_type=RELATED_TOPICS&date=today+12-m&engine=google_trends&q=/m/0cp66xy&tz=420"
      },
      ...
    ],
    "top": [
      {
        "topic": {
          "value": "/m/02vqfm",
          "title": "Coffee",
          "type": "Drink"
        },
        "value": "100",
        "extracted_value": 100,
        "link": "https://trends.google.com/trends/explore?q=/m/02vqfm&date=today+12-m",
        "serpapi_link": "https://serpapi.com/search.json?data_type=RELATED_TOPICS&date=today+12-m&engine=google_trends&q=/m/02vqfm&tz=420"
      },
      {
        "topic": {
          "value": "/m/020fb2",
          "title": "Cafe",
          "type": "Topic"
        },
        "value": "12",
        "extracted_value": 12,
        "link": "https://trends.google.com/trends/explore?q=/m/020fb2&date=today+12-m",
        "serpapi_link": "https://serpapi.com/search.json?data_type=RELATED_TOPICS&date=today+12-m&engine=google_trends&q=/m/020fb2&tz=420"
      },
      {
        "topic": {
          "value": "/m/07xyvk",
          "title": "Coffeemaker",
          "type": "Topic"
        },
        "value": "10",
        "extracted_value": 10,
        "link": "https://trends.google.com/trends/explore?q=/m/07xyvk&date=today+12-m",
        "serpapi_link": "https://serpapi.com/search.json?data_type=RELATED_TOPICS&date=today+12-m&engine=google_trends&q=/m/07xyvk&tz=420"
      },
      ...
    ]
  }
}

Related queries chart with q: coffee and data_type: RELATED_QUERIES

Related queries chart with q: coffee and data_type: RELATED_QUERIES

JSON Example

{
  "search_metadata": {
    "id": "628e1571de983400a5961ce1",
    "status": "Success",
    "json_endpoint": "https://serpapi.com/searches/15f6e17aed843e35/628e1571de983400a5961ce1.json",
    "created_at": "2022-05-25 11:39:29 UTC",
    "processed_at": "2022-05-25 11:39:29 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/628e1571de983400a5961ce1.html",
    "prettify_html_file": "https://serpapi.com/searches/15f6e17aed843e35/628e1571de983400a5961ce1.prettify",
    "total_time_taken": 1.84
  },
  "search_parameters": {
    "engine": "google_trends",
    "q": "coffee",
    "date": "today 12-m",
    "tz": "420",
    "data_type": "RELATED_QUERIES"
  },
  "related_queries": {
    "rising": [
      {
        "query": "coffee and lemon for weight loss",
        "value": "+4,200%",
        "extracted_value": 4200,
        "link": "https://trends.google.com/trends/explore?q=coffee+and+lemon+for+weight+loss&date=today+12-m",
        "serpapi_link": "https://serpapi.com/search.json?data_type=RELATED_QUERIES&date=today+12-m&engine=google_trends&q=coffee+and+lemon+for+weight+loss&tz=420"
      },
      {
        "query": "takeout coffee nearby",
        "value": "+2,750%",
        "extracted_value": 2750,
        "link": "https://trends.google.com/trends/explore?q=takeout+coffee+nearby&date=today+12-m",
        "serpapi_link": "https://serpapi.com/search.json?data_type=RELATED_QUERIES&date=today+12-m&engine=google_trends&q=takeout+coffee+nearby&tz=420"
      },
      {
        "query": "maca coffee",
        "value": "+1,900%",
        "extracted_value": 1900,
        "link": "https://trends.google.com/trends/explore?q=maca+coffee&date=today+12-m",
        "serpapi_link": "https://serpapi.com/search.json?data_type=RELATED_QUERIES&date=today+12-m&engine=google_trends&q=maca+coffee&tz=420"
      },
      ...
    ],
    "top": [
      {
        "query": "coffee near me",
        "value": "100",
        "extracted_value": 100,
        "link": "https://trends.google.com/trends/explore?q=coffee+near+me&date=today+12-m",
        "serpapi_link": "https://serpapi.com/search.json?data_type=RELATED_QUERIES&date=today+12-m&engine=google_trends&q=coffee+near+me&tz=420"
      },
      {
        "query": "the coffee",
        "value": "86",
        "extracted_value": 86,
        "link": "https://trends.google.com/trends/explore?q=the+coffee&date=today+12-m",
        "serpapi_link": "https://serpapi.com/search.json?data_type=RELATED_QUERIES&date=today+12-m&engine=google_trends&q=the+coffee&tz=420"
      },
      {
        "query": "coffee shop",
        "value": "80",
        "extracted_value": 80,
        "link": "https://trends.google.com/trends/explore?q=coffee+shop&date=today+12-m",
        "serpapi_link": "https://serpapi.com/search.json?data_type=RELATED_QUERIES&date=today+12-m&engine=google_trends&q=coffee+shop&tz=420"
      },
      ...
    ]
  }
}