Google Trends Scraper or API: What You Get
A Google Trends scraper is code that sends a keyword, a region and a time window to Google Trends, finds the numbers behind the chart, and turns them into dated rows you can store. The alternative is the Google Trends endpoints, where one call to GET /v1/google-trends/interest returns those rows as JSON for 1 credit. The real difference is upkeep: a scraper is yours to fix, while the endpoint's cost is per keyword per refresh. This post sizes both, item by item.
What is a Google Trends scraper actually collecting?
It collects a short time series per keyword, not a page of text. Each point is a date and a number, and the numbers only make sense next to the other points in the same request. That shapes everything about the build: you're not saving pages, you're saving series, and each series is defined by the keyword, the place and the window you asked for. Change any of the three and you have a different series.
The recorded response shows that shape. This request asks for a year of US interest in tesla:
curl "https://api.perceptlayer.com/v1/google-trends/interest?q=tesla&geo=US&time_range=1y" \
-H "X-API-Key: $API_KEY"
Trimmed to the parts a tracker reads:
{
"search_parameters": {
"keyword": "tesla",
"geo": "US",
"time_range": "today+12-m",
"hl": "en",
"search_type": "web"
},
"timeline_data": [
{
"timestamp": 1760832000,
"date": "Oct 19 – 25, 2025",
"value": 40
},
{
"timestamp": 1761436800,
"date": "Oct 26 – Nov 1, 2025",
"value": 39
},
…
],
"interest_over_time": {
"average": 49.13,
"max_value": 100,
"min_value": 39,
…
},
…
}
Three things in this excerpt matter for a comparison. The request sent time_range=1y and search_parameters echoes it back as today+12-m, so the endpoint records the window it actually used. The timestamp values are 604,800 seconds apart, exactly one week. And no field is a search count: the series runs from min_value: 39 to max_value: 100, with an average of 49.13, so store values as an index and compare them only within one series.
Which parts would you build and maintain yourself?
A scraper for this data has five parts, and each one can fail without an error. You'd translate your inputs into whatever the page expects, fetch it, pull the chart's numbers out of the response, turn the date labels into something sortable, and watch the output for drift. The endpoint covers the first four; the fifth, checking that the data still looks sane, is yours on either route.
| Part | What a scraper has to do | What the endpoint gives you |
|---|---|---|
| Input mapping | Turn keyword, region, window and search type into the page's own request format | q, geo, time_range (1h, 4h, 1d, 7d, 30d, 90d, 1y, 5y, all), hl, search_type (web, images, news, youtube, shopping) |
| Fetching | Send requests at a pace the site tolerates, handle slow or refused responses | One GET; errors come back as a status and a code, and cost 0 credits |
| Extraction | Find the series inside the response and read each point | timeline_data[] with timestamp, date, value |
| Dates | Parse display labels such as week ranges into dates | A Unix timestamp next to each date label |
| Monitoring | Notice when a run returns no points, fewer points or a shifted scale | Still yours: check point counts and max_value per run |
The fetching row is where most scrapers spend their life. Any large site has to separate people from automated traffic, so a job that pulls hundreds of series a day should expect slow responses, refusals and challenge pages. If you hit those, stop rather than reach for rotating proxies or CAPTCHA solvers; working around a site's protections isn't a fix we'd recommend. Read Google's terms before you build a collector of your own.
Extraction is the quiet failure. When a page changes, a scraper often keeps running and writes empty or partial rows, and a series with a missing week looks plausible on a chart. That's why the monitoring row stays on your side whichever route you take.
How do a scraper and the endpoints compare?
For a recurring job, the trade is engineering hours against credits. A scraper has no per-call bill, but it has hosting, a fetch layer you defend and a parser you repair. The endpoints have a per-call cost and nothing to repair on the parsing side. The table assumes a job that refreshes a fixed keyword list on a schedule.
| DIY Google Trends scraper | Google Trends endpoints | |
|---|---|---|
| Setup | Request builder, fetch layer, parser, date handling, storage | API key in the X-API-Key header |
| Series data | Whatever you extract from the page | timeline_data[] and interest_over_time with average, max_value, min_value |
| Other views | A separate parser per view | Interest By Region, Related, Autocomplete and Trending Now, each 1 credit |
| When the page changes | Rows go empty or wrong until you fix it | You read named JSON fields |
| Blocks and challenges | Yours to handle | Not yours; a failed call returns an error code and X-Credits-Used: 0 |
| Throughput | As fast as the site tolerates | 1 request a second free (60 a minute), at least 5 a second paid |
| Cost | Hosting and your time | 1 credit per successful call |
| Audit trail | Whatever you log | search_parameters echoes keyword, geo, window, hl and search_type |
The Region endpoint takes region (REGION or COUNTRY), date, cat, gprop, tz and hl. Related takes the same time_range and search_type values as Interest, with q limited to 100 characters instead of 550. Trending Now needs only geo and adds hours (4, 24, 48 or 168) and sort. The Google Trends API page lists every parameter, and each endpoint page, such as Interest By Region, links to its playground.
What does each tracked keyword cost?
Cost follows refreshes: one series refreshed once is 1 credit, whatever the window. So the cost per tracked keyword is the number of refreshes a month times the endpoints you call for it. The cadence is the lever, and it should match the width of the points. A one-year series has weekly points, so a weekly refresh gets every new point and a daily refresh mostly re-reads weeks you already hold.
| Plan (per keyword) | Calls a month | Credits a month |
|---|---|---|
Interest, 1y, weekly |
4 | 4 |
Interest, 1y, daily |
30 | 30 |
| Interest + Region + Related, weekly | 12 | 12 |
Interest, 7d, daily |
30 | 30 |
Scaled to a list:
- 200 keywords, Interest weekly: 200 × 4 = 800 credits a month, inside the Starter pack's 10,000 for a year.
- 200 keywords, Interest daily: 200 × 30 = 6,000 credits a month, inside the Starter pack's 10,000.
- 500 keywords, all three endpoints weekly: 500 × 12 = 6,000 credits a month, also inside the Starter pack.
- 2,000 keywords, Interest daily: 2,000 × 30 = 60,000 credits a month, past the Build pack's 50,000 and inside the Growth pack's 200,000.
Daily refreshes earn their cost with a short window such as 7d or 1d, where the points are narrower than a week; open the playground to see the point width for the window you pick. Throughput matters too: 2,000 calls at a free account's 60 a minute take about 34 minutes, and at a paid account's 300 a minute about 7. Purchased credits last 12 months. See pricing for what credits cost, and the credits docs for how each call is debited.
How do you check a refreshed series in code?
Store the points you get and check the run before you trust it. The script below calls Interest for a short keyword list, writes each point to SQLite keyed on keyword, geo, window and timestamp, and flags a run that came back with no points. It reads only fields in the recorded response: timeline_data[].timestamp, date, value, and interest_over_time.average and max_value.
import os
import sqlite3
import requests
KEYWORDS = ["tesla"]
GEO, WINDOW = "US", "1y"
db = sqlite3.connect("trends.db")
db.execute(
"""CREATE TABLE IF NOT EXISTS points (
keyword TEXT, geo TEXT, time_range TEXT,
ts INTEGER, label TEXT, value INTEGER,
PRIMARY KEY (keyword, geo, time_range, ts))"""
)
for kw in KEYWORDS:
resp = requests.get(
"https://api.perceptlayer.com/v1/google-trends/interest",
headers={"X-API-Key": os.environ["API_KEY"]},
params={"q": kw, "geo": GEO, "time_range": WINDOW},
timeout=30,
)
resp.raise_for_status()
data = resp.json()
points = data.get("timeline_data", [])
if not points:
print(f"{kw}: no points returned, check before storing")
continue
db.executemany(
"INSERT OR REPLACE INTO points VALUES (?, ?, ?, ?, ?, ?)",
[(kw, GEO, WINDOW, p["timestamp"], p["date"], p["value"]) for p in points],
)
summary = data.get("interest_over_time", {})
print(kw, len(points), "points, average", summary.get("average"),
"max", summary.get("max_value"),
"credits used", resp.headers.get("X-Credits-Used"))
db.commit()
INSERT OR REPLACE matters here. Each refresh returns the whole window again, and the values are relative to that window, so the newest run should overwrite older copies of the same week rather than sit beside them. If you need to compare across windows, keep each time_range as its own series, as the primary key does. Wrap the call with a retry on 429 and 503 that waits for Retry-After; the errors docs list every code.
Which route fits which job?
Pick by how many series you track and how long the job has to run, because those decide whether upkeep or credits dominate. For a few charts you'll look at once, the Google Trends site in a browser is enough, and neither route is worth building.
- A weekly keyword tracker for SEO or content planning: use Interest with
time_range=1yon a weekly schedule. At 4 credits per keyword a month, the 100 free credits on signup cover one refresh of 100 keywords, and the Starter pack's 10,000 covers 200 keywords for a year. - Spotting what's rising today: use Trending Now with
geoandhours=24. A run costs one call, not one per keyword. - Regional demand comparisons: use Interest By Region with
region=REGIONorCOUNTRY, one call per keyword per refresh. - Keyword discovery around a seed term: use Related and Autocomplete; each call is 1 credit and replaces a second parser in a scraper.
- An agent that answers "is interest in X growing?": give it the endpoints through the MCP server, where
search_endpointsandget_endpointare free andcall_endpointspends credits only on success. The AI agents docs cover setup. - A research project that needs a view the endpoints don't return: that's the case for a scraper of your own. Read the terms first, run it slowly, and budget time for the monitoring part.
For related search data, Rank Tracking API: Track Google Positions as JSON covers positions rather than interest, and the search engines APIs page lists the rest. To test your own keywords, run Interest in the playground on the Google Trends API page, then get a free API key when the series looks right.
APIs in this post
Frequently asked questions
Is scraping Google Trends allowed?
That depends on Google's terms and the law where you operate, so read the terms and take legal advice for commercial use. Whatever you decide, don't work around blocks, challenges or other protections. Trend series are aggregate figures rather than personal data, but the terms still govern how you collect them, and the endpoint route doesn't change what you may do with the results.
Are Google Trends values search volumes?
Nothing in the recorded response is a count of searches. The tesla series runs from min_value: 39 to max_value: 100 with an average of 49.13, which reads as an index within that one request. Compare values inside one series, and keep each keyword, geo and time_range combination as a separate series rather than mixing them.
How much does it cost to track 100 keywords?
Each successful call costs 1 credit. 100 keywords on Interest refreshed weekly is 100 × 4 = 400 credits a month; adding Region and Related makes it 100 × 12 = 1,200. The 100 free credits on signup cover one weekly refresh of the 100 keywords. The Starter pack's 10,000 covers the first plan for a year and the second for about eight months. See pricing for what credits cost.
Does a failed Google Trends call cost credits?
No. Only a successful response debits credits. A failed call returns an HTTP status and a JSON body with a code, a message and a request_id, plus X-Credits-Used: 0. Rate-limited (429) and unavailable (503) responses carry Retry-After. A request whose reply your client lost may still have succeeded and been billed.
How fast can a keyword refresh run?
Limits are per account, shared by all its keys, and counted per minute. A free account gets 1 request a second, so 200 keywords take a little over three minutes. Paying accounts run at least 5 a second (300 a minute), and faster rates can be chosen at checkout. The rate limits docs list each pack's rate.