Google Trends API
The Google Trends API lets you retrieve search trend data including interest over time, regional breakdowns, and comparative analyses across up to 5 queries. Each request costs 5 API credits.
Endpoint:
https://api.scrapingdog.com/google_trendsAPI Parameters
π
Authentication
api_keyRequiredYour personal API key. Available on your dashboard
Type: String
π
Request Parameters
queryOptionalThe parameter specifies the query or queries you want to search. You can use any term or topic as you would in a standard Google Trends search.- A maximum of 5 queries can be used per search, but this limit applies only to the "Interest over time" and "Compared breakdown by region" data types. Other data types support only 1 query per search.
- To pass multiple queries, separate them with a comma (
,) (e.g.,coffee,pizza,dark chocolate,/m/027lnzs,bread). - Queries can be either "Search terms" (e.g., Tesla, BYD, Volkswagen) or "Topics" (e.g., /m/0663v, /m/027lnzs, /g/11mw8j71m4).
- Each query can be up to 100 characters long.
data_typeOptionalThe parameter specifies the type of search to perform.TIMESERIESβ Interest over time (default). Supports single or multiple queries.GEO_MAPβ Compared breakdown by region. Multiple queries only.GEO_MAP_0β Interest by region. Single query only.
geoOptionalThe parameter specifies the location from which the search originates. By default, it is set to Worldwide if thegeoparameter is not provided or left empty. For a complete list of supported locations, refer to Google Trends Locations
Type: StringregionOptionalThe region parameter allows you to obtain more specific results for the "Compared Breakdown by Region" and "Interest by Region" data types only.COUNTRYβ Country levelREGIONβ Subregion levelDMAβ Metro levelCITYβ City level
Type: StringlanguageOptionalLanguage of the results. Possible values:en,es,fr,de, etc. Default:en
Type: StringdateOptionalThis parameter specifies the date range for the search.
Predefined options:now 1-H,now 4-H,now 1-d,now 7-d,today 1-m,today 3-m,today 12-m,today 5-y,all
Custom range:yyyy-mm-dd yyyy-mm-ddoryyyy-mm-ddThh yyyy-mm-ddThhfor hourly precision (within a one-week window)
Type: StringcatOptionalThis parameter specifies the search category. Default:0(All categories)
Type: StringgpropOptionalThis parameter determines how results are sorted based on the selected property. Default: Web Search.imagesβ Image Searchnewsβ News Searchfroogleβ Google Shoppingyoutubeβ YouTube Search
tzOptionalThis parameter specifies the time zone offset. The default value is420minutes (PDT: -07:00). Ranges from-1439to1439.
Examples:420(PDT),600(Pacific/Tahiti),-540(Asia/Tokyo),-480(Canada/Pacific)
Type: String
API Examples
Code to Integrate
curl "https://api.scrapingdog.com/google_trends?api_key=APIKEY&query=pizza,burger&data_type=TIMESERIES"
import requests url = "https://api.scrapingdog.com/google_trends" params = { "api_key": "APIKEY", "query": "pizza,burger", "data_type": "TIMESERIES" } response = requests.get(url, params=params) if response.status_code == 200: print(response.json())
const axios = require('axios'); const params = { api_key: 'APIKEY', query: 'pizza,burger', data_type: 'TIMESERIES', }; axios.get('https://api.scrapingdog.com/google_trends', { params }) .then(response => console.log(response.data)) .catch(error => console.error(error.message));
<?php $url = 'https://api.scrapingdog.com/google_trends/?' . http_build_query([ 'api_key' => 'APIKEY', 'query' => 'pizza,burger', 'data_type' => 'TIMESERIES', ]); $ch = curl_init($url); curl_setopt($ch, CURLOPT_RETURNTRANSFER, true); $response = curl_exec($ch); curl_close($ch); echo $response;
require 'net/http' require 'uri' url = URI.parse("https://api.scrapingdog.com/google_trends/") url.query = URI.encode_www_form( 'api_key' => 'APIKEY', 'query' => 'pizza,burger', 'data_type' => 'TIMESERIES' ) http = Net::HTTP.new(url.host, url.port) http.use_ssl = true puts http.request(Net::HTTP::Get.new(url)).body
import java.io.*; import java.net.*; public class Main { public static void main(String[] args) throws Exception { String apiUrl = "https://api.scrapingdog.com/google_trends/?api_key=APIKEY&query=pizza,burger&data_type=TIMESERIES"; URL url = new URL(apiUrl); HttpURLConnection conn = (HttpURLConnection) url.openConnection(); conn.setRequestMethod("GET"); BufferedReader reader = new BufferedReader(new InputStreamReader(conn.getInputStream())); String line; while ((line = reader.readLine()) != null) System.out.println(line); conn.disconnect(); } }
API Response
{
"interest_over_time": {
"timeline_data": [
{
"date": "Dec 17 β 23, 2023",
"timestamp": "1702771200",
"values": [
{"query": "pizza", "value": 88, "extracted_value": "88"},
{"query": "burger", "value": 25, "extracted_value": "25"}
]
},
{
"date": "Dec 24 β 30, 2023",
"timestamp": "1703376000",
"values": [
{"query": "pizza", "value": 100, "extracted_value": "100"},
{"query": "burger", "value": 28, "extracted_value": "28"}
]
}
]
}
}