# Google Trends API — Pay Per Result, No Empty Charges (`greza/google-trends-realtime`) Actor

Google Trends via a resilient API: interest over time, cross-term compare (one 0–100 scale), related, interest by region, realtime trending. Pay per result — never charged for empty data.

- **URL**: https://apify.com/greza/google-trends-realtime.md
- **Developed by:** [Sergei Peleskov](https://apify.com/greza) (community)
- **Categories:** SEO tools, Developer tools, News
- **Stats:** 2 total users, 0 monthly users, 100.0% runs succeeded, 0 bookmarks
- **User rating**: No ratings yet

## Pricing

from $5.00 / 1,000 keyword results

This Actor is paid per event and usage. You are charged both the fixed price for specific events and for Apify platform usage.

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

## What's an Apify Actor?

Actors are a software tools running on the Apify platform, for all kinds of web data extraction and automation use cases.
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.
Actors are written with capital "A".

## 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.
The best way to integrate Actors is as follows.

In JavaScript/TypeScript projects, use official [JavaScript/TypeScript client](https://docs.apify.com/api/client/js.md):

```bash
npm install apify-client
```

In Python projects, use official [Python client library](https://docs.apify.com/api/client/python.md):

```bash
pip install apify-client
```

In shell scripts, use [Apify CLI](https://docs.apify.com/cli/docs.md):

````bash
# MacOS / Linux
curl -fsSL https://apify.com/install-cli.sh | bash
# Windows
irm https://apify.com/install-cli.ps1 | iex
```bash

In AI frameworks, you might use the [Apify MCP server](https://docs.apify.com/platform/integrations/mcp.md).

If your project is in a different language, use the [REST API](https://docs.apify.com/api/v2.md).

For usage examples, see the [API](#api) section below.

For more details, see Apify documentation as [Markdown index](https://docs.apify.com/llms.txt) and [Markdown full-text](https://docs.apify.com/llms-full.txt).


# README

## Google Trends API — Pay Per Result, No Empty Charges

Google Trends data through a **resilient API**: interest over time, **cross-term compare** (2–5 keywords on one shared 0–100 scale), related queries & topics, interest by region, and **realtime trending**. You pay **per result** — and **never for empty data**.

Built for people who tried the official Google Trends API and hit its walls: alpha status, quotas, Google Cloud auth, and **no recent/realtime data**.

---

### Why this Actor

#### This Actor vs typical / official Trends scrapers

| | This Actor | Typical / official Trends API |
|---|---|---|
| **Pay for empty results** | ❌ Never — empty = `no_data`, not billed | ✅ You pay for the call regardless |
| **Realtime windows** (`now 1-H`…`now 7-d`) | ✅ Yes | ❌ Official alpha has no recent data |
| **Retries + residential rotation** | ✅ Built in — survives the first 429, doesn't fall over | ❌ You handle 429s / IP bans yourself |
| **Cross-term scaling** (up to 5 keywords, one 0–100 scale) | ✅ Yes | ❌ Single-keyword scales only |
| **Related + interest-by-region** | ✅ One Actor, one contract | ⚠️ Fragmented / partial |
| **Pricing** | ✅ Pay-per-event, pay for what you use | ❌ Quota tiers / rental subscription |

Reliability (retries, residential IP rotation, backpressure with `Retry-After`) is handled server-side — you just get **stable results that don't break on the first rate-limit**.

---

### Scrape types

Pick one via `scrapeType`:

- **`interestOverTime`** — popularity of each keyword over time (independent 0–100 scale per keyword).
- **`compare`** — 2–5 keywords on **one shared 0–100 scale** (cross-term scaling). One request, one price — comparable numbers across terms.
- **`related`** — top & rising related queries and topics.
- **`interestByRegion`** — geographic breakdown (`COUNTRY` / `REGION` / `CITY` / `DMA`).
- **`trendingNow`** — realtime trending searches for a location.

---

### Input

```json
{
  "scrapeType": "interestOverTime",
  "keywords": ["bitcoin", "ethereum"],
  "geo": "US",
  "timeRange": "today 3-m",
  "category": 0
}
````

| Field | Type | Notes |
|---|---|---|
| `scrapeType` | enum | `interestOverTime` | `compare` | `related` | `interestByRegion` | `trendingNow` |
| `keywords` | string\[] | 1–50; **exactly 2–5 for `compare`**; not required for `trendingNow` |
| `geo` | string | `""` = worldwide, `US`, `US-CA` |
| `timeRange` | enum | `now 1-H`…`now 7-d`, `today 1-m`…`today 5-y`, `all`, `custom` |
| `customTimeRange` | string | when `timeRange=custom`: `YYYY-MM-DD YYYY-MM-DD` |
| `category` | integer | Google category id, `0` = all |
| `resolution` | enum | `interestByRegion` only: `COUNTRY`/`REGION`/`CITY`/`DMA` |

No proxy configuration — residential rotation is included.

***

### Output

One dataset item per keyword × scrape type (compare = one item for the group). Data mirrors the normalized API schema, plus the request fields (`kw`/`keywords`, `geo`, `time`) for easy filtering.

**interestOverTime**

```json
{ "scrapeType": "interestOverTime", "kw": "bitcoin", "geo": "US", "time": "today 3-m",
  "points": [{ "date": "Jun 1, 2026", "value": 52, "isPartial": false }] }
```

**compare** (one shared 0–100 scale, order preserved)

```json
{ "scrapeType": "compare", "geo": "US", "time": "today 3-m",
  "keywords": ["btc", "eth", "doge"],
  "points": [{ "date": "Jun 5, 2026", "isPartial": false,
               "values": { "btc": 100, "eth": 26, "doge": 13 } }],
  "keywords_meta": {} }
```

Low-volume terms come back with `values: 0` and a `keywords_meta[kw]: "low_volume"` flag — the run never fails on them.

**No data / failed** (never billed)

```json
{ "scrapeType": "related", "kw": "asdfqwerzxcv", "geo": "US", "status": "no_data" }
```

***

### Pricing (pay per event)

You are charged **only for delivered non-empty results**:

| Event | When | Price |
|---|---|---|
| `keyword-result` | one keyword returned data (iot / related / region) | $0.005 |
| `compare-result` | one 2–5 keyword comparison returned data (**once, not ×5**) | $0.005 |
| `trending-page` | one realtime trending page returned data | $0.005 |

**Never charged:** empty results (`no_data`), failed requests, or any error. Compare is one event for the whole group — that's the point of batching.

***

### FAQ

**How is this different from the official Google Trends API?**
The official API is alpha: quota-limited, requires Google Cloud auth, and has **no recent/realtime data**. This Actor gives realtime windows (`now 1-H`…`now 7-d`), needs only an Apify token, and bills per delivered result instead of per quota unit.

**Why did I get `no_data` for a keyword?**
Google returned a valid response with no data for that term (too low volume, or no coverage in the geo). It's in the dataset with `status: "no_data"` and is **not billed**.

**What happens under heavy load?**
The backing service applies backpressure (`503` + `Retry-After`); the Actor honors it — waits and retries automatically, so your run doesn't drop requests.

**Can I compare keywords on the same scale?**
Yes — `scrapeType: "compare"` with 2–5 keywords puts them on one shared 0–100 scale (cross-term scaling), so the numbers are directly comparable.

***

### Integrations

Works with the Apify **API**, **n8n**, **Make**, and **MCP** — run it and pull results from the dataset like any Actor.

Example (API run input):

```json
{ "scrapeType": "compare", "keywords": ["btc", "eth", "doge"], "geo": "US", "timeRange": "today 3-m" }
```

***

### Notes for operators

- Requires two **secret environment variables** on the Actor: `GATEWAY_URL` and `GATEWAY_API_KEY` (never in input, never hardcoded).
- Optional env: `ACTOR_CONCURRENCY` (default 8), `GATEWAY_RETRY_503` (default 6).

# Actor input Schema

## `scrapeType` (type: `string`):

Which Google Trends dataset to fetch. `compare` puts 2–5 keywords on ONE shared 0–100 scale (cross-term scaling).

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

Search terms. 1–50 for most types; exactly 2–5 for `compare`. Not required for `trendingNow`.

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

ISO country or region: empty = worldwide, `US`, `US-CA`. Pattern `^$|^[A-Z]{2}(-[A-Z0-9]{1,3})?$`.

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

Realtime windows (`now *`) are supported — unlike the official Trends API. Pick `custom` to supply an explicit date range below.

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

Only used when Time range = `custom`. Format `YYYY-MM-DD YYYY-MM-DD` (e.g. `2026-01-01 2026-03-01`).

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

Google Trends category id. 0 = all categories.

## `resolution` (type: `string`):

Only for `interestByRegion`: granularity of the geo breakdown.

## Actor input object example

```json
{
  "scrapeType": "interestOverTime",
  "keywords": [
    "bitcoin"
  ],
  "geo": "",
  "timeRange": "today 3-m",
  "category": 0,
  "resolution": "COUNTRY"
}
```

# 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": [
        "bitcoin"
    ]
};

// Run the Actor and wait for it to finish
const run = await client.actor("greza/google-trends-realtime").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": ["bitcoin"] }

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

# Fetch and print Actor results from the run's dataset (if there are any)
print("💾 Check your data here: https://console.apify.com/storage/datasets/" + run["defaultDatasetId"])
for item in client.dataset(run["defaultDatasetId"]).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": [
    "bitcoin"
  ]
}' |
apify call greza/google-trends-realtime --silent --output-dataset

