{
  "openapi": "3.0.1",
  "info": {
    "title": "Google Trends Scraper: series by term, geo and window, as rows",
    "description": "Use when asked how interest in a search term is trending on Google. Given countries (e.g. US, GB, DE), every term runs in each of them in one run. Returns flat rows: interest over time (0 to 100) and related queries. Relative interest, not search volumes. Minimal input: {\"searchTerms\": [\"coffee\"]}",
    "version": "0.1",
    "x-build-id": "t220f4zfISWS58xls"
  },
  "servers": [
    {
      "url": "https://api.apify.com/v2"
    }
  ],
  "paths": {
    "/acts/tallyrake~google-trends-scraper/run-sync-get-dataset-items": {
      "post": {
        "operationId": "run-sync-get-dataset-items-tallyrake-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/tallyrake~google-trends-scraper/runs": {
      "post": {
        "operationId": "runs-sync-tallyrake-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/tallyrake~google-trends-scraper/run-sync": {
      "post": {
        "operationId": "run-sync-tallyrake-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",
        "required": [
          "searchTerms"
        ],
        "properties": {
          "searchTerms": {
            "title": "Search terms",
            "minItems": 1,
            "maxItems": 250,
            "type": "array",
            "description": "The search terms to look up, for example [\"coffee\"] or [\"coffee\", \"tea\"]. Each term gets its own 0 to 100 interest scale unless Compare terms is on. Up to 250 terms per run, each at most 100 characters; a list over either limit is refused before the run starts. This is the only required field.",
            "items": {
              "type": "string",
              "maxLength": 100
            }
          },
          "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 look. Default \"today 12-m\" (past 12 months). Presets: \"now 1-H\" (past hour), \"now 4-H\" (past 4 hours), \"now 1-d\" (past day), \"now 7-d\" (past 7 days), \"today 1-m\" (past 30 days), \"today 3-m\" (past 90 days), \"today 12-m\" (past 12 months), \"today 5-y\" (past 5 years), \"all\" (2004 to present). Ignored if Custom time range is set.",
            "default": "today 12-m"
          },
          "customTimeRange": {
            "title": "Custom time range",
            "type": "string",
            "description": "An exact window instead of a preset, in the format \"YYYY-MM-DD YYYY-MM-DD\" (for example \"2023-01-01 2023-06-30\"). Overrides Time range."
          },
          "geo": {
            "title": "Geo (location)",
            "type": "string",
            "description": "Two-letter country code (e.g. \"US\"), or country-region code (e.g. \"US-CA\"). Leave empty for worldwide.",
            "default": ""
          },
          "countries": {
            "title": "Countries (several in one run)",
            "maxItems": 250,
            "type": "array",
            "description": "Optional. One or more locations, written like Geo, for example [\"US\", \"GB\", \"DE\"]. One entry matches Geo. Two or more: every search term is looked up in every location in this run, and each row's geo field is the location that row came from. When this list has at least one entry, it replaces Geo. One term in one location is one lookup; one run takes at most 250 lookups (terms times locations), and a longer job is refused before any request to Google is sent. Each lookup has its own 0 to 100 scale. With Compare terms on, terms share a scale only with the other terms in the same group of at most five, and only inside one location, so a number is not comparable across locations or across groups. With two or more locations, the run succeeds when at least half the lookups returned and fails when fewer than half did; rows that came back are kept either way, and a location Google did not answer is named in the status message.",
            "items": {
              "type": "string",
              "maxLength": 40
            }
          },
          "category": {
            "title": "Category",
            "type": "integer",
            "description": "Google Trends category ID. 0 means all categories.",
            "default": 0
          },
          "searchType": {
            "title": "Search type",
            "enum": [
              "",
              "images",
              "news",
              "youtube",
              "froogle"
            ],
            "type": "string",
            "description": "Which Google property to pull trends from.",
            "default": ""
          },
          "outputs": {
            "title": "Data to fetch",
            "type": "array",
            "description": "Which data to fetch. Each selected output becomes its own row type in the dataset.",
            "items": {
              "type": "string",
              "enum": [
                "interestOverTime",
                "interestByRegion",
                "relatedQueries",
                "relatedTopics"
              ],
              "enumTitles": [
                "Interest over time",
                "Interest by region",
                "Related queries",
                "Related topics"
              ]
            },
            "default": [
              "interestOverTime",
              "relatedQueries"
            ]
          },
          "regionResolution": {
            "title": "Region resolution",
            "enum": [
              "COUNTRY",
              "REGION",
              "CITY",
              "DMA"
            ],
            "type": "string",
            "description": "Granularity used for Interest by region.",
            "default": "COUNTRY"
          },
          "compareTerms": {
            "title": "Compare terms",
            "type": "boolean",
            "description": "Off by default: each term is measured on its own 0 to 100 scale. Turn on to compare terms with each other: values are relative interest, and one term is the 0 to 100 anchor. Terms are compared in groups of up to 5, so a sixth term starts a new comparison with its own anchor.",
            "default": false
          },
          "proxyConfiguration": {
            "title": "Proxy configuration",
            "type": "object",
            "description": "Google Trends aggressively rate-limits by IP. Using Apify Proxy is strongly recommended for any run beyond a couple of terms.",
            "default": {
              "useApifyProxy": true
            }
          },
          "maxConcurrency": {
            "title": "Max concurrency",
            "minimum": 1,
            "maximum": 3,
            "type": "integer",
            "description": "Maximum number of search terms processed in parallel. Keep at 3 or below to avoid Google rate limits.",
            "default": 2
          },
          "requestsPerSession": {
            "title": "Requests per session",
            "minimum": 1,
            "type": "integer",
            "description": "Reuse a Google Trends session for this many successful requests, then rotate to a fresh one. A session also rotates immediately on a rate-limit response.",
            "default": 8
          },
          "pacingMs": {
            "title": "Pacing (ms)",
            "minimum": 0,
            "type": "integer",
            "description": "Base jittered delay in milliseconds between Google Trends requests; 0 disables pacing.",
            "default": 500
          },
          "residentialForRelated": {
            "title": "Residential proxy for related queries and topics",
            "type": "boolean",
            "description": "Fetch the related queries and related topics slices through Apify residential proxy identities (datacenter stays in use for the series and regions). Google rate-limits that slice hardest; turn this on when runs report terms returned without related queries. Residential traffic is small here (tens of KB per term) but is billed as proxy usage. HTTP mode only; browser mode loads every widget on one page through Proxy configuration.",
            "default": false
          },
          "fetchMode": {
            "title": "Fetch mode",
            "enum": [
              "http",
              "browser"
            ],
            "type": "string",
            "description": "How to read Google Trends. \"http\" (default) calls the widget endpoints directly. \"browser\" opens the explore page in headless Chromium and reads the same widget JSON from the page's own traffic. Use browser only if HTTP runs start failing because Google changed the widget protocol or is serving a JavaScript challenge. Browser mode needs at least 2 GB of memory and costs more per term (see the README section Fallback mode). A browser run with less than 2048 MB of memory runs in HTTP mode instead, and its status message says so.",
            "default": "http"
          }
        }
      },
      "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
                  }
                }
              }
            }
          }
        }
      }
    }
  }
}