{
  "openapi": "3.0.1",
  "info": {
    "title": "Google Trends Scraper",
    "description": "Scrape Google Trends for up to 5 keywords at once: interest over time, interest by country, state or city, related queries and topics, and a summary per term (peak, change, trend). Export to JSON, CSV or Excel, or use the API.",
    "version": "0.4",
    "x-build-id": "LIOEjkxAkbqEQhkcb"
  },
  "servers": [
    {
      "url": "https://api.apify.com/v2"
    }
  ],
  "paths": {
    "/acts/stackraccoon~google-trends-scraper/run-sync-get-dataset-items": {
      "post": {
        "operationId": "run-sync-get-dataset-items-stackraccoon-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/stackraccoon~google-trends-scraper/runs": {
      "post": {
        "operationId": "runs-sync-stackraccoon-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/stackraccoon~google-trends-scraper/run-sync": {
      "post": {
        "operationId": "run-sync-stackraccoon-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": {
          "keywordSets": {
            "title": "Keyword sets",
            "type": "array",
            "description": "Add one report per set. Each set is a list of 1 to 5 terms that Google compares on one shared 0 to 100 scale (the highest point of any term is 100). Example: [[\"coffee\", \"tea\"], [\"espresso\"]]. Terms are matched case-insensitively; a term may not contain a comma. Each report saved with data is one billed event, plus Apify's start event once per run; a report Google has no data for is saved free, and the canary is not charged as a report."
          },
          "keywords": {
            "title": "Keywords, one report per line",
            "type": "array",
            "description": "Type reports here as an easier way to give them: each line is one report, and terms on a line separated by commas are compared on one scale (\"coffee, tea\"). Adds to your own keywordSets; the prefilled coffee and tea set is dropped when you fill this.",
            "items": {
              "type": "string"
            }
          },
          "exploreUrls": {
            "title": "Google Trends Explore URLs",
            "type": "array",
            "description": "Paste Explore URLs from your browser (https://trends.google.com/trends/explore?q=...). Each URL is one report with its own terms, place, time range, category, property and language; the URL is read, never visited. A URL comparing several places or several time ranges is refused. Adds to your own keywordSets; the prefilled coffee and tea set is dropped when you fill this.",
            "items": {
              "type": "string"
            }
          },
          "geo": {
            "title": "Geo",
            "pattern": "^(?!US-[0-9])([A-Z]{2}(-[A-Z0-9]{1,3}(-[0-9]{3})?)?)?$",
            "type": "string",
            "description": "Pick the location code: empty for worldwide, an uppercase ISO country code (US, GB), a sub-region (US-CA) or a US metro (US-NY-501). Any other code in that shape is accepted; lowercase or unknown codes are refused because Google answers them with an error.",
            "default": ""
          },
          "timeRange": {
            "title": "Time range",
            "pattern": "^(|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|all_[0-9]{4}|[0-9]{4}-[0-9]{2}-[0-9]{2} [0-9]{4}-[0-9]{2}-[0-9]{2}|[0-9]{4}-[0-9]{2}-[0-9]{2}T[0-9]{2} [0-9]{4}-[0-9]{2}-[0-9]{2}T[0-9]{2})$",
            "type": "string",
            "description": "Pick a preset, or enter all_YYYY, a custom range \"YYYY-MM-DD YYYY-MM-DD\" or an hourly range \"YYYY-MM-DDTHH YYYY-MM-DDTHH\" (UTC, at most 7 days). Google picks the bucket size from the span; each row names it in timelineResolution.",
            "default": "today 12-m"
          },
          "property": {
            "title": "Search property",
            "enum": [
              "",
              "images",
              "news",
              "youtube",
              "froogle"
            ],
            "type": "string",
            "description": "Pick the Google search property the interest is measured on.",
            "default": ""
          },
          "category": {
            "title": "Category",
            "pattern": "^0*(|[3-9]|[1-9][0-9]|[1-9][0-9]{2}|1[0-2][0-9]{2}|13[0-8][0-9]|139[0-7])$",
            "type": "string",
            "description": "Enter the Trends category id as digits, 3 to 1397; empty or 0 is all categories (71 is Food and Drink, 20 is Sports). Text, as Apify's Google Trends Scraper takes it, so its inputs work unchanged. An id outside 3 to 1397 is refused before any request; copy the id from a Trends explore URL (the cat= parameter).",
            "default": ""
          },
          "language": {
            "title": "Language",
            "pattern": "^[a-z]{2,3}(-[A-Z][a-z]{3})?(-[A-Z]{2}|-[0-9]{3})?$",
            "type": "string",
            "description": "Pick the language for place names, labels and \"Breakout\". Google silently falls back to en-US on an unknown language, so tags not shaped like en-US, de or pt-BR are refused.",
            "default": "en-US"
          },
          "sections": {
            "title": "Sections",
            "minItems": 1,
            "type": "array",
            "description": "Pick the sections each report returns. Related topics are opt-in and need one other section with them (alone they are refused): Google withholds them from keyless sessions it flags as scrapers, and the row then says so (degraded, reason relatedTopics:withheld). Accepted values: interestOverTime, interestByRegion, relatedQueries, relatedTopics.",
            "items": {
              "type": "string",
              "enum": [
                "interestOverTime",
                "interestByRegion",
                "relatedQueries",
                "relatedTopics"
              ],
              "enumTitles": [
                "Interest over time",
                "Interest by region",
                "Related queries",
                "Related topics"
              ]
            },
            "default": [
              "interestOverTime",
              "interestByRegion",
              "relatedQueries"
            ]
          },
          "regionResolution": {
            "title": "Region resolution",
            "enum": [
              "",
              "COUNTRY",
              "REGION",
              "DMA",
              "CITY"
            ],
            "type": "string",
            "description": "Pick the level of the interest-by-region rows. Leave empty to keep the level Google picks for the geo (countries worldwide, sub-regions inside a country, cities inside a sub-region). Combinations Google refuses (COUNTRY with a geo, REGION worldwide, CITY with US, DMA outside the US) are refused before any request.",
            "default": ""
          },
          "includeLowVolumeRegions": {
            "title": "Include low-volume regions",
            "type": "boolean",
            "description": "Include regions whose search volume is too low to rank (Google's own option; they come back with no data or small values). Off by default, as on the Trends site.",
            "default": false
          },
          "timezoneOffsetMinutes": {
            "title": "Time-zone offset (minutes)",
            "minimum": -1439,
            "maximum": 1439,
            "type": "integer",
            "description": "Set the offset for Google's formattedTime labels, JavaScript convention (US Central is 360, Central Europe is -60). It changes only the labels: timestamps and values are always UTC buckets.",
            "default": 0
          },
          "maxReports": {
            "title": "Max reports",
            "minimum": 1,
            "maximum": 200,
            "type": "integer",
            "description": "Limit the run to at most this many keyword sets, read in order; each served report is one billed event. When you give more sets than this, the run reads the first ones and ends on the Charge limit reached message, with the sets it skipped named in HEALTH notes. A large run needs a higher Wall-time bound and run timeout: the canary and one report took 8.4 s on the platform.",
            "default": 20
          },
          "methods": {
            "title": "Method chain",
            "minItems": 1,
            "type": "array",
            "description": "Pick the methods tried in order for each report; the row names the method that served it. One method today: the Trends JSON endpoints. Accepted value: trendsJson.",
            "items": {
              "type": "string",
              "enum": [
                "trendsJson"
              ],
              "enumTitles": [
                "Trends JSON endpoints (keyless, one paced session)"
              ]
            },
            "default": [
              "trendsJson"
            ]
          },
          "proxyConfiguration": {
            "title": "Proxy",
            "type": "object",
            "description": "Pick the proxy; datacenter proxy by default. The actor keeps one session and one address for the whole run and never rotates past a rate-limit answer. Residential proxy groups are not offered by this actor and are refused before any request: leave the Apify datacenter default, or give your own proxy URLs.",
            "default": {
              "useApifyProxy": true
            }
          },
          "requestDelayMs": {
            "title": "Pacing (ms)",
            "minimum": 500,
            "maximum": 30000,
            "type": "integer",
            "description": "Pause between requests on the session. The run slows down on its own: to at least 2000 ms after Google rate limits it, and to at least 1200 ms past 60 requests. It never speeds up past what you set.",
            "default": 1000
          },
          "rateLimitWaitSeconds": {
            "title": "Rate-limit wait (s)",
            "minimum": 5,
            "maximum": 120,
            "type": "integer",
            "description": "Set the first wait after a rate-limit answer; each further wait doubles. The same session and cookie are reused.",
            "default": 20
          },
          "rateLimitMaxWaits": {
            "title": "Rate-limit waits",
            "minimum": 0,
            "maximum": 5,
            "type": "integer",
            "description": "Set how many waits come before the method is recorded blocked for the rest of the run.",
            "default": 2
          },
          "maxRunSeconds": {
            "title": "Wall-time bound (s)",
            "minimum": 30,
            "maximum": 3000,
            "type": "integer",
            "description": "Set the time after which no request starts, pacing included (or 40 s before the platform timeout, whichever is sooner), so the run always ends in a named state and writes HEALTH. At the default pacing the canary and one two-term report took 8.4 s on the platform.",
            "default": 600
          },
          "canaryFirst": {
            "title": "Read the canary first",
            "type": "boolean",
            "description": "Read the canary report before your reports; if it cannot be served the run cannot end healthy or degraded. The canary is not charged as a report.",
            "default": true
          },
          "canaryOnly": {
            "title": "Canary only",
            "type": "boolean",
            "description": "Read only the canary report and write its health record (for a scheduled health check). The canary is not charged as a report.",
            "default": false
          },
          "canaryInput": {
            "title": "Canary report",
            "type": "object",
            "description": "Set the everyday report the canary reads: terms, geo, timeRange. The canary is not charged as a report unless it is one of your own reports.",
            "properties": {
              "terms": {
                "title": "Canary terms",
                "type": "array",
                "description": "1 to 5 terms, as in a keyword set, each up to 100 characters.",
                "minItems": 1,
                "maxItems": 5,
                "items": {
                  "type": "string",
                  "maxLength": 100
                },
                "errorMessage": {
                  "minItems": "Give 1 to 5 terms.",
                  "maxItems": "Give at most 5 terms, since Google Trends compares at most 5.",
                  "type": "Give 1 to 5 terms as a list."
                }
              },
              "geo": {
                "title": "Canary geo",
                "type": "string",
                "description": "A location code as in Geo; empty for worldwide.",
                "pattern": "^(?!US-[0-9])([A-Z]{2}(-[A-Z0-9]{1,3}(-[0-9]{3})?)?)?$",
                "errorMessage": {
                  "pattern": "Enter an uppercase location code such as US, GB, US-CA or US-NY-501, or leave it empty for worldwide.",
                  "type": "Enter the location code as text, such as US or US-CA, or leave it empty for worldwide."
                }
              },
              "timeRange": {
                "title": "Canary time range",
                "type": "string",
                "description": "A time range as in Time range.",
                "errorMessage": {
                  "type": "Enter the time range as text, such as today 12-m.",
                  "pattern": "Enter a preset such as today 12-m, all_YYYY, \"YYYY-MM-DD YYYY-MM-DD\" or \"YYYY-MM-DDTHH YYYY-MM-DDTHH\" (UTC)."
                },
                "pattern": "^(|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|all_[0-9]{4}|[0-9]{4}-[0-9]{2}-[0-9]{2} [0-9]{4}-[0-9]{2}-[0-9]{2}|[0-9]{4}-[0-9]{2}-[0-9]{2}T[0-9]{2} [0-9]{4}-[0-9]{2}-[0-9]{2}T[0-9]{2})$"
              }
            },
            "default": {
              "terms": [
                "coffee",
                "tea"
              ],
              "geo": "",
              "timeRange": "today 12-m"
            }
          },
          "fixtureSource": {
            "title": "Fixture source (testing)",
            "type": "string",
            "description": "Owner testing only. Replays a bundled fixture with no network. Refused on the platform except in the owner's own drills; replayed rows say dataSource fixture and are never billed."
          },
          "endpointBaseUrl": {
            "title": "Endpoint base URL (testing)",
            "pattern": "^https?://",
            "type": "string",
            "description": "Base URL of the Trends host. Only changed to point the live request path at a local test stub.",
            "default": "https://trends.google.com"
          },
          "allowReplayOnPlatform": {
            "title": "Allow replay on the platform (testing)",
            "type": "boolean",
            "description": "Owner drills only: lets fixtureSource or a test endpoint run on the platform, and only on a run the actor's owner started.",
            "default": false
          }
        }
      },
      "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
                  }
                }
              }
            }
          }
        }
      }
    }
  }
}