# Google Trends Scraper (`alpha-scraper/google-trends-scraper`) Actor

\[ 1k / 1$ ] Google Trends scraper: get interest over time, interest by region, related queries and topics, or current trending searches for any search term. Filter by region, time range, category and Google property: web, images, news, YouTube, shopping.

- **URL**: https://apify.com/alpha-scraper/google-trends-scraper.md
- **Developed by:** [Alpha Scraper](https://apify.com/alpha-scraper) (community)
- **Features:** Limited permissions
- **Stats:** 2 total users, 1 monthly users, 100.0% runs succeeded, 0 bookmarks
- **User rating**: No ratings yet

## Pricing

Pay per event + usage

This Actor is paid per event and usage. You are charged both the fixed price for specific events and for Apify platform usage.
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 Scraper

Google Trends Scraper is an Apify Actor that collects search-trend data from Google Trends and returns it as clean, structured records.
Google Trends scraper: get interest over time, interest by region, related queries and topics, or current trending searches for any search term.
Instead of copying Google Trends pages by hand, you enter your keywords, choose a few options, and receive one JSON record for every trend record that Google Trends returns.

**Who is it for?** SEO and SERP analysts; market and keyword researchers; content strategists.
**What problem does it solve?** Collecting Google Trends information by hand is slow and hard to repeat. Google Trends Scraper returns the same documented Google Trends fields every time, ready for spreadsheets, databases and dashboards.
**What data do you get?** 46 documented Google Trends fields per record, exported as JSON, CSV, Excel, XML, HTML or RSS.
**What is the easiest way to start?** Open Google Trends Scraper on Apify, keep the pre-filled input, lower `maxItems`, and press Start.

> **📌 Google Trends Scraper at a glance**
>
> - **Platform:** Google Trends
> - **Category:** search-trend
> - **Input fields:** 12 · **Output fields:** 46
> - **Listed price:** $1.00 per 1,000 results

### ✨ Google Trends Scraper Key Features

The Actor turns online trend records into structured data with a short list of inputs and a documented output.
Here is what Google Trends Scraper offers:

- **Keyword input:** Google Trends Scraper accepts one or many entries in `queries` and processes each entry on its own.
- **Result limit:** `maxItems` caps the Google Trends records per run, so test runs of Google Trends Scraper stay small and costs predictable.
- **Structured output:** 46 documented Google Trends fields in a consistent JSON structure.
- **Export anywhere:** download the Google Trends data as JSON, CSV, Excel, XML, HTML or RSS, or read the dataset through the Apify API.
- **Run summary:** a `RUN_SUMMARY` record and the status message report counts and the first problem of every run of the Actor.
- **Region (geo)** (`geo`): Where the searches were made: a country code such as US, GB or DE, or a sub-region such as US-CA (California).
- **Time Range** (`timeRange`): Period of the Google Trends data. Pick a preset or type your own range as 'YYYY-MM-DD YYYY-MM-DD' (for example '2024-01-01…
- **Category ID** (`category`): Google Trends category id that narrows the term to one topic area.

> **💡 Why use Google Trends Scraper?**
>
> - You work with documented Google Trends fields instead of raw pages.
> - You can repeat the same Google Trends job on a schedule and compare results over time.
> - You can start small with Google Trends Scraper, check the output, and scale up when you are happy.

### 🔍 What Data Can Google Trends Scraper Extract?

Each record describes one trend record found on Google Trends.
The schema documents 46 fields: 13 core fields that appear in almost every record, 6 common fields and 27 conditional fields that appear only when Google Trends provides the value or the matching option is on.

- `recordType`: Record type
- `keyword`: Keyword
- `value`: Value
- `formattedValue`: Formatted value
- `geo`: Region
- `timeRange`: Time range
- `property`: Google property
- `keywordKind`: Keyword type

The Output section below lists more Google Trends fields with their types and shows a real sample record collected by Google Trends Scraper.

### ⚙️ How Google Trends Scraper Works

The workflow of the Actor is intentionally simple, and Google Trends Scraper needs no code:

1. You provide a JSON input or fill the Console form; missing options use their documented defaults.
2. For every entry in `queries`, Google Trends Scraper requests results from Google Trends, page after page, until it has `maxItems` records or the source site has no more matches.
3. With `fetchDetails` on, Google Trends Scraper also opens each record's detail page and adds the extra fields.
4. Each record is cleaned and mapped to the documented fields; values that Google Trends does not provide are left out instead of guessed.
5. Records are saved to the default dataset in small batches, and a `RUN_SUMMARY` record closes the run of Google Trends Scraper.

### 🚀 How to Use Google Trends Scraper

You can run the Actor in a few minutes. Follow these steps in the Apify Console:

1. Open the page of Google Trends Scraper on Apify and select the **Input** tab.
2. Enter your Google Trends keywords in **Search Terms** (`queries`).
3. Set **Max Items Per Search Term** (`maxItems`) to a small number such as 20 for the first run.
4. Press **Start**, then open the **Output** tab to browse the Google Trends dataset and use **Export** to download it.
5. Save the input as a **Task** and add a **Schedule** to repeat Google Trends Scraper runs.

A quick start input for Google Trends Scraper:

```json
{
  "queries": ["python"],
  "maxItems": 20
}
```

With this input, the Actor searches Google Trends for the keywords shown and returns at most `maxItems` records.

### 🛒 How to Scrape Google Trends trend records with Google Trends Scraper

To scrape Google Trends trend records, add your keywords to `queries`, set `maxItems`, and start Google Trends Scraper. Each keyword is processed separately, so ten keywords produce ten Google Trends searches that share one dataset.

#### 📁 Can You Export Google Trends Data to CSV, Excel or JSON?

Yes. Every run of Google Trends Scraper stores its Google Trends records in a dataset that you can download as JSON, CSV, Excel, XML, HTML or RSS from the Console or through the API.

#### ⏰ Can You Schedule Google Trends Scraper to Monitor Google Trends?

Yes. Save your input as a Task, attach a Schedule, and compare the Google Trends dataset of every run.

### 📥 Google Trends Scraper Input

This table lists every input field of Google Trends Scraper, taken from the Actor's input schema. The form is pre-filled with a working example.

#### 🧾 Google Trends Scraper Input Fields

|Field|Type|Default|Purpose|
|---|---|---|---|
|`queries`|array|\["python"]|Keywords whose Google Trends data you want, for example 'python' or 'electric cars'.|
|`maxItems`|integer|15|Maximum number of records per search term, counted over all data types together.|
|`geo`|string|"US"|Where the searches were made: a country code such as US, GB or DE, or a sub-region such as US-CA…|
|`timeRange`|string|"today 12-m"|Period of the data. Pick a preset or type your own range as 'YYYY-MM-DD YYYY-MM-DD' (for example…|
|`category`|integer|0|Google Trends category id that narrows the term to one topic area.|
|`property`|string|""|Which Google search the interest is measured on: web search, image search, news search, YouTube…|
|`dataTypes`|array|\["relatedQueries", "i…|Which Google Trends widgets to read for every term (one extra request each): interest over time…|
|`regionResolution`|string|"REGION"|Granularity of the 'interest by region' table: sub-regions (states or provinces), countries, cities…|
|`language`|string|"en-US"|Interface language of Google Trends (for example en-US, de, fr), sent as 'hl'.|
|`timezoneOffset`|integer|0|Time zone used for the time points, sent as Google Trends' 'tz' parameter in minutes.|
|`fetchDetails`|boolean|true|Give each related query or topic its own interest-over-time curve plus peak date and value, average…|
|`detailLimit`|integer|5|How many related queries or topics per search term get their own curve (2 requests each).|

#### 📝 Google Trends Scraper Input Examples

These are valid inputs for Google Trends Scraper. Copy one into the JSON editor of the input form, or send it through the API.

#### 🧪 Example 1: Minimal input

The smallest useful input: your Google Trends keywords and a result limit. Every other option keeps its default.

```json
{
  "queries": ["python"],
  "maxItems": 20
}
```

#### 🧪 Example 2: Typical input with the documented defaults

Every option that has a documented default, shown with that default value so you can see the full shape of the input.

```json
{
  "queries": ["python"],
  "maxItems": 20,
  "geo": "US",
  "timeRange": "today 12-m",
  "category": 0,
  "property": "",
  "dataTypes": ["relatedQueries", "interestByRegion", "interestOverTime"],
  "regionResolution": "REGION",
  "language": "en-US",
  "timezoneOffset": 0,
  "fetchDetails": true,
  "detailLimit": 5
}
```

#### 🧪 Example 3: Region (geo) set to "GB"

Changes `geo` and keeps the other defaults.

```json
{
  "queries": ["python"],
  "maxItems": 20,
  "geo": "GB",
  "timeRange": "today 12-m",
  "category": 0,
  "property": "",
  "dataTypes": ["relatedQueries", "interestByRegion", "interestOverTime"],
  "regionResolution": "REGION",
  "language": "en-US",
  "timezoneOffset": 0,
  "fetchDetails": true,
  "detailLimit": 5
}
```

### 📤 Google Trends Scraper Output

The Actor stores one record per trend record in the default dataset of the run. The table shows the most common of the 46 documented Google Trends fields.

#### 📋 Google Trends Scraper Output Fields

|Field|Type|Description|
|---|---|---|
|`recordType`|string|Kind of record: `interestOverTime` (one point of the time curve)…|
|`keyword`|string|Search term or topic the record is about.|
|`value`|integer|Interest value: relative popularity from 0 to 100 for time points, regions and…|
|`formattedValue`|string|Value as Google Trends displays it: a plain number, a percentage with a plus…|
|`geo`|string|Region the data covers: a country code, a sub-region code or `WORLDWIDE`.|
|`timeRange`|string|Time range you requested, in Google Trends notation, such as a past period or a…|
|`property`|string|Google service the data comes from: `web`, `images`, `news`, `youtube` or…|
|`keywordKind`|string|Type Google Trends assigns to the searched term, such as a plain search term or…|
|`suggestedTopic`|object|Object with Google's first topic suggestion for the searched term: mid…|
|`suggestedTopics`|array|List of up to 8 topic suggestions from Google for the searched term, each with…|
|`searchQuery`|string|Entry from your list that produced the record: a search term, a topic ID or a…|
|`rank`|integer|Position of the record within its search entry, starting at 1.|

#### 🧬 Google Trends Scraper Sample Output

This record comes from a real run of Google Trends Scraper. Long texts and lists are shortened, only common fields are shown, and contact details, personal names, usernames and profile links are hidden.

```json
{
  "recordType": "relatedQuery",
  "keyword": "python",
  "geo": "US",
  "timeRange": "today 12-m",
  "property": "web",
  "keywordKind": "Search term",
  "suggestedTopic": {"mid": "/m/05z1_", "title": "Python", "type": "Programming language"},
  "suggestedTopics": [
    {"mid": "/m/05z1_", "title": "Python", "type": "Programming language"},
    {
      "mid": "/g/11g0jcybmg",
      "title": "Deep Learning with Python",
      "type": "Book by François Chollet"
    }
  ],
  "value": 100,
  "formattedValue": "100",
  "query": "what is python",
  "searchQuery": "python",
  "rank": 1,
  "scrapedAt": "2026-11-15T08:45:10Z"
}
```

**Sample record 2**

```json
{
  "recordType": "interestByRegion",
  "keyword": "python",
  "geo": "US",
  "timeRange": "today 12-m",
  "property": "web",
  "keywordKind": "Search term",
  "suggestedTopic": {"mid": "/m/05z1_", "title": "Python", "type": "Programming language"},
  "suggestedTopics": [
    {"mid": "/m/05z1_", "title": "Python", "type": "Programming language"},
    {
      "mid": "/g/11g0jcybmg",
      "title": "Deep Learning with Python",
      "type": "Book by François Chollet"
    }
  ],
  "value": 38,
  "formattedValue": "38",
  "searchQuery": "python",
  "rank": 48,
  "scrapedAt": "2026-11-15T08:45:36Z"
}
```

#### 🔬 Google Trends Scraper Field Details

Each field below is described with its type, how often it appears in the sample and example values.

- **`recordType`** (string, present in 60 of 60 sample records): Kind of record: `interestOverTime` (one point of the time curve), `interestByRegion` (one region), `relatedQuery`. Examples: `"relatedQuery"`, `"interestByRegion"`.
- **`keyword`** (string, present in 60 of 60 sample records): Search term or topic the record is about. Examples: `"python"`.
- **`value`** (integer, present in 60 of 60 sample records): Interest value: relative popularity from 0 to 100 for time points, regions and top related items, or percentage growth for rising related items. Examples: `100`, `71`.

### 🎯 Google Trends Scraper Use Cases

People use Google Trends Scraper when they need repeatable, structured search-trend data from the source site. Typical applications:

- Collect results or suggestions for a keyword
- Analyse which pages and domains appear for a query
- Discover long-tail ideas and related searches
- Track how results change over time
- Build keyword and topic datasets
- Export Google Trends results for SEO reporting

Every one of these tasks starts from the same Google Trends records that Google Trends Scraper stores in the dataset.

### 💰 Google Trends Scraper Pricing

The Actor description lists the price of the Actor as **$1.00 per 1,000 results**.
The table shows what that rate means for typical run sizes.

|Results|Cost at the listed rate|
|---|---|
|100|$0.10|
|1,000|$1.00|
|10,000|$10.00|
|100,000|$100.00|

- Check the **Pricing** tab on the Actor page for the current terms; your Apify plan and platform usage may also apply.
- Test with a small `maxItems` value before a large run.

### 💻 Run Google Trends Scraper with the Apify API

You can start Google Trends Scraper from code and read the Google Trends records from the dataset.

#### 🐍 Run Google Trends Scraper from Python

Replace `ACTOR_ID` with the Actor ID shown on the Actor page and keep your token in an environment variable.

```python
from apify_client import ApifyClient

client = ApifyClient("YOUR_APIFY_TOKEN")
run = client.actor("ACTOR_ID").call(run_input={'queries': ['python'], 'maxItems': 20})
for item in client.dataset(run["defaultDatasetId"]).iterate_items():
    print(item)
```

### 🔗 Integrations and Automation

Google Trends Scraper works with schedules, webhooks, the Apify API and many integrations.

#### 🔌 Connect the Actor to Google Sheets

- Open the Integrations tab of the Actor or Task in the Apify Console and add the Google Sheets integration.
- Authorise your Google account and pick the spreadsheet and the worksheet.
- Choose whether each run appends rows or replaces the sheet content.
- Start a run; when it succeeds the rows appear in your spreadsheet automatically.
- Once a run succeeds, the Google Trends data is ready to use in Google Sheets.

### 🧭 Example Workflows with Google Trends Scraper

These workflows show how teams combine Google Trends Scraper with schedules, storage and analysis tools.

#### 🧭 Weekly monitoring dashboard

1. Create a Task with your Google Trends keywords and a fixed `maxItems`.
2. Add a weekly schedule and a webhook on success.
3. Let the webhook append the Google Trends dataset to Google Sheets or a database.
4. Chart the 46-field records in Looker Studio, Power BI or Tableau.
5. Review the RUN_SUMMARY record whenever a number looks unusual.

### 🛠️ Tips and Best Practices

Follow these tips to get clean data from Google Trends Scraper faster:

- Start every new search with a small `maxItems` value so you can check the output and the cost before a big run.
- Change one input option at a time and compare the datasets; this makes it clear which option produced which effect.
- Save good inputs as Apify Tasks and give them descriptive names such as the keyword and the market.
- Use a schedule for monitoring jobs, and keep each run small so that Google Trends results arrive quickly.
- Treat every field except the identifiers as optional in your downstream code.
- Keep the raw JSON of important runs; it is the most complete representation of each record.
- Review `geo` (Region (geo)) before large runs: Where the searches were made: a country code such as US, GB or DE, or a sub-region such as US-CA (California).
- Review `timeRange` (Time Range) before large runs: Period of the Google Trends data. Pick a preset or type your own range as 'YYYY-MM-DD YYYY-MM-DD' (for example '2024-01-01…

### ⚖️ Legal and Responsible Use

Google Trends Scraper is meant for publicly available information, and you are responsible for how you use the Google Trends data. This is general information, not legal advice.

- Read and follow the terms of service and the published crawler rules of Google Trends before you run large jobs.
- Collect only the trend records and fields you need from the source site, and use them for a legitimate purpose.
- Treat names, handles and contact details as personal data where privacy laws such as GDPR or CCPA apply.
- Respect copyright and database rights when you republish Google Trends content, and honour removal requests.

### ❓ Frequently Asked Questions about Google Trends Scraper

Answers to common questions about Google Trends Scraper and about collecting Google Trends data.

#### ❓ How do I run the Actor?

Open the Actor page on Apify, fill in the input form, and press Start.
The same run can be started from the Apify API, the Apify CLI, a schedule, or an integration, using the identical JSON input shown in the Input section.
Google Trends Scraper saves every record to the run's default dataset, where you can preview and download it.

#### ❓ Do I need an Apify account to use Google Trends Scraper?

Yes. Google Trends Scraper runs on the Apify platform, so you need an Apify account to start it from the Console or the API.
A free account is enough to try the Actor on a small input; check your plan for the monthly credits it includes.

#### ❓ Can I run the Actor through the API?

Yes. Every Apify Actor can be started with the Apify API or one of the official clients for JavaScript and Python.
The API section of this page shows a copy-paste example that sends the same JSON input as the Console form.

#### ❓ How do I schedule Google Trends Scraper to run every day or every week?

Save your input as an Apify Task, then add a Schedule with a cron expression to that Task.
Each scheduled run creates a new dataset, so you can compare today's Google Trends results with yesterday's.

#### ❓ Which formats can I export the results in?

Apify datasets can be downloaded as JSON, JSONL, CSV, Excel, XML, HTML table and RSS.
Nested lists and objects are kept intact in JSON; for CSV or Excel choose the Google Trends fields you need or flatten nested fields in the export options.

#### ❓ How many results can I collect in one run?

The `maxItems` input field controls the limit. Its default is 15, with a minimum of 1.
The run also stops earlier when Google Trends has no more matching results for your input, so you may receive fewer records than requested.

### 🤝 Support

Need help with Google Trends Scraper or want a new field? Use the **Issues** tab on the Actor page and include the run link and your input.

- contact me by email : alphascraper69@gmail.com

# Actor input Schema

## `queries` (type: `array`):

Keywords whose Google Trends data you want, for example 'python' or 'electric cars'. A Knowledge Graph topic id such as /m/05z1\_ also works. Write 'trending' (or 'trending:GB' for a country) to get Google's current trending searches instead (about 10 per country). Every term is analysed on its own and gets its own 'Max Items Per Search Term'.

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

Maximum number of records per search term, counted over all data types together. A 12-month curve alone has about 53 weekly points and the region map has dozens of rows, so with the default of 15 only the first data types in the list below are filled. Raise it (for example to 500) to get everything. The records come in the order the data types are listed in the input.

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

Where the searches were made: a country code such as US, GB or DE, or a sub-region such as US-CA (California). Pick one from the list or type a Google Trends geo code. Clear the field (empty value) for worldwide. For 'trending' queries it is the country of the trending list.

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

Period of the data. Pick a preset or type your own range as 'YYYY-MM-DD YYYY-MM-DD' (for example '2024-01-01 2024-06-30'). Short ranges (hours, days) give hourly points, longer ones daily, weekly or monthly points chosen by Google. The 'trending' query ignores it.

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

Google Trends category id that narrows the term to one topic area. 0 means all categories. Common ids: 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, 14 People & Society, 66 Pets & Animals, 29 Real Estate, 174 Science, 18 Shopping, 20 Sports, 67 Travel.

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

Which Google search the interest is measured on: web search, image search, news search, YouTube search or Google Shopping.

## `dataTypes` (type: `array`):

Which Google Trends widgets to read for every term (one extra request each): interest over time (the curve), interest by region (map table), related queries (top and rising) and related topics. Note: Google answers non-browser clients with an empty related-topics list and generic 'rising' related queries, so related topics are off by default and usually return nothing.

## `regionResolution` (type: `string`):

Granularity of the 'interest by region' table: sub-regions (states or provinces), countries, cities or US metro areas (DMA). Which levels exist depends on the Region above (for example DMA is US-only, and worldwide data is by country). Used only when 'Interest by region' is selected.

## `language` (type: `string`):

Interface language of Google Trends (for example en-US, de, fr), sent as 'hl'. It changes names and labels such as region names, not which searches are counted. Pick a code from the list or type another one.

## `timezoneOffset` (type: `integer`):

Time zone used for the time points, sent as Google Trends' 'tz' parameter in minutes. Google's convention counts minutes behind UTC: 0 is UTC, 360 is UTC-6 (US Central), -60 is UTC+1 (Central Europe).

## `fetchDetails` (type: `boolean`):

Give each related query or topic its own interest-over-time curve plus peak date and value, average and latest value. This needs 2 extra requests per item, and Google Trends rate-limits aggressively, so only the first items are detailed (see the limit below). A 429 or 403 answer stops the run for that host; what was gathered is kept.

## `detailLimit` (type: `integer`):

How many related queries or topics per search term get their own curve (2 requests each). Related items beyond the limit are still returned with 'detailStatus' set to 'skipped'. 0 means no limit, which usually runs into Google's rate limit. Used only while 'Fetch Curves For Related Items' is on.

## Actor input object example

```json
{
  "queries": [
    "python"
  ],
  "maxItems": 15,
  "geo": "US",
  "timeRange": "today 12-m",
  "category": 0,
  "property": "",
  "dataTypes": [
    "relatedQueries",
    "interestByRegion",
    "interestOverTime"
  ],
  "regionResolution": "REGION",
  "language": "en-US",
  "timezoneOffset": 0,
  "fetchDetails": true,
  "detailLimit": 5
}
```

# Actor output Schema

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

Structured records extracted by Google Trends Scraper and stored in the run's default dataset.

# 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 = {
    "queries": [
        "python"
    ],
    "maxItems": 15,
    "dataTypes": [
        "relatedQueries",
        "interestByRegion",
        "interestOverTime"
    ]
};

// Run the Actor and wait for it to finish
const run = await client.actor("alpha-scraper/google-trends-scraper").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 = {
    "queries": ["python"],
    "maxItems": 15,
    "dataTypes": [
        "relatedQueries",
        "interestByRegion",
        "interestOverTime",
    ],
}

# Run the Actor and wait for it to finish
run = client.actor("alpha-scraper/google-trends-scraper").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 '{
  "queries": [
    "python"
  ],
  "maxItems": 15,
  "dataTypes": [
    "relatedQueries",
    "interestByRegion",
    "interestOverTime"
  ]
}' |
apify call alpha-scraper/google-trends-scraper --silent --output-dataset

```

## MCP server setup

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

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/3guYy5Exv5dofhMbT/builds/HQgjacXDwWqiXkm3S/openapi.json
