Google Trends guides · Updated 2026-11-09
Google Trends API in Python: your options in 2026
There is still no open, official Google Trends API. Here is what works today, what broke, and which option fits which job.
pip install pytrends-next and change the import; pytrends itself is archived. For many keywords, schedules or servers in the cloud, use a hosted service that rotates sessions, or apply for Google's official alpha if your use case qualifies.The options
| Option | Status (Oct 2026) | Good for | Watch out for |
|---|---|---|---|
| pytrends | Archived. Last release 4.9.2 (April 2023) | Existing notebooks, small one-off pulls | 429 errors, broken trending_searches(), no fixes |
| pytrends-next | Maintained by us, 0.1.0 (October 2026), MIT | Existing pytrends code: same TrendReq API, change the import | Calls the website endpoints from your IP, so heavy use still hits 429 (retries help, an optional paid fallback exists) |
| trendspy | Unofficial, last release 0.1.6 (December 2024) | A newer unofficial client, suggested by the former pytrends maintainer | Same rate limits, since it calls the same website endpoints from your IP |
| Official Google Trends API | Alpha since July 2025, approved testers only | Consistently scaled data you can append over time, 5 years, region breakdowns | No open sign-up, no related queries or Trending now |
| Hosted scraper, for example our Apify Actor | Maintained | Many keywords, schedules, cloud servers, Trending now | Pay per result |
1. pytrends (still the most copied code)
from pytrends.request import TrendReq
pt = TrendReq(hl="en-US", tz=0, retries=3, backoff_factor=1)
pt.build_payload(["coffee", "tea"], timeframe="today 12-m", geo="US")
df = pt.interest_over_time() # DataFrame: date index, one column per term, isPartial
regions = pt.interest_by_region() # one row per US state
related = pt.related_queries() # {"coffee": {"top": df, "rising": df}, ...}
If this starts failing with 429, read pytrends 429 error: why it happens and how to fix it.
2. pytrends-next (maintained drop-in replacement)
pytrends-next keeps the pytrends API and DataFrame shapes, needs only the standard library (pandas optional), and retries 429, 403 and 5xx with a new session and exponential backoff. Source: ctriolab/google-trends-python.
pip install "pytrends-next[pandas]"
from pytrends_next.request import TrendReq # the only change from pytrends
pt = TrendReq(hl="en-US", tz=0)
pt.build_payload(["coffee", "tea"], timeframe="today 12-m", geo="US")
df = pt.interest_over_time()
related = pt.related_queries()
trending = pt.trending_now(geo="US", hours=24) # new: Trending now rows with volume and categories
Not ported: top_charts() (Google removed it) and multirange_interest_over_time(). Related topics are often empty because Google hides them from automated clients. If Google keeps answering 429, TrendReq(fallback="apify", apify_token=...) sends those calls to the hosted Actor below and returns the same shape. It is off by default and billed to your Apify account.
3. Hosted: same data, no rate-limit handling on your side
The older single-file client gtrends.py in google-trends-python is standard library only. It calls our Google Trends Scraper through the Apify API and returns plain Python objects, or a pytrends-shaped DataFrame.
import gtrends # export APIFY_TOKEN=... (free Apify account)
df = gtrends.interest_over_time_df(["coffee", "tea"], geo="US", timeframe="today 12-m")
regions = gtrends.interest_by_region("coffee", geo="US")[0]["regions"]
related = gtrends.related_queries("coffee", geo="US")["coffee"]["rising"]
trending = gtrends.trending_now(["US", "GB"], hours=24, limit=20)
Or call the Actor directly with the official apify-client package, which is handy for many comparisons in one run:
from apify_client import ApifyClient
client = ApifyClient("YOUR_APIFY_TOKEN")
run = client.actor("ctriolab/google-trends-scraper").call(run_input={
"searchTerms": ["coffee, tea, matcha", "bitcoin, ethereum"], # one comparison per line
"geo": "US", "timeframe": "today 5-y",
"includeRelatedQueries": True,
})
for item in client.dataset(run["defaultDatasetId"]).iterate_items():
print(item["type"], item.get("term"), item.get("average"))
Compare more than 5 keywords on one scale
Google Trends compares at most 5 keywords at once, so put up to 50 on one line and the Actor matches them through a shared anchor term onto a single 0-100 scale. Each keyword still returns one interest-over-time result, with scaledWith and scaleGroup fields showing how it was matched. Pick an anchor of middling popularity: a very large term in the same group can push small terms to 0.
run = client.actor("ctriolab/google-trends-scraper").call(run_input={
"searchTerms": ["python, javascript, java, typescript, golang, rust, kotlin, swift, php, ruby, scala, perl"],
"anchorTerm": "java", # optional, defaults to the first keyword on the line
"geo": "US", "timeframe": "today 12-m",
})
Disclosure: we maintain pytrends-next (free) and make and sell the Google Trends Scraper ($2.00 per 1,000 results on the Apify Free plan, $0.50 to $1.20 on paid plans).
Parameters that work the same everywhere
| Parameter | Values |
|---|---|
timeframe | 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, or YYYY-MM-DD YYYY-MM-DD |
geo | Empty for worldwide, a country (US, KR) or a subregion (US-CA, GB-ENG) |
gprop | Web search (default), images, news, youtube, froogle (Google Shopping) |
cat / category | Google Trends category ID, 0 for all |
FAQ
Does Google have a public Trends API?
Not for everyone. Google launched the Google Trends API as an alpha in July 2025 for a limited group of approved testers. Everyone else uses unofficial clients that read the same data as trends.google.com, or hosted services built on them.
Can I compare more than 5 keywords?
Google Trends compares at most 5 terms on one 0-100 scale. For more, run several comparisons that share one anchor term and rescale them against that anchor. The Google Trends Scraper does this for you: put up to 50 keywords on one line, optionally set anchorTerm, and every keyword comes back on a single 0-100 scale.
Why are my numbers different from trends.google.com?
Values are relative within each request and Google samples the data, so the same query can differ slightly between runs. Make sure geo, timeframe, category, property (web, youtube, news) and timezone match the website.
Related: pytrends 429 error · Google Trending now data