Skip to content
Tidewell Software
Google Trends API

Google Trends API in Python

Interest over time, by region and rising related queries for up to 5 keywords, as JSON.

Steps

  1. Get an API token. Apify Console → Settings → API & Integrations. Export it as APIFY_TOKEN.
  2. Install the client. pip install apify-client
  3. Write the comparison. Comma-separated terms in one string share one 0–100 scale, up to 5.
  4. Run the actor. Call tidewell/google-trends-api; one row per term comes back.
  5. Load into pandas. Each row's interestOverTime is a list of dated points.

Input

input.json
{"searchTerms": ["chatgpt, claude"], "geo": "GB", "timeframe": "today 3-m"}

Run it

run.py
import os

from apify_client import ApifyClient
import pandas as pd

client = ApifyClient(os.environ["APIFY_TOKEN"])
run = client.actor("tidewell/google-trends-api").call(run_input={
    "searchTerms": ["chatgpt, claude"],
    "geo": "GB",
    "timeframe": "today 3-m"
})

rows = list(client.dataset(run["defaultDatasetId"]).iterate_items())
df = pd.DataFrame({r["searchTerm"]: {p["date"]: p["value"] for p in r["interestOverTime"]} for r in rows})
print(df.tail())
print(rows[0]["relatedQueriesRising"][:5])

Output

Run on 9 November 2026: 2 search terms, $0.006 at list price.

Dataset row (trimmed)
{
  "type": "searchTerm",
  "searchTerm": "chatgpt",
  "comparedWith": ["claude"],
  "geo": "GB",
  "timeframe": "today 3-m",
  "hasData": true,
  "averageInterest": 67,
  "peakInterest": 100,
  "peakDate": "2026-09-03",
  "latestInterest": 58,
  "latestDate": "2026-11-08",
  "interestOverTime": [
    {"date": "2026-08-09", "value": 53, "isPartial": false},
    {"date": "2026-08-10", "value": 72, "isPartial": false}
  ],
  "interestByRegion": [
    {"geoCode": "GB-ENG", "geoName": "England", "value": 100},
    {"geoCode": "GB-NIR", "geoName": "Northern Ireland", "value": 81}
  ],
  "relatedQueriesTop": [
    {"rank": 1, "query": "openai", "value": 100},
    {"rank": 2, "query": "ai chatgpt", "value": 83}
  ],
  "relatedQueriesRising": [
    {
      "rank": 1,
      "query": "chatgpt astra",
      "value": 2850,
      "formattedValue": "+2,850%",
      "isBreakout": false
    },
    {
      "rank": 2,
      "query": "chatgpt dots",
      "value": 400,
      "formattedValue": "+400%",
      "isBreakout": false
    }
  ],
  "exploreUrl": "https://trends.google.com/trends/explore?q=chatgpt,claude&date=today%203-m&geo=GB",
  "scrapedAt": "2026-11-09T19:56:46Z"
}

Options

timeframe
now 1-H to all, e.g. today 5-y; or customTimeframe
geo
Country or region code, e.g. US, GB-SCT; empty for worldwide
property
Web, news, images, youtube or froogle (Shopping)
outputFormat
long gives one row per data point, for spreadsheets

Use it from Claude or ChatGPT

Apify MCP server, this actor only
https://mcp.apify.com/?tools=tidewell/google-trends-api
Claude
Settings → Connectors → Add custom connector. Paste the URL, sign in to Apify
Claude Code
claude mcp add apify "https://mcp.apify.com/?tools=tidewell/google-trends-api" -t http
ChatGPT
Add a custom MCP server with the URL and OAuth
Then ask
Use tidewell/google-trends-api to compare 'chatgpt, claude' in the UK over the last 3 months and list the rising queries.

FAQ

Does Google Trends have an API?

Not one that's generally available. An official Trends API has been in limited alpha since 2025. The actor reads the same public data the Trends website shows.

Will the numbers match trends.google.com?

Usually. Google samples its data, so values can move a few points between requests. Each row has an exploreUrl for the same view.

Pricing

Pay per event, from the actor's live pricing on 9 November 2026.

Price
$0.003 per search term with data. $0.001 per Trending Now row. No start fee.
Free
Terms with no data, failed comparisons
Product page
Google Trends API