# Google Trends API in Python: Interest Over Time Example (https://www.socialcrawl.dev/blog/google-trends-api-python)
> Call a Google Trends API from Python with one GET and an API key. Get interest over time and related queries as JSON, with params, credits and error cases.
To use a Google Trends API from Python, send one GET request with an API key. With SocialCrawl, `GET /v1/google_trends/explore` returns interest over time for up to five keywords, and `GET /v1/google_trends/rising` returns the rising and top related queries for one keyword. Each call is 5 credits, and there is no SDK, no OAuth and no scraping.
Google [announced a Trends API alpha](https://developers.google.com/search/blog/2025/07/trends-api) in July 2025, with access limited to applicants, so there is no public key to sign up for. [pytrends](https://pypi.org/project/pytrends/) is the unofficial library many Python projects used instead, but its [repository](https://github.com/GeneralMills/pytrends) was archived read-only in April 2025. This API gives you the same kind of data over plain HTTP. For provider choice and pricing, see [best Google Trends APIs](/blog/best-google-trends-apis-2026).
## How do you get Google Trends interest over time in Python?
Call `GET /v1/google_trends/explore` with `keywords` (one to five, comma-separated), an optional `location` and an optional `timeframe`. The response holds a dated `series` for each keyword and an `averages` list, all on Google's relative 0 to 100 index. It is not search volume.
```python
BASE = "https://www.socialcrawl.dev"
r = requests.get(
f"{BASE}/v1/google_trends/explore",
params={
"keywords": "oat milk,almond milk,soy milk",
"location": "US",
"timeframe": "past_12_months",
},
headers={"x-api-key": os.environ["SOCIALCRAWL_API_KEY"]},
timeout=90,
)
r.raise_for_status()
payload = r.json()
for row in payload["data"]["averages"]:
print(row["keyword"], row["value"])
```
The same request in curl:
```bash
curl -s --max-time 90 -H "x-api-key: $SOCIALCRAWL_API_KEY" \
"https://www.socialcrawl.dev/v1/google_trends/explore?keywords=oat%20milk,almond%20milk,soy%20milk&location=US&timeframe=past_12_months"
```
The response, trimmed to one point per series:
```json
{
"success": true,
"data": {
"averages": [
{ "keyword": "oat milk", "value": 51 },
{ "keyword": "almond milk", "value": 68 },
{ "keyword": "soy milk", "value": 24 }
],
"series": [
{
"keyword": "oat milk",
"points": [{ "date": "2026-08-30", "value": 60, "partial": true }]
}
]
},
"credits_used": 5
}
```
Chart these numbers with care.
- **Put every term you want to compare in one call.** With several keywords the values are normalised across the set: the highest point of any keyword in the window is 100 and everything else is relative to it. Two separate calls are not comparable.
- **Drop the last point.** `partial: true` marks a bucket Google is still accumulating, normally the most recent one. Left in, it looks like a drop in interest that never happened.
- **The index is not a volume.** Google publishes no absolute search counts, so a value of 68 does not mean 68 searches. [Google's own explanation](https://support.google.com/trends/answer/4365533) says a point is a share of searches in that place and window, scaled to 100.
## What parameters does the Google Trends explore endpoint take?
`explore` takes `keywords`, `timeframe`, `location` and `category`. Only `keywords` is required. Each keyword must be 2 to 100 characters, and more than five is rejected with a free 400.
| Parameter | What it accepts |
| --- | --- |
| `keywords` | 1 to 5 comma-separated terms |
| `location` | An ISO country code (`US`, `KR`), a full name (`South Korea`) or a numeric code (`2840`) |
| `timeframe` | `past_hour`, `past_4_hours`, `past_day`, `past_7_days`, `past_30_days`, `past_90_days`, `past_12_months` (default), `past_5_years` |
| `category` | A numeric Google Trends category code. The default `0` means all categories |
`timeframe` is a fixed list of presets, so there is no arbitrary date range. Short windows change the granularity: `past_hour` and `past_4_hours` return minute-level points and `past_5_years` returns weekly ones, so do not assume a fixed spacing when you plot.
`category` helps with ambiguous terms. "Jaguar" in the automotive category and "jaguar" overall are two different series. For Korean demand, pair it with [`/v1/naver/search-trend`](/docs/naver), since much Korean search happens on Naver.
## How do you get Google Trends related queries from an API?
Call `GET /v1/google_trends/rising` with one `keyword`. It returns two lists: `rising` queries with a percentage `growth`, and `top` queries with a 0 to 100 `value`. Use `top` to see where demand sits now, and `rising` to see what is breaking out before it moves the main series.
```python
r = requests.get(
f"{BASE}/v1/google_trends/rising",
params={
"keyword": "solid state battery",
"location": "US",
"timeframe": "past_12_months",
},
headers={"x-api-key": os.environ["SOCIALCRAWL_API_KEY"]},
timeout=90,
)
r.raise_for_status()
data = r.json()["data"]
for row in data["rising"]:
print(row["query"], row["growth"], row.get("is_breakout"))
for row in data["top"]:
print(row["query"], row["value"])
```
Trimmed response:
```json
{
"data": {
"rising": [
{ "query": "example query one", "growth": 650, "is_breakout": false },
{ "query": "example query two", "growth": null, "is_breakout": true }
],
"top": [
{ "query": "example top query", "value": 100 }
]
},
"credits_used": 5
}
```
A rising row with `is_breakout: true` is a query Google labels "Breakout", which means growth above +5,000%. When Google gives no percentage for it, `growth` is null. Do not fill in a number for it.
The parameter is `keyword`, singular, because Google returns related queries for one term at a time. A comma-separated list is a free 400. The usual order is `explore` first to size the series, then `rising` on the winner.
## What do Google Trends API errors mean?
Two errors are common and both cost nothing. A `404` means Google holds too little search volume for that keyword in that place and window. A `400` means a parameter was not recognised, most often the `location`. Neither is a timeout.
```json
{
"success": false,
"error": {
"type": "RESOURCE_NOT_FOUND",
"message": "No search-interest data were returned for this keyword. ... You were not charged for this request.",
"status": 404
},
"credits_used": 0
}
```
For a `404`, try a wider `timeframe`, a broader keyword, or the keyword in the local language of the location. If you send several keywords, the call still succeeds as long as one of them has data. For a `400`, check the `location` first: it must be an ISO code, a country name as Google Trends spells it, or a numeric code, and Google does not publish every country. The full list of error types is in [error handling](/docs/errors).
Set a client timeout of at least 60 seconds for `explore` and `rising`. Repeat calls inside the 2-minute cache return immediately at no charge.
## What about trending searches with no keyword?
`GET /v1/google_trends/trending` returns the Trending Now list for a country or region, with no keyword in. It is 5 credits and returns each trend's search volume bucket, increase percentage, start time, categories and up to three news articles. Use it when a keyword would bias what you find.
```bash
curl "https://www.socialcrawl.dev/v1/google_trends/trending?location=DE&hours=24&sort=search_volume&limit=25" \
-H "x-api-key: YOUR_API_KEY"
```
`search_volume` is the lower bound of Google's bucket, so `50000` means 50K or more. Google covers 125 countries and has no worldwide list.
## How do you start using the Google Trends API from Python?
Sign up, copy a key from the dashboard, and send it in the `x-api-key` header. New accounts start with 100 free credits, which covers 20 calls at 5 credits each. Authentication details are in [Authentication](/docs/authentication). Field-by-field detail for all three endpoints is in the [Google Trends docs](/docs/google_trends), and you can try the same call in the [explorer](/explorer) before writing code.
## Frequently asked questions
### Is there an official Google Trends API?
Google announced a Trends API alpha in July 2025, available to a limited group of testers who apply for access. It is not a public REST API you can sign up for with a key. SocialCrawl offers a public `x-api-key` GET that returns the same kind of 0 to 100 series.
### How do I get Google Trends data in Python without pytrends?
Send a GET request with `requests` to `/v1/google_trends/explore` and an `x-api-key` header, then read `data.series` and `data.averages` from the JSON. No SDK and no browser session is needed.
### How do I get Google Trends related queries?
Call `GET /v1/google_trends/rising` with a single `keyword`. The response has a `rising` list with percentage growth and a `top` list with a 0 to 100 value. Each call is 5 credits.
### Why can't I compare two separate Google Trends calls?
Each request is normalised to its own window, so the 100 in one call is not the 100 in another. To compare terms, put all of them, up to five, in one `explore` call.
### Does the Google Trends API return search volume?
No. Google publishes only a relative 0 to 100 index, and neither `explore` nor `rising` returns an absolute count. The Trending Now endpoint returns a volume bucket, which is a lower bound such as 50K or more.
### What happens when a keyword has no data?
The API returns a `404` at 0 credits instead of a billed empty series. Try a wider timeframe, a broader keyword, or the term in the local language of the location.