{
  "openapi": "3.0.1",
  "info": {
    "title": "Google Trends Scraper (interest over time, regions, related)",
    "description": "Scrape Google Trends: interest over time, interest by region, related queries, related topics and Trending Now, for any keyword, country and time range. Built-in retries, cookie sessions and proxy rotation. Pay per search term.",
    "version": "0.1",
    "x-build-id": "NZjpgmm7sF6RMQ5pv"
  },
  "servers": [
    {
      "url": "https://api.apify.com/v2"
    }
  ],
  "paths": {
    "/acts/scrapemole~google-trends-scraper/run-sync-get-dataset-items": {
      "post": {
        "operationId": "run-sync-get-dataset-items-scrapemole-google-trends-scraper",
        "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/scrapemole~google-trends-scraper/runs": {
      "post": {
        "operationId": "runs-sync-scrapemole-google-trends-scraper",
        "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/scrapemole~google-trends-scraper/run-sync": {
      "post": {
        "operationId": "run-sync-scrapemole-google-trends-scraper",
        "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",
        "properties": {
          "mode": {
            "title": "What to scrape",
            "enum": [
              "explore",
              "trendingNow"
            ],
            "type": "string",
            "description": "<b>Explore</b> returns interest over time, by region and related queries/topics for your search terms (like trends.google.com/explore). <b>Trending now</b> returns today's trending searches with related news for one or more countries.",
            "default": "explore"
          },
          "searchTerms": {
            "title": "Search terms",
            "type": "array",
            "description": "Keywords to look up, one per line. You can also use a Google topic ID such as /m/0d6lp. Each term is billed as one search term.",
            "items": {
              "type": "string"
            }
          },
          "compare": {
            "title": "Compare the terms against each other",
            "type": "boolean",
            "description": "Off: every term is scraped on its own (values are relative to that term's peak). On: terms are compared on one chart, in groups of up to 5 (Google's limit), so values are relative to each other, exactly like the Compare feature on trends.google.com.",
            "default": false
          },
          "geo": {
            "title": "Location",
            "type": "string",
            "description": "Leave empty for Worldwide. Use a country code (US, GB, DE, IN...) or a region code (US-CA, GB-ENG, DE-BY...).",
            "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": "Period to look at. Choose Custom to set exact dates below.",
            "default": "today 12-m"
          },
          "customTimeRange": {
            "title": "Custom dates",
            "type": "string",
            "description": "Only used when Time range is Custom. Format: <code>2024-01-01 2024-12-31</code>. For hourly data within a week: <code>2024-05-01T00 2024-05-07T23</code>."
          },
          "searchType": {
            "title": "Google property",
            "enum": [
              "web",
              "images",
              "news",
              "shopping",
              "youtube"
            ],
            "type": "string",
            "description": "Which Google search to measure.",
            "default": "web"
          },
          "category": {
            "title": "Category ID",
            "pattern": "^\\d*$",
            "type": "string",
            "description": "Google Trends category to narrow ambiguous terms (0 = all categories). Examples: 7 Finance, 5 Computers & Electronics, 71 Food & Drink, 44 Beauty & Fitness. The ID is the <code>cat=</code> value in a trends.google.com URL. Text field so inputs from other Google Trends Actors (\"7\" or \"\") work as-is.",
            "default": "0"
          },
          "includeInterestOverTime": {
            "title": "Include interest over time",
            "type": "boolean",
            "description": "Timeline of search interest (0-100).",
            "default": true
          },
          "includeInterestByRegion": {
            "title": "Include interest by region",
            "type": "boolean",
            "description": "Search interest per country, region, city or metro area.",
            "default": true
          },
          "regionResolution": {
            "title": "Region level",
            "enum": [
              "auto",
              "COUNTRY",
              "REGION",
              "CITY",
              "DMA"
            ],
            "type": "string",
            "description": "Auto = same as trends.google.com (countries for Worldwide, regions/states for a country, metro areas for a US state). City needs a country. Metro (DMA) is US only.",
            "default": "auto"
          },
          "includeLowVolumeRegions": {
            "title": "Include low search volume regions",
            "type": "boolean",
            "description": "Also return regions where Google has too little data (value 0).",
            "default": false
          },
          "includeRelatedQueries": {
            "title": "Include related queries",
            "type": "boolean",
            "description": "Top and rising related searches, including Breakout queries.",
            "default": true
          },
          "includeRelatedTopics": {
            "title": "Include related topics",
            "type": "boolean",
            "description": "Top and rising related topics (Google does not return topics when comparing several terms).",
            "default": true
          },
          "outputMode": {
            "title": "Output format",
            "enum": [
              "perSearch",
              "rows"
            ],
            "type": "string",
            "description": "<b>One item per search term</b>: everything for a term in one JSON object (best for APIs and AI agents). <b>Flat rows</b>: one row per data point (best for CSV, Excel and Google Sheets). Billing is the same: per search term.",
            "default": "perSearch"
          },
          "trendingGeos": {
            "title": "Trending now: countries",
            "type": "array",
            "description": "Only used in Trending now mode. 2-letter country codes.",
            "default": [
              "US"
            ],
            "items": {
              "type": "string"
            }
          },
          "maxTrendingItems": {
            "title": "Trending now: max trends per country",
            "minimum": 1,
            "maximum": 500,
            "type": "integer",
            "description": "Only used in Trending now mode. Google's public feed usually lists the top 10-20 trends per country.",
            "default": 50
          },
          "language": {
            "title": "Language",
            "type": "string",
            "description": "Language for topic names and dates, e.g. en-US, de, fr, es, ja.",
            "default": "en-US"
          },
          "timezoneOffsetMinutes": {
            "title": "Timezone offset (minutes)",
            "type": "integer",
            "description": "Timezone used by Google to bucket hourly/daily data, in minutes WEST of UTC like trends.google.com uses (0 = UTC, 300 = New York winter, -60 = Berlin winter).",
            "default": 0
          },
          "maxConcurrency": {
            "title": "Parallel searches",
            "minimum": 1,
            "maximum": 10,
            "type": "integer",
            "description": "How many search terms to process at once. Google Trends rate-limits aggressively; 2 is the sweet spot.",
            "default": 2
          },
          "maxRetries": {
            "title": "Max retries per request",
            "minimum": 0,
            "maximum": 15,
            "type": "integer",
            "description": "On a block (HTTP 429/CAPTCHA) the scraper waits with exponential backoff, switches to a fresh IP and cookie session, then retries.",
            "default": 6
          },
          "proxyConfiguration": {
            "title": "Proxy",
            "type": "object",
            "description": "Leave the default. The scraper starts on Apify Proxy (auto) and switches to residential IPs automatically only if Google keeps blocking, at no extra cost to you.",
            "default": {
              "useApifyProxy": true
            }
          }
        }
      },
      "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
                  },
                  "PROXY_UNBLOCKER_UNITS": {
                    "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
                  },
                  "PROXY_UNBLOCKER_UNITS": {
                    "type": "integer",
                    "example": 0
                  }
                }
              }
            }
          }
        }
      }
    }
  }
}