# Google Trends API — Compare Keywords Over Time & by Region (`muhammadafzal/google-trends-api`) Actor

Google Trends API for keyword research: interest over time, interest by region, and top and rising related queries for up to 25 keywords or 5-term comparisons. USD 4 per 1,000 results.

- **URL**: https://apify.com/muhammadafzal/google-trends-api.md
- **Developed by:** [Muhammad Afzal](https://apify.com/muhammadafzal) (community)
- **Categories:** SEO tools
- **Features:** Limited permissions
- **Stats:** 2 total users, 1 monthly users, 100.0% runs succeeded, 0 bookmarks
- **User rating**: No ratings yet

## Pricing

from $3.20 / 1,000 keyword results

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/running/actors-in-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 — Compare Keywords Over Time & by Region

Google Trends API returns Google Trends data for your keywords: interest over time, interest by country, state, metro or city, and the top and rising related queries, for any location, time range, category and search type. It costs USD 4.00 per 1,000 keyword results plus USD 0.005 per run, and terms without Google Trends data are not charged.

Use it for keyword research, SEO and content planning, product and market research, seasonality checks, brand monitoring and comparing up to 5 terms on one scale. One run handles 1 to 25 keywords or comparisons, and needs no Google account or API key.

### What data does Google Trends API return?

One record per search term. A single keyword gives one record; a comparison of up to 5 terms gives one record per term, all on the same 0-100 scale. Each record holds:

| Field | What it contains | Example |
|---|---|---|
| `keyword` | The search term of this record | `coffee` |
| `searchTerms`, `isComparison` | Every term of the search; more than one means a comparison | `["coffee", "tea"]`, `true` |
| `geo`, `geoName` | Location code used (null = worldwide) and country name | `US`, `United States` |
| `timeRange`, `dateFrom`, `dateTo` | Time range option and the exact dates it covered | `past12Months`, `2025-11-08`, `2026-11-08` |
| `category`, `property` | Category number (0 = all) and search type | `0`, `web` |
| `granularity`, `pointCount` | Step between points and how many there are | `week`, `54` |
| `averageValue`, `peakValue`, `peakDate`, `latestValue`, `latestDate` | Summary of the completed points | `78.5`, `100`, `2026-04-12`, `65`, `2026-11-01` |
| `interestOverTime` | Timeline: `date` (UTC), `dateLabel`, `value` 0-100, `isPartial` | `{"date": "2026-11-01", "value": 65}` |
| `regionLevel` | What the regions are: `country`, `subregion`, `metro` or `city` | `subregion` |
| `interestByRegion` | `regionCode`, `regionName`, `value` 0-100, and in a comparison `shareOfComparison` (%) | `{"regionName": "Wyoming", "value": 100}` |
| `relatedQueries` | `queryType` (`top` or `rising`), `rank`, `query`, `value`, `formattedValue`, `isBreakout`, `queryUrl` | `{"query": "coffee near me", "value": 100}` |
| `trendsUrl` | The same search on Google Trends | `https://trends.google.com/trends/explore?…` |
| `position`, `input`, `scrapedAt` | Entry position in your list, the entry as typed, read time | `1`, `coffee, tea` |

The Output tab has four views: a keyword overview, and interest over time, interest by region and related queries each unwound into one row per point, region or query, ready for CSV or Excel export.

### How do I get Google Trends data for a keyword?

Type the keyword into **Keywords**, pick a country and time range, and start the run. The defaults are web search, all categories and the past 12 months.

| Input | Description | Default |
|---|---|---|
| `keywords` | 1 to 25 entries. An entry is one term (`coffee`) or up to 5 comma-separated terms to compare (`coffee, tea, matcha`). | required |
| `geo` | Country (`US`, `GB`, `DE`), subdivision (`US-NY`, `JP-13`) or US metro (`US-NY-501`); empty for worldwide | worldwide |
| `timeRange` | `past4Hours`, `pastDay`, `past7Days`, `past30Days`, `past90Days`, `past12Months`, `past5Years`, `since2004` or `custom` | `past12Months` |
| `startDate`, `endDate` | `YYYY-MM-DD` dates for `custom`, from 2004-01-01 to today | none |
| `category` | Google Trends category number, for example 71 Food & Drink or 7 Finance; 0 for all | `0` |
| `property` | `web`, `images`, `news`, `shopping` (Google Shopping) or `youtube` | `web` |
| `includeRegions` | Return interest by region | `true` |
| `includeRelatedQueries` | Return top and rising related queries | `true` |

Example input:

```json
{
    "keywords": ["coffee", "coffee, tea, matcha"],
    "geo": "US",
    "timeRange": "past12Months",
    "category": 0,
    "property": "web",
    "includeRegions": true,
    "includeRelatedQueries": true
}
```

Time ranges are counted back from the moment the run starts, so a saved input or schedule always reads the latest data. Google Trends chooses the step from the range: one minute for 4 hours, 8 minutes for a day, hourly for 7 days, daily up to 90 days, weekly for 12 months and 5 years, monthly since 2004. Intraday times are in UTC.

### How do I compare keywords on Google Trends?

Put up to 5 terms in one entry, separated by commas: `coffee, tea, matcha`. The terms share one 0-100 scale, where 100 is the highest point of any of them, exactly as on the Google Trends compare chart. Each term still gets its own record, and its `interestByRegion` adds `shareOfComparison`: that term's share of the compared terms' searches in each region. Separate entries are separate searches with their own scales.

### What does the output look like?

```json
{
    "position": 1,
    "input": "coffee",
    "keyword": "coffee",
    "searchTerms": ["coffee"],
    "isComparison": false,
    "geo": "US",
    "geoName": "United States",
    "timeRange": "past12Months",
    "dateFrom": "2025-11-08",
    "dateTo": "2026-11-08",
    "category": 0,
    "property": "web",
    "granularity": "week",
    "pointCount": 54,
    "averageValue": 78.5,
    "peakValue": 100,
    "peakDate": "2026-04-12",
    "latestValue": 65,
    "latestDate": "2026-11-01",
    "interestOverTime": [
        { "date": "2025-11-02", "dateLabel": "Nov 2 – 8, 2025", "value": 69, "isPartial": false }
    ],
    "regionLevel": "subregion",
    "interestByRegion": [
        { "regionCode": "US-WY", "regionName": "Wyoming", "value": 100, "shareOfComparison": null }
    ],
    "relatedQueries": [
        { "queryType": "top", "rank": 1, "query": "coffee near me", "value": 100, "formattedValue": "100", "isBreakout": false, "queryUrl": "https://trends.google.com/trends/explore?q=coffee+near+me&date=today+12-m&geo=US" },
        { "queryType": "rising", "rank": 8, "query": "coffee shops nearby", "value": 3850, "formattedValue": "+3,850%", "isBreakout": false, "queryUrl": "https://trends.google.com/trends/explore?q=coffee+shops+nearby&date=today+12-m&geo=US" }
    ],
    "trendsUrl": "https://trends.google.com/trends/explore?date=2025-11-08%202026-11-08&geo=US&q=coffee",
    "scrapedAt": "2026-11-08T09:30:00.000Z"
}
```

Arrays are shortened here. Every run also writes an `OUTPUT` record to the key-value store: the run status (`SUCCEEDED`, `PARTIAL`, `EMPTY`, `FAILED`), the dates and settings used, counts, and one line per entry with its outcome and reason.

### How much does Google Trends API cost?

You pay per keyword result delivered, plus a small start fee per run. Terms without data are free.

| Event | Free plan | Bronze | Silver | Gold |
|---|---|---|---|---|
| Keyword result (one dataset record) | USD 0.004 | USD 0.0039 | USD 0.0038 | USD 0.0032 |
| Actor start (per run) | USD 0.005 | USD 0.005 | USD 0.005 | USD 0.005 |

The start fee is charged once per started GB of allocated memory, so one event at the default 256 MB. Worked examples on the Free plan price: 1 keyword costs USD 0.009; a comparison of 5 terms costs USD 0.025; 25 keywords cost USD 0.105. Platform usage is included in these prices.

### What happens when a keyword has no Google Trends data?

You are not charged for it. Google Trends shows nothing for terms with too little search volume, and the Actor never invents zero rows for them. The `OUTPUT` record lists each such entry:

- `no-data`: Google Trends has too little data for the term with these settings. Try a wider region, a longer time range or all categories.
- `termsWithoutData`: in a comparison, the terms that had no data while the others did.
- `invalid-input`: the entry is empty, has more than 5 terms, or repeats a term.
- `duplicate`: the same search appears earlier in the list.

Regions with too little data are left out of `interestByRegion`, as on Google Trends. A run where no term has data ends as `EMPTY` with that explanation instead of failing.

### How do I use it from the API or an AI assistant?

Call it like any Apify Actor. JavaScript:

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

const client = new ApifyClient({ token: process.env.APIFY_TOKEN });
const run = await client.actor('muhammadafzal/google-trends-api').call({
    keywords: ['coffee, tea'],
    geo: 'US',
    timeRange: 'past12Months',
});
const { items } = await client.dataset(run.defaultDatasetId).listItems();
for (const item of items) console.log(item.keyword, item.averageValue, item.latestValue);
```

Python (apify-client 3.x):

```python
from apify_client import ApifyClient

client = ApifyClient("<APIFY_TOKEN>")
run = client.actor("muhammadafzal/google-trends-api").call(
    run_input={"keywords": ["coffee, tea"], "geo": "US", "timeRange": "past5Years"}
)
for item in client.dataset(run.default_dataset_id).iterate_items():
    print(item["keyword"], item["peakDate"], item["averageValue"])
```

For long tables, request the dataset items with `unwind=interestOverTime` (or `interestByRegion`, `relatedQueries`) to get one row per point, region or query.

**Use it from an AI assistant.** The Actor works from Claude, ChatGPT, Cursor or any MCP client through Apify's MCP server. Add `https://mcp.apify.com/?tools=muhammadafzal/google-trends-api` as an MCP server, then ask, for example: "Compare Google Trends interest for matcha, chai and cold brew in the US over the past 5 years and tell me which one is growing fastest."

### When should I use a different tool?

- **Search volume in absolute numbers:** Google Trends gives relative interest (0-100), not monthly search counts. Use a keyword search volume tool for that.
- **Daily trending searches (Trending Now):** this Actor reads the Explore data for keywords you choose; it does not list what is trending today.
- **Related topics:** not included. Google returned no related topics for any keyword in our testing, so the Actor returns related queries only.
- **Google search results or YouTube video data:** use a Google search results or YouTube data Actor.

### FAQ

**Is this a Google Trends API?**
Yes. Every run can be started from the Apify API, the JavaScript or Python client, or an MCP client, and returns JSON records. You need no Google account or Google API key.

**Is Google Trends value the same as search volume?**
No. Google Trends scales interest from 0 to 100, where 100 is the highest point of the search in the chosen place and time. In a comparison, all terms share that scale.

**Can I get Google Trends data by state or city?**
Yes. A country code returns its states or provinces, a subdivision such as `US-NY` returns its metro areas, and a US metro such as `US-NY-501` returns cities.

**How far back does Google Trends data go?**
To January 2004. Choose `since2004` for monthly data from 2004 to today, or `custom` with your own dates.

**What do Breakout and +4,600% mean in related queries?**
Rising queries show the growth of a query compared with the previous period; Breakout means more than 5,000% growth. Top queries show a 0-100 popularity score instead.

**Can I get YouTube, News, Image or Shopping trends?**
Yes. Set `property` to `youtube`, `news`, `images` or `shopping` to read Google Trends for that search type.

**Can I export Google Trends data to CSV or Excel?**
Yes. Export the dataset from the run, or choose one of the unwound views (interest over time, by region, related queries) to get one row per data point.

### Limits and data use

Up to 25 entries per run, up to 5 terms per entry, 100 characters per term. Google Trends data is public, sampled and rounded by Google, so two runs a few minutes apart can differ by a few points; the last point of a range is often partial and is marked `isPartial`. The Actor reads public Google Trends data only and stores no personal data.

Questions or a keyword that should work but does not? Open an issue on the Actor's Issues tab with the input and the run ID.

Last verified: 2026-11-08

# Actor input Schema

## `keywords` (type: `array`):

Use this for the search terms to look up, one entry per line. An entry is a single term (coffee) or up to 5 terms separated by commas (coffee, tea, matcha) to compare them on one shared 0-100 scale, as on Google Trends. Each entry is a separate search; each term in it returns one record. Duplicates are removed. 1 to 25 entries.

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

Use this to choose where the searches were made, as a Google Trends location code: a country (US, GB, DE, IN), a subdivision (US-NY, GB-ENG, JP-13) or a US metro area (US-NY-501). Leave empty for worldwide. The region breakdown follows it: countries for worldwide, states or provinces for a country, metros or cities below that.

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

Use this to choose the period, counted back from the moment the run starts, so a saved input never goes stale. Google Trends sets the step: minutes for 4 hours, 8 minutes for a day, hours for 7 days, days up to 90 days, weeks for 12 months and 5 years, months since 2004. Choose Custom to set startDate and endDate. Default: past 12 months.

## `startDate` (type: `string`):

Use this only with Time range = Custom dates: the first day of the period, YYYY-MM-DD, 2004-01-01 or later. Example: 2024-01-01.

## `endDate` (type: `string`):

Use this only with Time range = Custom dates: the last day of the period, YYYY-MM-DD, after the start date and not in the future. Example: 2024-12-31.

## `category` (type: `integer`):

Use this to narrow the searches to a Google Trends category by its number, 0 for all categories. Top-level categories: 3 Arts & Entertainment, 47 Autos & Vehicles, 44 Beauty & Fitness, 22 Books & Literature, 12 Business & Industrial, 5 Computers & Electronics, 7 Finance, 71 Food & Drink, 8 Games, 45 Health, 65 Hobbies & Leisure, 11 Home & Garden, 13 Internet & Telecom, 958 Jobs & Education, 19 Law & Government, 16 News, 299 Online Communities, 14 People & Society, 66 Pets & Animals, 29 Real Estate, 533 Reference, 174 Science, 18 Shopping, 20 Sports, 67 Travel & Transportation. Default: 0.

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

Use this to choose which Google search the interest comes from: web search (default), image search, news search, Google Shopping or YouTube search.

## `includeRegions` (type: `boolean`):

Use this to get interestByRegion: each country, state, metro or city with its 0-100 interest, and in a comparison the term's share of searches there. Places with too little data are left out. Turn it off for smaller records. Default: on.

## `includeRelatedQueries` (type: `boolean`):

Use this to get relatedQueries: the top and rising searches related to each term, with Google's 0-100 score or percentage growth and Breakout flags, for keyword research. Default: on.

## Actor input object example

```json
{
  "keywords": [
    "coffee"
  ],
  "geo": "US",
  "timeRange": "past12Months",
  "category": 0,
  "property": "web",
  "includeRegions": true,
  "includeRelatedQueries": true
}
```

# Actor output Schema

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

Dataset of Google Trends results: one record per term with its timeline, regions and related queries.

## `summary` (type: `string`):

OUTPUT record: status, counts, settings used and per-search outcome with the reason when no record was delivered.

# 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 = {
    "keywords": [
        "coffee"
    ],
    "geo": "US"
};

// Run the Actor and wait for it to finish
const run = await client.actor("muhammadafzal/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 = {
    "keywords": ["coffee"],
    "geo": "US",
}

# Run the Actor and wait for it to finish
run = client.actor("muhammadafzal/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 '{
  "keywords": [
    "coffee"
  ],
  "geo": "US"
}' |
apify call muhammadafzal/google-trends-api --silent --output-dataset

```

## MCP server setup

```json
{
    "mcpServers": {
        "apify": {
            "type": "http",
            "url": "https://mcp.apify.com/?tools=fetch-actor-details,muhammadafzal/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/k4YnFIlIsAGCeDtcc/builds/BEoLKLGtix3WaYLZd/openapi.json