```

## MCP server setup

```json
{
    "mcpServers": {
        "apify": {
            "command": "npx",
            "args": [
                "mcp-remote",
                "https://mcp.apify.com/?tools=greza/google-trends-realtime",
                "--header",
                "Authorization: Bearer <YOUR_API_TOKEN>"
            ]
        }
    }
}

```

## OpenAPI specification

```json
{
    "openapi": "3.0.1",
    "info": {
        "title": "Google Trends API — Pay Per Result, No Empty Charges",
        "description": "Google Trends via a resilient API: interest over time, cross-term compare (one 0–100 scale), related, interest by region, realtime trending. Pay per result — never charged for empty data.",
        "version": "0.1",
        "x-build-id": "SiIuXBKNVVFwuDA9o"
    },
    "servers": [
        {
            "url": "https://api.apify.com/v2"
        }
    ],
    "paths": {
        "/acts/greza~google-trends-realtime/run-sync-get-dataset-items": {
            "post": {
                "operationId": "run-sync-get-dataset-items-greza-google-trends-realtime",
                "x-openai-isConsequential": false,
                "summary": "Executes an Actor, waits for its completion, and returns Actor's dataset items in response.",
                "tags": [
                    "Run Actor"
                ],
                "requestBody": {
                    "required": true,
                    "content": {
                        "application/json": {
                            "schema": {
                                "$ref": "#/components/schemas/inputSchema"
                            }
                        }
                    }
                },
                "parameters": [
                    {
                        "name": "token",
                        "in": "query",
                        "required": true,
                        "schema": {
                            "type": "string"
                        },
                        "description": "Enter your Apify token here"
                    }
                ],
                "responses": {
                    "200": {
                        "description": "OK"
                    }
                }
            }
        },
        "/acts/greza~google-trends-realtime/runs": {
            "post": {
                "operationId": "runs-sync-greza-google-trends-realtime",
                "x-openai-isConsequential": false,
                "summary": "Executes an Actor and returns information about the initiated run in response.",
                "tags": [
                    "Run Actor"
                ],
                "requestBody": {
                    "required": true,
                    "content": {
                        "application/json": {
                            "schema": {
                                "$ref": "#/components/schemas/inputSchema"
                            }
                        }
                    }
                },
                "parameters": [
                    {
                        "name": "token",
                        "in": "query",
                        "required": true,
                        "schema": {
                            "type": "string"
                        },
                        "description": "Enter your Apify token here"
                    }
                ],
                "responses": {
                    "200": {
                        "description": "OK",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/runsResponseSchema"
                                }
                            }
                        }
                    }
                }
            }
        },
        "/acts/greza~google-trends-realtime/run-sync": {
            "post": {
                "operationId": "run-sync-greza-google-trends-realtime",
                "x-openai-isConsequential": false,
                "summary": "Executes an Actor, waits for completion, and returns the OUTPUT from Key-value store in response.",
                "tags": [
                    "Run Actor"
                ],
                "requestBody": {
                    "required": true,
                    "content": {
                        "application/json": {
                            "schema": {
                                "$ref": "#/components/schemas/inputSchema"
                            }
                        }
                    }
                },
                "parameters": [
                    {
                        "name": "token",
                        "in": "query",
                        "required": true,
                        "schema": {
                            "type": "string"
                        },
                        "description": "Enter your Apify token here"
                    }
                ],
                "responses": {
                    "200": {
                        "description": "OK"
                    }
                }
            }
        }
    },
    "components": {
        "schemas": {
            "inputSchema": {
                "type": "object",
                "required": [
                    "scrapeType"
                ],
                "properties": {
                    "scrapeType": {
                        "title": "What to scrape",
                        "enum": [
                            "interestOverTime",
                            "compare",
                            "related",
                            "interestByRegion",
                            "trendingNow"
                        ],
                        "type": "string",
                        "description": "Which Google Trends dataset to fetch. `compare` puts 2–5 keywords on ONE shared 0–100 scale (cross-term scaling).",
                        "default": "interestOverTime"
                    },
                    "keywords": {
                        "title": "Keywords",
                        "minItems": 0,
                        "maxItems": 50,
                        "type": "array",
                        "description": "Search terms. 1–50 for most types; exactly 2–5 for `compare`. Not required for `trendingNow`.",
                        "items": {
                            "type": "string"
                        }
                    },
                    "geo": {
                        "title": "Location (geo)",
                        "pattern": "^$|^[A-Z]{2}(-[A-Z0-9]{1,3})?$",
                        "type": "string",
                        "description": "ISO country or region: empty = worldwide, `US`, `US-CA`. Pattern `^$|^[A-Z]{2}(-[A-Z0-9]{1,3})?$`.",
                        "default": ""
                    },
                    "timeRange": {
                        "title": "Time range",
                        "enum": [
                            "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",
                            "custom"
                        ],
                        "type": "string",
                        "description": "Realtime windows (`now *`) are supported — unlike the official Trends API. Pick `custom` to supply an explicit date range below.",
                        "default": "today 3-m"
                    },
                    "customTimeRange": {
                        "title": "Custom time range",
                        "pattern": "^\\d{4}-\\d{2}-\\d{2} \\d{4}-\\d{2}-\\d{2}$",
                        "type": "string",
                        "description": "Only used when Time range = `custom`. Format `YYYY-MM-DD YYYY-MM-DD` (e.g. `2026-01-01 2026-03-01`)."
                    },
                    "category": {
                        "title": "Category ID",
                        "minimum": 0,
                        "type": "integer",
                        "description": "Google Trends category id. 0 = all categories.",
                        "default": 0
                    },
                    "resolution": {
                        "title": "Region resolution",
                        "enum": [
                            "COUNTRY",
                            "REGION",
                            "CITY",
                            "DMA"
                        ],
                        "type": "string",
                        "description": "Only for `interestByRegion`: granularity of the geo breakdown.",
                        "default": "COUNTRY"
                    }
                }
            },
            "runsResponseSchema": {
                "type": "object",
                "properties": {
                    "data": {
                        "type": "object",
                        "properties": {
                            "id": {
                                "type": "string"
                            },
                            "actId": {
                                "type": "string"
                            },
                            "userId": {
                                "type": "string"
                            },
                            "startedAt": {
                                "type": "string",
                                "format": "date-time",
                                "example": "2025-01-08T00:00:00.000Z"
                            },
                            "finishedAt": {
                                "type": "string",
                                "format": "date-time",
                                "example": "2025-01-08T00:00:00.000Z"
                            },
                            "status": {
                                "type": "string",
                                "example": "READY"
                            },
                            "meta": {
                                "type": "object",
                                "properties": {
                                    "origin": {
                                        "type": "string",
                                        "example": "API"
                                    },
                                    "userAgent": {
                                        "type": "string"
                                    }
                                }
                            },
                            "stats": {
                                "type": "object",
                                "properties": {
                                    "inputBodyLen": {
                                        "type": "integer",
                                        "example": 2000
                                    },
                                    "rebootCount": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "restartCount": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "resurrectCount": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "computeUnits": {
                                        "type": "integer",
                                        "example": 0
                                    }
                                }
                            },
                            "options": {
                                "type": "object",
                                "properties": {
                                    "build": {
                                        "type": "string",
                                        "example": "latest"
                                    },
                                    "timeoutSecs": {
                                        "type": "integer",
                                        "example": 300
                                    },
                                    "memoryMbytes": {
                                        "type": "integer",
                                        "example": 1024
                                    },
                                    "diskMbytes": {
                                        "type": "integer",
                                        "example": 2048
                                    }
                                }
                            },
                            "buildId": {
                                "type": "string"
                            },
                            "defaultKeyValueStoreId": {
                                "type": "string"
                            },
                            "defaultDatasetId": {
                                "type": "string"
                            },
                            "defaultRequestQueueId": {
                                "type": "string"
                            },
                            "buildNumber": {
                                "type": "string",
                                "example": "1.0.0"
                            },
                            "containerUrl": {
                                "type": "string"
                            },
                            "usage": {
                                "type": "object",
                                "properties": {
                                    "ACTOR_COMPUTE_UNITS": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "DATASET_READS": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "DATASET_WRITES": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "KEY_VALUE_STORE_READS": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "KEY_VALUE_STORE_WRITES": {
                                        "type": "integer",
                                        "example": 1
                                    },
                                    "KEY_VALUE_STORE_LISTS": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "REQUEST_QUEUE_READS": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "REQUEST_QUEUE_WRITES": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "DATA_TRANSFER_INTERNAL_GBYTES": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "DATA_TRANSFER_EXTERNAL_GBYTES": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "PROXY_RESIDENTIAL_TRANSFER_GBYTES": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "PROXY_SERPS": {
                                        "type": "integer",
                                        "example": 0
                                    }
                                }
                            },
                            "usageTotalUsd": {
                                "type": "number",
                                "example": 0.00005
                            },
                            "usageUsd": {
                                "type": "object",
                                "properties": {
                                    "ACTOR_COMPUTE_UNITS": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "DATASET_READS": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "DATASET_WRITES": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "KEY_VALUE_STORE_READS": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "KEY_VALUE_STORE_WRITES": {
                                        "type": "number",
                                        "example": 0.00005
                                    },
                                    "KEY_VALUE_STORE_LISTS": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "REQUEST_QUEUE_READS": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "REQUEST_QUEUE_WRITES": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "DATA_TRANSFER_INTERNAL_GBYTES": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "DATA_TRANSFER_EXTERNAL_GBYTES": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "PROXY_RESIDENTIAL_TRANSFER_GBYTES": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "PROXY_SERPS": {
                                        "type": "integer",
                                        "example": 0
                                    }
                                }
                            }
                        }
                    }
                }
            }
        }
    }
}
```
