{
  "openapi": "3.0.1",
  "info": {
    "title": "Google Trends Insights Scraper",
    "description": "Analyze search trends effortlessly. Scrape keyword popularity, categories, breakout queries, trend comparisons, and geographic data. Perfect for forecasting, SEO planning, market intelligence, and content strategy optimization.",
    "version": "0.1",
    "x-build-id": "Z8KifTt9jWEJvImH3"
  },
  "servers": [
    {
      "url": "https://api.apify.com/v2"
    }
  ],
  "paths": {
    "/acts/api-empire~google-trends-scraper/run-sync-get-dataset-items": {
      "post": {
        "operationId": "run-sync-get-dataset-items-api-empire-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/api-empire~google-trends-scraper/runs": {
      "post": {
        "operationId": "runs-sync-api-empire-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/api-empire~google-trends-scraper/run-sync": {
      "post": {
        "operationId": "run-sync-api-empire-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": {
          "searchTerms": {
            "title": "🔎 Search terms / keywords",
            "type": "array",
            "description": "Keywords or topics to analyze. Required unless you use Google Trends URLs, a Google Sheet, or select only TRENDING_NOW. Example: [\"chatgpt\", \"python\"].",
            "items": {
              "type": "string"
            }
          },
          "isMultiple": {
            "title": "🧩 Comparison mode (comma = one group)",
            "type": "boolean",
            "description": "When on, commas inside one search term split it into a single comparison group (max 5 keywords compared together, normalized 0-100 against each other). Example: \"chatgpt, gemini, claude\" → one comparison. Default: off (each term analyzed separately).",
            "default": false
          },
          "dataTypes": {
            "title": "🗃️ Data types to fetch (each billed separately)",
            "type": "array",
            "description": "Pick which data to fetch. Each extra type adds Google Trends requests (proxy cost) and is billed as its own pay-per-event. TIMESERIES=interest over time, GEO=interest by region/city, RELATED_QUERIES / RELATED_TOPICS=top+rising associations, TRENDING_NOW=real-time trending searches. Default: TIMESERIES only.",
            "items": {
              "type": "string",
              "enum": [
                "TIMESERIES",
                "GEO",
                "RELATED_QUERIES",
                "RELATED_TOPICS",
                "TRENDING_NOW"
              ],
              "enumTitles": [
                "📈 Interest over time (+ derived stats)",
                "🌍 Interest by region / city / DMA",
                "🔍 Related queries (top + rising)",
                "🧠 Related topics (top + rising)",
                "🔥 Trending now (real-time)"
              ]
            },
            "default": [
              "TIMESERIES"
            ]
          },
          "gprop": {
            "title": "📺 Google property",
            "enum": [
              "web",
              "news",
              "images",
              "youtube",
              "shopping"
            ],
            "type": "string",
            "description": "Which Google surface to measure. Web is the default; News/Images/YouTube/Shopping unlock vertical-specific trends.",
            "default": "web"
          },
          "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"
            ],
            "type": "string",
            "description": "How far back to analyze. Ignored if you set a custom date range below. Default: Past 12 months.",
            "default": "today 12-m"
          },
          "startDate": {
            "title": "📅 Custom range — start",
            "type": "string",
            "description": "Optional exact start date. Accepts an absolute date (YYYY-MM-DD) or a relative value (e.g. \"3 months\"). Setting start and/or end overrides the preset Time range above."
          },
          "endDate": {
            "title": "📅 Custom range — end",
            "type": "string",
            "description": "Optional exact end date. Absolute (YYYY-MM-DD) or relative (e.g. \"1 day\"). Defaults to today when only a start is given."
          },
          "geo": {
            "title": "🌍 Geo (country / region / city / DMA)",
            "type": "string",
            "description": "Location code. Leave empty for Worldwide. Accepts country (US), region/state (US-NY), city (US-NY-501), or DMA. If you provide Google Trends URLs, the geo inside each URL is used for that URL.",
            "default": ""
          },
          "resolution": {
            "title": "🗺️ Region resolution (for Interest by region)",
            "enum": [
              "",
              "COUNTRY",
              "REGION",
              "CITY",
              "DMA"
            ],
            "type": "string",
            "description": "Granularity of GEO results. Auto = COUNTRY when Geo is worldwide, otherwise REGION. Only applies when GEO is in Data types.",
            "default": ""
          },
          "includeLowVolumeGeos": {
            "title": "🔬 Include low-volume regions",
            "type": "boolean",
            "description": "Include regions/cities with low search volume in Interest-by-region results. Default: off.",
            "default": false
          },
          "category": {
            "title": "🗂️ Category",
            "type": "string",
            "description": "Restrict to a Google Trends category. Enter a numeric category ID (e.g. 5 = Computers & Electronics, 71 = Food & Drink) or a search name (e.g. \"Travel\") to auto-resolve against the full category tree. Empty = all categories.",
            "default": ""
          },
          "hl": {
            "title": "🈯 Language (hl)",
            "type": "string",
            "description": "Two-letter interface language for labels (e.g. en, es, fr, de). Default: en.",
            "default": "en"
          },
          "tz": {
            "title": "🕐 Timezone offset minutes (tz)",
            "type": "integer",
            "description": "Timezone offset in minutes used when bucketing time data. 360 = US Central. Default: 360.",
            "default": 360
          },
          "outputFormat": {
            "title": "🧾 Output format (timeseries)",
            "enum": [
              "wide",
              "long"
            ],
            "type": "string",
            "description": "wide = one row per keyword with a nested timeline + derived stats. long = additionally emit one row per date × keyword (tidy for spreadsheets/BI). Default: wide.",
            "default": "wide"
          },
          "trendingHours": {
            "title": "🔥 Trending window (hours)",
            "minimum": 1,
            "maximum": 191,
            "type": "integer",
            "description": "For TRENDING_NOW: detect searches trending within the last N hours (1-191). Default: 24.",
            "default": 24
          },
          "trendingNews": {
            "title": "📰 Fetch news articles for trends",
            "type": "boolean",
            "description": "For TRENDING_NOW: also fetch related news articles (title/url/source/picture) per trend. Adds one request per trend (slower, more proxy cost). Default: off.",
            "default": false
          },
          "maxTrendingItems": {
            "title": "🔢 Max trending items per geo",
            "minimum": 0,
            "type": "integer",
            "description": "Cap the number of TRENDING_NOW results per region. 0 = all. Default: 25.",
            "default": 25
          },
          "startUrls": {
            "title": "🔗 Google Trends URLs",
            "type": "array",
            "description": "Paste full Google Trends explore URLs. Each URL's own q / geo / date / cat / gprop parameters are applied to that URL only. Example: https://trends.google.com/trends/explore?q=chatgpt,gemini&geo=US&date=today%2012-m",
            "items": {
              "type": "string"
            }
          },
          "spreadsheetId": {
            "title": "📄 Google Sheet ID",
            "type": "string",
            "description": "Optional: load terms from a public Google Sheet (one column; row 1 = header).",
            "default": ""
          },
          "maxItems": {
            "title": "🔢 Max keyword groups",
            "minimum": 0,
            "type": "integer",
            "description": "Cap the number of keyword groups (top-level jobs) processed. 0 = no limit. Each group may still emit multiple rows and data types.",
            "default": 0
          },
          "maxConcurrency": {
            "title": "⚡ Max concurrency",
            "minimum": 1,
            "maximum": 10,
            "type": "integer",
            "description": "How many keyword groups to fetch in parallel (each uses its own client/IP). Google Trends rate-limits aggressively — keep this low (1-3). Default: 1.",
            "default": 1
          },
          "maxRequestRetries": {
            "title": "🔁 Max IP rotations per proxy tier",
            "minimum": 1,
            "type": "integer",
            "description": "On a 429/block, how many times to rotate the proxy IP (with exponential backoff, honoring Retry-After) within a tier before escalating none → datacenter → residential. Default: 3.",
            "default": 3
          },
          "requestDelaySecs": {
            "title": "⏱️ Min delay between requests (seconds)",
            "minimum": 0,
            "type": "integer",
            "description": "Minimum spacing between Google Trends requests to reduce rate-limiting. Default: 2.",
            "default": 2
          },
          "proxyConfiguration": {
            "title": "🛡️ Proxy configuration",
            "type": "object",
            "description": "Google Trends heavily rate-limits datacenter/cloud IPs. Enable Apify Proxy (RESIDENTIAL recommended) for reliable results. The actor auto-escalates none → datacenter → residential on blocks."
          }
        }
      },
      "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
                  }
                }
              }
            }
          }
        }
      }
    }
  }
}