Google Trends API
Pull historical and current search popularity data from Google Trends. Set engine=google_trends, pass one or more terms in q, and optionally scope the request with geo, date, and cat.
Endpoint
Section titled “Endpoint” GET https://serp.shifter.io/v1?engine=google_trends&api_key=YOUR_API_KEY
Parameters
Section titled “Parameters”| Parameter | Type | Required | Description |
|---|---|---|---|
api_key | string | yes | Your SERP API key |
engine | string | yes | Must be google_trends |
q | string | yes | The search term(s). Multiple terms can be comma-separated |
geo | string | no | Location code. Defaults to worldwide. See the geo parameter options list |
region | string | no | country, city, subregion, or metro. Applies to compared_breakdown_by_region |
date | string | no | YYYY-MM-DD YYYY-MM-DD range, or one of now 1-H, now 4-H, now 1-d, now 7-d, today 1-m, today 3-m, today 5-y, all |
cat | string | no | Category ID. See the categories list |
Example request
Section titled “Example request”curl "https://serp.shifter.io/v1?engine=google_trends&api_key=YOUR_API_KEY&geo=US&q=american%20football&date=2021-01-01%202022-01-01"import requests
params = { "engine": "google_trends", "api_key": "YOUR_API_KEY", "geo": "US", "q": "american football", "date": "2021-01-01 2022-01-01",}r = requests.get("https://serp.shifter.io/v1", params=params)data = r.json()import fetch from 'node-fetch';
const url = 'https://serp.shifter.io/v1?' + new URLSearchParams({ engine: 'google_trends', api_key: 'YOUR_API_KEY', geo: 'US', q: 'american football', date: '2021-01-01 2022-01-01',});const data = await (await fetch(url)).json();Example response
Section titled “Example response”{ "search_parameters": { "engine": "google_trends", "q": "american football", "geo": "US", "date": "2021-01-01 2022-01-01" }, "interest_over_time": { "timeline_data": [ { "date": "Jan 3 - 9, 2021", "timestamp": "1609632000", "values": [ { "query": "american football", "value": "100", "extracted_value": 100 } ] } ], "averages": [ { "query": "american football", "value": 68 } ] }, "interest_by_region": [ { "geo": "US-FL", "location": "Florida", "value": "100" } ], "related_queries": { "top": [ { "query": "nfl scores", "value": "100" } ], "rising": [ { "query": "nfl playoffs", "value": "Breakout" } ] }}