# Google Trends API - pytrends Alternative, Trends as JSON (`alom/google-trends-api`) Actor

Google Trends as a real-time HTTP API and pytrends alternative: one GET request returns interest over time, by region and related queries as JSON, or what is trending now with search volume. No 429s to handle, no run to start.

- **URL**: https://apify.com/alom/google-trends-api.md
- **Developed by:** [Alom Dev](https://apify.com/alom) (community)
- **Categories:** SEO tools, Developer tools, Agents
- **Features:** Limited permissions, Multi-tenant, Server interface
- **Stats:** 1 total users, 0 monthly users, 0.0% runs succeeded, 0 bookmarks
- **User rating**: No ratings yet

## Pricing

from $5.00 / 1,000 api requests

This Actor is paid per event. You are not charged for the Apify platform usage, but only a fixed price for specific events.
Since this Actor supports Apify Store discounts, the price gets lower the higher subscription plan you have.

Learn more: https://docs.apify.com/actors/store.md#pay-per-event

## What's an Apify Actor?

An Actor is a serverless cloud program that runs on the Apify platform. It has two run modes.
In Batch mode, an Actor accepts a well-defined JSON input, performs an action which can take anything from a few seconds to a few hours,
and optionally produces a well-defined JSON output, datasets with results, or files in key-value store.
In Standby mode, an Actor provides a web server which can be used as a website, API, or an MCP server.

Apify vocabulary and the platform model are defined once, in the agent quickstart at https://apify.com/agents.md.

## How to integrate an Actor?

If asked about integration, you help developers integrate Actors into their projects.
You adapt to their stack and deliver integrations that are safe, well-documented, and production-ready.

Do not guess an integration path. Every one of them is in the agent quickstart at https://apify.com/agents.md: the Apify MCP server, Agent Skills with the Apify CLI, the JavaScript and Python clients, the REST API, and the account-free path for an agent with no human to sign in. It also carries the rule on stating cost before the first paid run.

For examples already wired to this Actor's own input schema, see the [API](#api) section below.

Each client library has reference documentation the quickstart does not restate: [JavaScript/TypeScript](https://docs.apify.com/api/client/js/docs.md) (`npm install apify-client`) and [Python](https://docs.apify.com/api/client/python/docs.md) (`pip install apify-client`).

# README

## Google Trends API

**Google Trends as a real-time HTTP API, and a pytrends alternative without 429 errors to handle.** One GET request
returns interest over time, interest by region and related queries as JSON, or what is trending right now with search
volume. No run to start, no browser, no retry code on your side.

```bash
curl -H "Authorization: Bearer $APIFY_TOKEN" \
  "https://alom--google-trends-api.apify.actor/explore?q=bitcoin,ethereum&geo=US&time=today%205-y"
```

| Endpoint | Returns |
|---|---|
| `GET /explore?q=coffee,tea&geo=US` | One comparison of up to 5 terms: interest over time, by state, city and US metro, related queries and topics, plus a summary (peak, trend direction, winner) |
| `POST /explore` | Up to 5 comparisons in one request (`{"queries": ["bitcoin,ethereum", "solana"]}`) |
| `GET /trending?geo=US,GB&hours=24` | What is trending now in up to 5 countries or US states: search volume, growth, start time, related searches and news |

- **Who it is for:** SEO and content tools, market research, dashboards and AI agents that need Google Trends data on
  demand. The pytrends library was archived in 2025 and often fails with 429 errors; here Google's rate limits are handled
  for you, on fresh IPs.
- **pytrends parameter names work:** `kw_list`, `timeframe`, `geo`, `cat`, `gprop`.
- **What it costs:** $0.005 per request plus $1.50 per 1,000 Explore results or $0.20 per 1,000 trending topics (less
  on higher Apify plans). One comparison costs $0.0065 on the Free plan, a list of 50 trending topics $0.015. Failed
  requests are free.
- **Prefer scheduled runs, Google Sheets input or CSV exports?** The same data comes as
  [Google Trends Scraper](https://apify.com/alom/google-trends-scraper) runs.

### Quick start

1. Get your Apify API token: [Console → Settings → API & Integrations](https://console.apify.com/settings/integrations).
2. Call an endpoint with the token in the `Authorization` header (or `?token=` in the URL, which is less safe).
3. Read `results` (or `trends`) from the JSON reply.

**Python (replacing pytrends)**

```python
import os, requests

API = "https://alom--google-trends-api.apify.actor"
headers = {"Authorization": f"Bearer {os.environ['APIFY_TOKEN']}"}

## pytrends: TrendReq().build_payload(kw_list=["pizza", "sushi"], timeframe="today 3-m", geo="US")
r = requests.get(f"{API}/explore", headers=headers, timeout=300,
                 params={"kw_list": "pizza,sushi", "timeframe": "today 3-m", "geo": "US"})
result = r.json()["results"][0]
for point in result["interestOverTime_timelineData"]:
    print(point["formattedTime"], point["value"])          # interest_over_time()
print(result["interestBySubregion"][:5])                   # interest_by_region()
print(result["relatedQueries_rising"][:5])                 # related_queries()
```

**JavaScript**

```js
const API = 'https://alom--google-trends-api.apify.actor';
const res = await fetch(`${API}/trending?geo=US&hours=24&sort=volume&max=20`, {
    headers: { Authorization: `Bearer ${process.env.APIFY_TOKEN}` },
});
const { trends } = await res.json();
for (const t of trends) console.log(t.rank, t.title, t.searchVolumeFormatted, t.increasePercentage);
```

`GET /` returns a short description of the endpoints. The **Server** tab of this Actor in Apify Console has the
OpenAPI description and a request builder.

### Parameters

**/explore**

| Parameter | What it does |
|---|---|
| `q` (or `kw_list`) | Search terms, comma-separated: one comparison of up to 5. POST: `queries`, a list of up to 5 comparisons |
| `geo` | `US`, `US-CA`, `GB-ENG`, ...; empty = worldwide |
| `time` (or `timeframe`) | `now 1-H`, `now 4-H`, `now 1-d`, `now 7-d`, `today 1-m`, `today 3-m`, `today 12-m` (default), `today 5-y`, `all`, or `2024-01-01 2024-12-31` |
| `category` (or `cat`) | Numeric Google Trends category id; 0 = all |
| `property` (or `gprop`) | `web` (default), `images`, `news`, `shopping`, `youtube` |
| `related` | `false` skips related queries and topics (faster) |
| `regions` | `false` returns only the main region breakdown, without cities and US metros |
| `normalize` | `true` puts more than 5 terms (up to 20) on one 0-100 scale; `anchor` sets the reference term |
| `daily` | `true` returns daily points for ranges longer than Google gives daily (up to 10 years) |
| `verifyRelated` | `true` cross-checks related queries on a second IP (slower) |

**/trending**

| Parameter | What it does |
|---|---|
| `geo` | Up to 5 countries or US states, comma-separated. Default `US` |
| `hours` | `4`, `24` (default), `48` or `168` |
| `category` | Category ids or names, e.g. `Sports,Technology` |
| `active` | `true` keeps only topics that are still trending |
| `minVolume` | Only topics with at least this many searches |
| `sort` | `relevance` (default), `volume`, `recency`, `growth` |
| `max` | Topics per location, 1–500. Default 50 |
| `news` | `false` skips the news articles and pictures |
| `onlyNew` + `monitorName` | Only topics this monitor has not returned before (see below) |

### Reply

```json
{
  "ok": true,
  "count": 1,
  "results": [
    {
      "searchTerm": "coffee,tea",
      "interestOverTime_timelineData": [
        { "time": "1764374400", "formattedTime": "Nov 29 – Dec 5, 2025", "value": [78, 21], "hasData": [true, true] }
      ],
      "interestBySubregion": [{ "geoCode": "US-WA", "geoName": "Washington", "value": [83, 17] }],
      "relatedQueries_top": [{ "query": "coffee near me", "value": 100 }],
      "summary": [
        { "term": "coffee", "peakValue": 100, "average": 75.4, "trendDirection": "flat" },
        { "term": "tea", "peakValue": 27, "average": 21.2, "trendDirection": "flat" }
      ],
      "winner": "coffee",
      "geo": "US",
      "timeRange": "today 12-m",
      "trendsUrl": "https://trends.google.com/trends/explore?date=today+12-m&q=coffee,tea&geo=US"
    }
  ],
  "notices": [],
  "charged": { "api-request": 1, "api-query": 1 },
  "durationMs": 14035
}
```

Every result has the same fields as a [Google Trends Scraper](https://apify.com/alom/google-trends-scraper) row: the
timeline, `interestBy` / `interestBySubregion` / `interestByCity` / `interestByMetro`, related queries and topics (top
and rising, with breakouts), and the summary. `/trending` answers with `trends`: `title`, `rank`, `searchVolume`,
`increasePercentage`, `startedAt`, `isActive`, `categories`, `relatedQueries`, `news` and `exploreUrl`.

| Status | Meaning | Charged |
|---|---|---|
| 200 | Data found. `notices` names anything that was skipped | One request + one per result or topic |
| 400 | Bad parameters (unknown time range, more than 5 terms, ...); `error` says what to fix | No |
| 402 | Apify did not accept the charge (credit or limits) | No data returned |
| 502 | Google Trends did not answer; try again in a minute | No |

A request that takes longer than 20 seconds gets its `200` status line right away, and then spaces until its JSON
follows, so slow connections are not dropped on the way. In that case the real status is in the body as `status`,
next to `ok`: check `ok` rather than the HTTP status.

### Trending Now alerts: only new topics

Add `onlyNew=true&monitorName=us-news` to `/trending` and each request returns only topics that monitor hasn't returned
before. Call it every hour from cron, n8n, Make or Zapier. Each Apify user has their own monitors. A check with nothing
new costs one request fee ($0.005).

### How it works and its limits

- Google Trends' own data endpoints over plain HTTP, on datacenter IPs; residential IPs only when Google blocks those.
  When Google answers "429 too many requests", the request is retried on a fresh IP for you.
- **Speed (measured):** an Explore comparison usually takes 10–35 seconds (about 10 with `related=false`); Trending
  Now takes 2–5 seconds per location. If the endpoint has been idle, the first request also waits a few seconds while
  it starts.
- Up to 5 comparisons or locations per request, and up to 8 extra Google comparisons for `normalize` / `daily`. A
  request still working after 100 seconds returns what it found so far.
- Google Trends numbers are relative (0–100 per chart), not search counts. Trending Now volumes are Google's rounded
  buckets (`200K+`).
- Not here: Google Sheets input and CSV exports. Use [Google Trends Scraper](https://apify.com/alom/google-trends-scraper)
  runs for those.

### Pricing

| | Free plan | Bronze | Silver | Gold and up |
|---|---|---|---|---|
| Per request | $0.005 | $0.005 | $0.005 | $0.005 |
| Per 1,000 Explore results | $1.50 | $1.00 | $0.75 | $0.50 |
| Per 1,000 trending topics | $0.20 | $0.15 | $0.12 | $0.10 |
| Per extra comparison (`normalize`, `daily`) | $0.003 | $0.003 | $0.003 | $0.003 |

Examples on the Free plan: one comparison of 2 terms = $0.0065; 3 comparisons in one POST = $0.0095; 50 trending topics
\= $0.015; 12 terms on one scale = $0.0125. Failed requests (400, 502) are not charged. Runs started from the input form
instead of the API are priced like Google Trends Scraper runs.

### FAQ

**Is it a drop-in pytrends replacement?** The parameter names are the same and the data is the same, but it is an HTTP
call instead of a Python library: one `requests.get` returns everything pytrends gets with `interest_over_time`,
`interest_by_region` and `related_queries`.

**Can I use it from an AI agent?** Yes. Add `https://mcp.apify.com/?tools=alom/google-trends-api` as an MCP connector, or
give the agent the OpenAPI description from the Server tab.

**Is it legal?** It reads public Google Trends data that anyone can see without logging in. Check the terms that apply
to your use.

Missing something? Open an issue in the Issues tab.

# Actor input Schema

## `mode` (type: `string`):

<strong>Explore</strong> = the classic Google Trends chart for your search terms. <strong>Trending Now</strong> = the live list of trending searches per country or US state, with search volume, growth and news.

## `searchTerms` (type: `array`):

Terms to look up. Each term becomes one result. Turn on <strong>Compare terms</strong> to put up to 5 comma-separated terms on one chart (e.g. <code>tea, coffee</code>), or <strong>Compare more than 5 terms on one scale</strong> (below) for up to 50.

## `isMultiple` (type: `boolean`):

Treat commas in a search term as separators and compare up to 5 terms on one chart, exactly like typing them into Google Trends.

## `startUrls` (type: `array`):

Or paste Google Trends explore URLs. Their own settings (terms, geo, date, category, property) are used.

## `spreadsheetId` (type: `string`):

Optional: ID of a <strong>public</strong> Google Sheet with one search term per row in the first column (row 1 is a header).

## `timeRange` (type: `string`):

Period to analyse.

## `customTimeRange` (type: `string`):

Overrides the time range. Format: <code>2024-01-01 2024-12-31</code>.

## `geo` (type: `string`):

Country or region code: <code>US</code>, <code>GB</code>, <code>US-CA</code>... Leave empty for Worldwide.

## `category` (type: `string`):

Limit interest to one Google Trends category.

## `property` (type: `string`):

Which Google search to measure: Web, YouTube, News, Images or Shopping.

## `maxItems` (type: `integer`):

Stop after this many results (0 = no limit).

## `extraGeoResolutions` (type: `boolean`):

For a country or region, also return interest by city (and by metro area / DMA for the US). One extra request each.

## `includeRelated` (type: `boolean`):

Top and rising related queries.

## `verifyRelatedQueries` (type: `boolean`):

Fetch related queries from a second independent session and keep only a version both agree on. Slower, more reliable.

## `normalizeAcrossQueries` (type: `boolean`):

Put <strong>all</strong> your search terms (up to 50) on one comparable 0-100 scale, like one big Google Trends chart. Google compares only 5 terms at once, so the terms are fetched in groups of 4 plus a shared <strong>anchor term</strong> and each group is rescaled through the anchor. Terms with the same location, time range, category and search type become <strong>one result</strong>. Raw per-group values are kept in <code>rawValue</code>. City/metro breakdowns are not included in this mode.

## `anchorTerm` (type: `string`):

Term shared by every group when comparing more than 5 terms. Defaults to your first term. Tip: a popular term (your biggest one) gives the most precise scale; a rarely searched anchor makes the result approximate (flagged as <code>lowPrecision</code>). Added to the comparison if it is not one of your terms.

## `dailyStitching` (type: `boolean`):

Google gives daily points only for ranges up to ~9 months. Turn this on for a continuous <strong>daily</strong> series over a longer <strong>custom range</strong>, <strong>Past 12 months</strong> or <strong>Past 5 years</strong> (up to 10 years): overlapping ~8-month windows are fetched and rescaled on their overlap. Google's own weekly/monthly series stays in <code>interestOverTime_coarse</code>, with a score for how well the two agree. ~2 extra requests per 7 months; still one result.

## `trendingGeos` (type: `array`):

Country or US-state codes, e.g. <code>US</code>, <code>GB</code>, <code>US-CA</code>. Defaults to <code>US</code> (or the Location field).

## `trendingHours` (type: `string`):

How far back to look. The past 7 days can return ~2,000 trends for the US.

## `trendingCategories` (type: `array`):

Keep only these categories (empty = all).

## `trendingActiveOnly` (type: `boolean`):

Skip topics whose trend has already ended.

## `trendingMinVolume` (type: `integer`):

Skip topics with fewer searches (e.g. <code>10000</code>).

## `trendingSort` (type: `string`):

Order of results per location.

## `maxTrendsPerGeo` (type: `integer`):

Each trend is one result.

## `includeTrendNews` (type: `boolean`):

News articles and an image for the top ~10 trends of each location (Google's own selection).

## `onlyNewSinceLastRun` (type: `boolean`):

Skip trends this monitor already returned. Pair with a daily or hourly Schedule to get alerts about new trends only.

## `monitorName` (type: `string`):

Keep separate memories for different monitors (e.g. <code>us-sports</code>). Defaults to <code>default</code>.

## `maxConcurrency` (type: `integer`):

Queries processed in parallel, each on its own IP session.

## `maxRequestRetries` (type: `integer`):

Retries on a fresh IP after a rate limit or block.

## `viewedFrom` (type: `string`):

Optional 2-letter country code. Requests then go through residential IPs in that country (slower). Leave empty for the fastest default.

## `proxyConfiguration` (type: `object`):

Default Apify datacenter proxy works well and is included in the price.

## Actor input object example

```json
{
  "mode": "explore",
  "searchTerms": [
    "web scraping"
  ],
  "isMultiple": false,
  "timeRange": "",
  "geo": "",
  "category": "0",
  "property": "",
  "maxItems": 0,
  "extraGeoResolutions": true,
  "includeRelated": true,
  "verifyRelatedQueries": true,
  "normalizeAcrossQueries": false,
  "dailyStitching": false,
  "trendingGeos": [
    "US"
  ],
  "trendingHours": "24",
  "trendingActiveOnly": false,
  "trendingMinVolume": 0,
  "trendingSort": "relevance",
  "maxTrendsPerGeo": 50,
  "includeTrendNews": true,
  "onlyNewSinceLastRun": false,
  "maxConcurrency": 10,
  "maxRequestRetries": 7,
  "proxyConfiguration": {
    "useApifyProxy": true
  }
}
```

# Actor output Schema

## `results` (type: `string`):

No description

## `flatCsv` (type: `string`):

Flat copy of all results for Excel / Google Sheets: one row per timeline point, region, city, metro, related query or trend.

# API

You can run this Actor programmatically using our API. Below are code examples in JavaScript, Python, and CLI, as well as the OpenAPI specification and MCP server setup.

## JavaScript example

```javascript
import { ApifyClient } from 'apify-client';

// Initialize the ApifyClient with your Apify API token
// Replace the '<YOUR_API_TOKEN>' with your token
const client = new ApifyClient({
    token: '<YOUR_API_TOKEN>',
});

// Prepare Actor input
const input = {
    "searchTerms": [
        "web scraping"
    ],
    "trendingGeos": [
        "US"
    ]
};

// Run the Actor and wait for it to finish
const run = await client.actor("alom/google-trends-api").call(input);

// Fetch and print Actor results from the run's dataset (if any)
console.log('Results from dataset');
console.log(`💾 Check your data here: https://console.apify.com/storage/datasets/${run.defaultDatasetId}`);
const { items } = await client.dataset(run.defaultDatasetId).listItems();
items.forEach((item) => {
    console.dir(item);
});

// 📚 Want to learn more 📖? Go to → https://docs.apify.com/api/client/js/docs

```

## Python example

```python
from apify_client import ApifyClient

# Initialize the ApifyClient with your Apify API token
# Replace '<YOUR_API_TOKEN>' with your token.
client = ApifyClient("<YOUR_API_TOKEN>")

# Prepare the Actor input
run_input = {
    "searchTerms": ["web scraping"],
    "trendingGeos": ["US"],
}

# Run the Actor and wait for it to finish
run = client.actor("alom/google-trends-api").call(run_input=run_input)

# Fetch and print Actor results from the run's dataset (if there are any)
print(f"💾 Check your data here: https://console.apify.com/storage/datasets/{run.default_dataset_id}")
for item in client.dataset(run.default_dataset_id).iterate_items():
    print(item)

# 📚 Want to learn more 📖? Go to → https://docs.apify.com/api/client/python/docs/quick-start

```

## CLI example

```bash
echo '{
  "searchTerms": [
    "web scraping"
  ],
  "trendingGeos": [
    "US"
  ]
}' |
apify call alom/google-trends-api --silent --output-dataset

```

## MCP server setup

```json
{
    "mcpServers": {
        "apify": {
            "type": "http",
            "url": "https://mcp.apify.com/?tools=fetch-actor-details,alom/google-trends-api"
        }
    }
}
```

The hosted server signs you in with OAuth on first connect, so no API token belongs in this config. Clients without OAuth support can send an `Authorization: Bearer <APIFY_API_TOKEN>` header instead, using a token from API & Integrations in Apify Console (https://console.apify.com/settings/integrations).

## OpenAPI specification

Download the OpenAPI definition: https://api.apify.com/v2/actors/IJb6sscqidkT7ufvx/builds/wsJ1gNmG2VX3zRnbU/openapi.json
