# Google Trends API: Real-Time & Historical Search Trends (`unitbytes/google-trends-api`) Actor

Extract real-time Google search trends, historical keyword interest, regional demand, and related queries without rate limits. Fast, proxy-rotated, and pay per event.

- **URL**: https://apify.com/unitbytes/google-trends-api.md
- **Developed by:** [UnitBytes | Enterprise Web Data](https://apify.com/unitbytes) (community)
- **Categories:** SEO tools, AI
- **Stats:** 16 total users, 4 monthly users, 82.3% runs succeeded, 1 bookmarks
- **User rating**: 5.00 out of 5 stars

## Pricing

from $0.30 / 1,000 result scrapeds

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

<p align="center">
  <a href="https://console.apify.com/actors/tg7YFhLVLZIua8gyH/input" target="_blank">
    <img src="https://raw.githubusercontent.com/unitbytes/.github/main/assets/banners/unitbytes-google-trends-realtime-keyword-api-banner.jpg" alt="Google Trends API for Developers & AI Agents by UnitBytes" width="100%" />
  </a>
</p>

<p align="center">
  <a href="https://console.apify.com/actors/tg7YFhLVLZIua8gyH/input" target="_blank">
    <img src="https://raw.githubusercontent.com/unitbytes/.github/main/assets/try-it-for-free.svg" width="240" height="48" alt="Try it for Free">
  </a>
  <br>
  <sub>⚡ <b>Developer Trial:</b> Run live queries with Apify free monthly credit • No credit card required</sub>
</p>

## ⚡ Google Trends API — Real-Time & Historical Search Trends

> **The fastest, cleanest programmatic Google Trends REST API on Apify.** Extract real-time search pulses, 20-year historical timelines, regional demand down to DMA Metros, and breakout queries (+5,000%) formatted as **100% unnested flat JSON records**. Built specifically for **LLM agents (Claude MCP, Cursor), automated data pipelines, and developer backends**.

<div align="center">

| 🤖 MCP Native | ⚡ Sub-Second Response | 📊 Flat Unnested JSON | 🛍️ Web • YouTube • Shopping | 💰 $0 Start Fee (~1¢/query) |
| :---: | :---: | :---: | :---: | :---: |
| Claude & Cursor Ready | 256MB RAM Container | Pandas & DB Ready | 5 Separate Google Indexes | 4-Tier Volume PPE |

</div>

***

<table>
  <tr>
    <td colspan="2" style="padding:10px 14px;background:#059669;color:#FFFFFF;font-size:13px;font-weight:700;border-radius:6px 6px 0 0">
      ⚡ UnitBytes · Search Trends & Market Demand Intelligence Ecosystem
    </td>
  </tr>
  <tr>
    <td style="padding:10px 12px;border:1px solid #E2E8F0;background:#FFF4ED;vertical-align:top;width:50%">
      <span style="white-space:nowrap">📊 <b><a href="https://apify.com/unitbytes/google-trends-api?fpr=939u3w&fp_sid=ecosystem" style="color:#C2410C;text-decoration:none;font-size:13px">Google Trends Fast API</a></b></span><br><span style="color:#EA580C;font-size:11px;font-weight:700">📍 You are here</span><br>
      <span style="color:#64748B;font-size:11px">Flat JSON, low-latency REST API, MCP for AI Agents</span>
    </td>
    <td style="padding:10px 12px;border:1px solid #E2E8F0;background:#FAFAFA;vertical-align:top;width:50%">
      <span style="white-space:nowrap">📈 <b><a href="https://apify.com/unitbytes/google-trends-scraper?fpr=939u3w&fp_sid=ecosystem" style="color:#0F172A;text-decoration:none;font-size:13px">Google Trends All-in-One Scraper</a></b></span><br><span style="color:#2563EB;font-size:11px;font-weight:600">Marketers & Spreadsheets</span><br>
      <span style="color:#64748B;font-size:11px">1-Click Excel/CSV rows, visual heatmaps, legacy JSON</span>
    </td>
  </tr>
</table>

***

### ✨ Key Features

#### 1. ⚡ High-Speed Execution & Sub-Second Latency

Designed from the ground up for low-latency production pipelines and automated AI workflows:

- **Instant Cold Starts:** Boots in milliseconds with zero heavy browser overhead.
- **Ultra-Lightweight Footprint:** Highly optimized memory usage running reliably inside the 256MB tier without OOM crashes.
- **Fast Response Times:** Delivers near-instant search trend results ideal for synchronous API calls.

#### 2. 📊 100% Unnested Flat JSON Output (Zero Post-Processing Required)

Every data point is pushed as an individual, clean, flat JSON object.

- Direct insertion into **PostgreSQL, BigQuery, MongoDB, ClickHouse, or Snowflake**.
- 1-line ingestion in Python: `df = pd.DataFrame(items)`.
- Zero nested `data: []` arrays or messy envelope parsing.

#### 3. 🎯 All 5 Google Search Properties in One Endpoint (`gprop`)

Query Google's specialized search databases directly:

- 🌐 **Web Search (`web`)**: Broad macro consumer interest.
- 🎥 **YouTube Search (`youtube`)**: Video creator topics, game tags, and video SEO.
- 🛍️ **Google Shopping (`froogle`)**: High-intent physical product e-commerce trends.
- 🖼️ **Image Search (`images`)**: Visual asset demand, design aesthetics, and wallpapers.
- 📰 **News Search (`news`)**: Editorial media coverage and PR news cycles.

#### 4. 🛡️ Built-in Rate Limit Resilience & Smart Proxy Rotation

Google Trends frequently rate-limits automated requests. This actor includes smart automatic session rotation and retry logic out of the box. If a rate limit or network slowdown occurs, the actor automatically switches sessions and transparently fulfills the request without crashing or dropping data.

#### 5. 🤖 Native Model Context Protocol (MCP) Server for AI Agents

Connect directly to **Cursor IDE, Claude Desktop, Claude Code, or autonomous agent frameworks** using Apify's hosted MCP integration. Your AI agent can look up real-time search trends and historical keyword demand on the fly.

#### 6. 💰 Zero Startup Penalty & 4-Tier Volume Pricing

Other scrapers charge a hidden **$0.025 penalty** every single time they start. With UnitBytes, the start fee is virtually zero ($0.00005) and results cost as low as **$0.00030 per extracted data point**, making high-frequency micro-queries and agent tools extremely affordable.

***

### 💼 High-Value Use Cases & Engineering Playbooks

#### 🤖 1. Autonomous AI Agents & Real-Time RAG

- **The Problem:** LLMs have fixed knowledge cutoff dates and cannot gauge whether a topic is currently surging in public interest.
- **The Solution:** Wire this actor into your LangChain, LlamaIndex, or AutoGen toolchain via MCP or REST API. Before generating market reports, content plans, or investment memos, the agent retrieves real-time 30-day search volumes and breakout topics.

#### ✍️ 2. Programmatic SEO & Trend-Jacked Content Generation

- **The Problem:** Competing for saturated keywords takes months of backlink acquisition.
- **The Solution:** Run a daily cron job calling `related_queries` for your industry seed terms. Automatically identify terms with the **`+5,000% Breakout`** flag and trigger automated drafting pipelines before competitors even spot the trend.

#### 🛍️ 3. E-Commerce Product Research & Demand Forecasting

- **The Problem:** Amazon and Shopify sellers often stock inventory after a trend has already peaked.
- **The Solution:** Query `gprop: "froogle"` (Google Shopping) across candidate products. Identify items with hockey-stick demand curves 4–8 weeks ahead of holiday peaks and wholesale stockouts.

#### 📈 4. Quantitative Trading & Consumer Sentiment Signals

- **The Problem:** Quarterly earnings and SEC filings are lagging indicators.
- **The Solution:** Track multi-year timelines using `interest_over_time` for publicly traded tickers, consumer brands, retail trends, and cryptocurrencies to feed alternative sentiment data into trading strategies.

#### 🚨 5. Real-Time Viral Spikes & Breaking News Monitoring

- **The Problem:** Manual trend tracking on social media is noisy and delayed.
- **The Solution:** Poll `trending_now` with `trending_hours: 24` every hour to detect emerging viral news, celebrity spikes, and sports events complete with search volumes, growth percentages, and context news articles.

***

### 🤖 30-Second AI Agent Setup (Model Context Protocol - MCP)

Give **Claude Desktop, Cursor, Claude Code, or autonomous LLM agents** instant live search trend intelligence via Apify's hosted MCP server.

#### 1. Claude Desktop Configuration

Add this to your `claude_desktop_config.json`:

```json
{
  "mcpServers": {
    "google-trends": {
      "command": "npx",
      "args": ["-y", "@apify/mcp-server@latest"],
      "env": {
        "APIFY_TOKEN": "YOUR_APIFY_API_TOKEN",
        "ACTORS": "unitbytes/google-trends-api"
      }
    }
  }
}
```

#### 2. Sample AI Prompt

> *"Research the current breakout search queries for artificial intelligence tools in the US over the last 30 days using Google Trends, and tell me which 3 topics have grown over 500%."*

***

### 🚀 1-Line Synchronous REST API Call (cURL)

Call the actor synchronously and get the parsed flat JSON dataset returned directly in the HTTP response:

```bash
curl -X POST "https://api.apify.com/v2/acts/unitbytes~google-trends-api/run-sync-get-dataset-items?token=YOUR_APIFY_TOKEN" \
  -H "Content-Type: application/json" \
  -d '{
    "scrape_type": "interest_over_time",
    "keywords": ["OpenAI", "ChatGPT"],
    "predefined_timeframe": "today 3-m",
    "common_geo": "US"
  }'
```

***

### 📤 Sample Output Data (Flat Tabular JSON)

Every result is streamed as an individual, unnested flat object ready for immediate programmatic consumption:

#### 1. `interest_over_time` (Timeline Series)

```json
[
  {
    "scrape_type": "interest_over_time",
    "event_index": 1,
    "error": false,
    "keyword": "OpenAI",
    "value": 84,
    "date": "2026-09-14T00:00:00+00:00",
    "isPartial": false
  },
  {
    "scrape_type": "interest_over_time",
    "event_index": 2,
    "error": false,
    "keyword": "ChatGPT",
    "value": 96,
    "date": "2026-09-14T00:00:00+00:00",
    "isPartial": false
  }
]
```

#### 2. `trending_now` (Real-Time Viral Spikes)

```json
[
  {
    "scrape_type": "trending_now",
    "event_index": 1,
    "error": false,
    "keyword": "Champions League Draw",
    "geo": "US",
    "volume": 500000,
    "volume_growth_pct": 850,
    "topic_names": ["Soccer", "Sports"],
    "started_timestamp": "2026-10-02T14:00:00+00:00",
    "news": [
      {
        "title": "Champions League group stage draw results and reactions...",
        "source": "Sky Sports",
        "url": "https://..."
      }
    ]
  }
]
```

#### 3. `interest_by_region` (Sub-National Demand)

```json
[
  {
    "scrape_type": "interest_by_region",
    "event_index": 1,
    "error": false,
    "keyword": "Coffee",
    "geo": "US-NY-501",
    "geoName": "New York NY",
    "value": 100,
    "max_value_index": 0
  },
  {
    "scrape_type": "interest_by_region",
    "event_index": 2,
    "error": false,
    "keyword": "Coffee",
    "geo": "US-NY-555",
    "geoName": "Syracuse NY",
    "value": 78,
    "max_value_index": 0
  }
]
```

#### 4. `related_queries` (Breakout Mining)

```json
[
  {
    "scrape_type": "related_queries",
    "event_index": 1,
    "error": false,
    "keyword": "deepseek v3 api",
    "original_keyword": "AI tools",
    "value": 5000,
    "subset": "rising"
  },
  {
    "scrape_type": "related_queries",
    "event_index": 2,
    "error": false,
    "keyword": "chatgpt login",
    "original_keyword": "AI tools",
    "value": 100,
    "subset": "top"
  }
]
```

#### 5. `related_topics` (Knowledge Graph Entities)

```json
[
  {
    "scrape_type": "related_topics",
    "event_index": 1,
    "error": false,
    "keyword": "Large language model",
    "original_keyword": "ChatGPT",
    "value": 5000,
    "subset": "rising",
    "topic_type": "Topic",
    "topic_mid": "/m/012bh6f4"
  }
]
```

***

### ⚙️ Input Parameters Reference

| Parameter | Type | Default | Description |
| :--- | :--- | :--- | :--- |
| `scrape_type` | `string` | `"interest_over_time"` | Target endpoint: `interest_over_time`, `trending_now`, `interest_by_region`, `related_queries`, `related_topics` |
| `keywords` | `array[string]` | `["OpenAI", "ChatGPT"]` | Terms to analyze (up to 5 keywords). Required for all modes except `trending_now` |
| `output_format` | `string` | `"flat"` | Data layout: `"flat"` (clean unnested JSON rows) or `"legacy"` (consolidated nested envelope) |
| `gprop` | `string` | `""` | Search property: `""` or `"web"` (Web Search), `"youtube"` (YouTube), `"froogle"` (Shopping), `"images"` (Images), `"news"` (News) |
| `timeframe_type` | `string` | `"predefined"` | Timeframe mode: `"predefined"` or `"custom"` |
| `predefined_timeframe` | `string` | `"today 12-m"` | Preset ranges: `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_timeframe` | `string` | `""` | Custom date range: `'YYYY-MM-DD YYYY-MM-DD'` (e.g. `'2025-01-01 2026-01-01'`) |
| `geo_selection_type` | `string` | `"Common Countries"` | Geo selector: `"Common Countries"` or `"Custom Geo Code"` |
| `common_geo` | `string` | `"US"` | 2-letter ISO country code (`US`, `GB`, `DE`, `FR`, `CA`, etc.) or leave empty for Worldwide |
| `custom_geo_code` | `string` | `""` | Sub-national ISO code (e.g. `US-CA`, `US-NY`, `GB-ENG`) |
| `geo_resolution` | `string` | `"COUNTRY"` | Regional granularity for `interest_by_region`: `COUNTRY`, `REGION`, `CITY`, or `DMA` |
| `trending_hours` | `integer` | `24` | Hours back for `trending_now` (1 to 191 hours) |
| `trending_language` | `string` | `"en"` | Language code for real-time trending titles |
| `inc_low_vol` | `boolean` | `false` | Include low search volume geographies in regional breakdown |
| `max_events` | `integer` | `10000` | Safety limit on maximum results returned |
| `proxyConfiguration` | `object` | `{"useApifyProxy": true, "apifyProxyGroups": ["RESIDENTIAL"]}` | Residential proxies automatically provisioned; custom proxies also supported |

***

### 💻 SDK Integration Snippets

#### Python (`pandas` / Polars Ready)

```python
from apify_client import ApifyClient
import pandas as pd

client = ApifyClient("YOUR_APIFY_TOKEN")

## Run Google Trends Fast API synchronously
run = client.actor("unitbytes/google-trends-api").call(run_input={
    "scrape_type": "interest_over_time",
    "keywords": ["Python", "Rust"],
    "predefined_timeframe": "today 12-m",
    "common_geo": "US"
})

## Load clean flat records directly into DataFrame
items = client.dataset(run["defaultDatasetId"]).list_items().items
df = pd.DataFrame(items)
print(df.head())
```

#### TypeScript / Node.js

```typescript
import { ApifyClient } from "apify-client";

const client = new ApifyClient({ token: "YOUR_APIFY_TOKEN" });

async function getTrends() {
  const run = await client.actor("unitbytes/google-trends-api").call({
    scrape_type: "related_queries",
    keywords: ["Next.js"],
    common_geo: "US",
  });

  const { items } = await client.dataset(run.defaultDatasetId).listItems();
  console.log(items);
}

getTrends();
```

***

### 💎 Pay-Per-Event Pricing (Zero Start Penalty)

Operates on Apify's **Pay-Per-Event (PPE)** model with volume discount tiers:

| Apify Plan Tier | Unit Price per Result | Cost per 25-Item Query | Run Start Fee |
| :--- | :--- | :--- | :--- |
| **Free** | $0.00045 | **~$0.011** (1.1¢) | **$0.00** ($0.00005) |
| **Starter** | $0.00040 | **~$0.010** (1.0¢) | **$0.00** ($0.00005) |
| **Scale** | $0.00035 | **~$0.008** (0.8¢) | **$0.00** ($0.00005) |
| **Enterprise / Custom** | $0.00030 | **~$0.007** (0.7¢) | **$0.00** ($0.00005) |

- **Zero Startup Penalty**: Test individual queries for fractions of a cent ($0.00005 vs. the $0.025 tax charged by competing scrapers).
- **Residential Proxies Included**: High-performance rotating residential proxies with automatic rate-limit resilience included at no extra cost.
- **No Charge for Errors**: You are billed exclusively for valid trend data points successfully extracted.

***

### 🤖 Ask an AI Assistant About This Scraper

Open a ready-to-run prompt about Google Trends API in your favorite AI assistant:

- 💬 [Ask ChatGPT](https://chatgpt.com/?q=Using%20the%20Google%20Trends%20API%20on%20Apify%20%28https%3A//apify.com/unitbytes/google-trends-api%29%2C%20show%20me%20how%20to%20query%20sub-second%20search%20trends%20for%20AI%20tools%20using%20the%20synchronous%20REST%20endpoint%20and%20load%20the%20flat%20JSON%20into%20Python%20pandas.)
- 🧠 [Ask Claude](https://claude.ai/new?q=Using%20the%20Google%20Trends%20API%20on%20Apify%20%28https%3A//apify.com/unitbytes/google-trends-api%29%2C%20show%20me%20how%20to%20query%20sub-second%20search%20trends%20for%20AI%20tools%20using%20the%20synchronous%20REST%20endpoint%20and%20load%20the%20flat%20JSON%20into%20Python%20pandas.)
- 🔍 [Ask Perplexity](https://www.perplexity.ai/search?q=Using%20the%20Google%20Trends%20API%20on%20Apify%20%28https%3A//apify.com/unitbytes/google-trends-api%29%2C%20show%20me%20how%20to%20query%20sub-second%20search%20trends%20for%20AI%20tools%20using%20the%20synchronous%20REST%20endpoint%20and%20load%20the%20flat%20JSON%20into%20Python%20pandas.)

***

### ❓ Frequently Asked Questions (FAQ)

**Q: How fast is this API compared to other Google Trends actors?**\
A: Most alternative scrapers take 15 to 30 seconds per execution due to heavy browser overhead. This API actor is built with an ultra-lightweight direct protocol architecture, delivering cold starts in milliseconds and returning complete query results in just a few seconds.

**Q: What is the difference between this Fast API and the All-in-One Scraper?**\
A: Both share the exact same resilient engine. However:

- **Fast API (`unitbytes/google-trends-api`)**: Defaults to **`flat`** unnested JSON records designed for programmatic APIs, database pipelines, and AI agents.
- **All-in-One Scraper (`unitbytes/google-trends-scraper`)**: Defaults to **`legacy`** nested envelopes and optimized schema definitions for 1-click Excel/CSV spreadsheet exports for non-technical users and marketers.

**Q: How do I call this actor synchronously in my application?**\
A: Use Apify’s synchronous endpoint:
`POST https://api.apify.com/v2/acts/unitbytes~google-trends-api/run-sync-get-dataset-items?token=YOUR_TOKEN`. The HTTP request will hold open and return the parsed JSON array directly in the HTTP response body.

**Q: Do I need to buy or configure residential proxies?**\
A: No. High-performance rotating residential proxies are automatically provisioned and managed by the actor at no extra cost.

**Q: How does the engine handle Google rate limits?**\
A: The actor automatically detects rate limits and temporary blocks, immediately switches to a fresh proxy session, and safely retries the request so your application or pipeline never receives a broken response.

**Q: Can I use this with Model Context Protocol (MCP) in Cursor or Claude Desktop?**\
A: Yes! Use `@apify/mcp-server` with `ACTORS="unitbytes/google-trends-api"`. Your AI agent can invoke Google Trends live during coding or reasoning sessions.

**Q: Is there a startup fee penalty?**\
A: No. Most actors charge a hidden $0.025 startup tax. UnitBytes charges virtually $0.00 ($0.00005) to start, allowing you to run frequent small queries cost-effectively.

***

### 📞 Support, Bug Reports & Feature Requests

Need help integrating Google Trends API, found a bug, or want a custom endpoint / AI integration?

- 🐛 **Bug Reports & Technical Issues**: Open a ticket on the [Apify Issues Tab](https://console.apify.com/actors/tg7YFhLVLZIua8gyH/issues)
- 💡 **Feature Requests & Custom Endpoints**: Submit your request on the [Issues Tab](https://console.apify.com/actors/tg7YFhLVLZIua8gyH/issues) or email us directly.
- 📧 **Direct Developer Support & Enterprise Inquiries**: <contact@unitbytes.com>
- 🌐 **Developer Platform**: <https://unitbytes.com>
- 💬 **Apify Creator Profile**: [unitbytes on Apify](https://apify.com/unitbytes)

# Actor input Schema

## `scrape_type` (type: `string`):

Select the type of data to retrieve. 'Trending now' ignores keywords.

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

Enter the terms you want to analyze. REQUIRED for all types EXCEPT 'Trending now'.

## `gprop` (type: `string`):

Target specific Google search indexes: 'Google Shopping' for physical product demand, 'YouTube Search' for video creator trends, 'Image Search' for visual assets, 'News Search' for media spikes, or 'Web Search' (default).

## `timeframe_type` (type: `string`):

Choose between a predefined range (easier) or a custom specific range.

## `predefined_timeframe` (type: `string`):

Select a standard time window.

## `custom_timeframe` (type: `string`):

Format: 'YYYY-MM-DD YYYY-MM-DD'. Example: '2023-01-01 2023-12-31'. Leave empty if using Predefined.

## `geo_selection_type` (type: `string`):

Choose how to specify the location.

## `common_geo` (type: `string`):

Select the country code.

## `custom_geo_code` (type: `string`):

Specific code like 'US-NY' (New York) or 'US-CA' (California).

## `output_format` (type: `string`):

Choose dataset output structure. 'legacy' preserves backward compatibility (single nested object). 'flat' outputs one record per data point (best for Excel, CSV, Google Sheets).

## `geo_resolution` (type: `string`):

Level of detail for 'Interest by region'.

## `inc_low_vol` (type: `boolean`):

Get data even for regions with low search volume (slower).

## `trending_language` (type: `string`):

Language for 'Trending now' scrape type.

## `trending_hours` (type: `integer`):

Hours back for 'Trending now' (Max 191).

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

Crucial for avoiding Google blocks. Use Apify Proxy (Residential) for best results.

## `max_events` (type: `integer`):

Internal limit for backward compatibility

## `acknowledge_costs` (type: `boolean`):

Internal flag for backward compatibility

## Actor input object example

```json
{
  "scrape_type": "interest_over_time",
  "keywords": [
    "OpenAI",
    "ChatGPT"
  ],
  "gprop": "web",
  "timeframe_type": "predefined",
  "predefined_timeframe": "today 12-m",
  "custom_timeframe": "2023-01-01 2023-12-31",
  "geo_selection_type": "Common Countries",
  "common_geo": "US",
  "custom_geo_code": "",
  "output_format": "flat",
  "geo_resolution": "COUNTRY",
  "inc_low_vol": false,
  "trending_language": "en",
  "trending_hours": 24,
  "proxyConfiguration": {
    "useApifyProxy": true,
    "apifyProxyGroups": [
      "RESIDENTIAL"
    ]
  },
  "max_events": 10000,
  "acknowledge_costs": true
}
```

# Actor output Schema

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

No description

# 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": [
        "OpenAI",
        "ChatGPT"
    ],
    "custom_timeframe": "2023-01-01 2023-12-31",
    "common_geo": "US"
};

// Run the Actor and wait for it to finish
const run = await client.actor("unitbytes/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": [
        "OpenAI",
        "ChatGPT",
    ],
    "custom_timeframe": "2023-01-01 2023-12-31",
    "common_geo": "US",
}

# Run the Actor and wait for it to finish
run = client.actor("unitbytes/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": [
    "OpenAI",
    "ChatGPT"
  ],
  "custom_timeframe": "2023-01-01 2023-12-31",
  "common_geo": "US"
}' |
apify call unitbytes/google-trends-api --silent --output-dataset

```

## MCP server setup

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