{
  "openapi": "3.0.1",
  "info": {
    "title": "Google Trends Scraper and Data API",
    "description": "Google Trends scraper and data API: export interest over time (timeline), interest by region and related/rising queries for your keywords, location and date range, plus the Trending Now board by country. Export JSON, CSV or Excel.",
    "version": "0.9",
    "x-build-id": "8nAXixTZ9uLjeR8jl"
  },
  "servers": [
    {
      "url": "https://api.apify.com/v2"
    }
  ],
  "paths": {
    "/acts/danthedataman~google-trends-data-api/run-sync-get-dataset-items": {
      "post": {
        "operationId": "run-sync-get-dataset-items-danthedataman-google-trends-data-api",
        "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/danthedataman~google-trends-data-api/runs": {
      "post": {
        "operationId": "runs-sync-danthedataman-google-trends-data-api",
        "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/danthedataman~google-trends-data-api/run-sync": {
      "post": {
        "operationId": "run-sync-danthedataman-google-trends-data-api",
        "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": "Mode",
            "enum": [
              "keywords",
              "trending"
            ],
            "type": "string",
            "description": "<b>Keyword research</b> analyses terms you supply. <b>Trending now</b> ignores keywords and returns what is trending in a country right now, with search volumes.",
            "default": "keywords"
          },
          "keywords": {
            "title": "Search terms",
            "type": "array",
            "description": "Keywords or Google Trends topic IDs (e.g. <code>/m/0k8z</code>) to analyse. Each term is scraped independently unless <b>Compare keywords</b> is enabled. Ignored in Trending now mode.",
            "items": {
              "type": "string"
            }
          },
          "startUrls": {
            "title": "Google Trends URLs",
            "type": "array",
            "description": "Optional. Paste trends.google.com explore URLs; their q / geo / date / cat are parsed into the inputs above. Overrides Search terms when set.",
            "items": {
              "type": "string"
            }
          },
          "geo": {
            "title": "Country / region code",
            "type": "string",
            "description": "Two-letter country code (<code>US</code>, <code>GB</code>, <code>DE</code>) or a sub-region such as <code>US-CA</code>. Empty means Worldwide in keyword mode; Trending now mode is country-level and defaults to <code>US</code>.",
            "default": ""
          },
          "timeRange": {
            "title": "Time range",
            "type": "string",
            "description": "Period to analyse. You may also type a custom range such as <code>2024-01-01 2024-12-31</code>.",
            "default": "today 12-m"
          },
          "dataTypes": {
            "title": "Data to extract",
            "type": "array",
            "description": "Which Google Trends datasets to return. Fewer datasets means fewer results and a lower cost.",
            "items": {
              "type": "string",
              "enum": [
                "interest_over_time",
                "interest_by_region",
                "related_queries"
              ],
              "enumTitles": [
                "Interest over time",
                "Interest by region",
                "Related & rising queries"
              ]
            },
            "default": [
              "interest_over_time",
              "interest_by_region",
              "related_queries"
            ]
          },
          "compareKeywords": {
            "title": "Compare keywords against each other",
            "type": "boolean",
            "description": "Off (default): every term is scored 0-100 on its own scale, and you may pass unlimited terms. On: up to 5 terms share one scale so their popularity is directly comparable, exactly like the Google Trends comparison view.",
            "default": false
          },
          "includeKeywordInsights": {
            "title": "Include keyword insights",
            "type": "boolean",
            "description": "Opt-in add-on. When on, keyword mode writes one derived insight per keyword to the KEYWORD_INSIGHTS key-value record (never the dataset) from that keyword's emitted rows. The keyword-insight charge applies once per written insight when that event is listed in the Actor's pricing; opting in before then returns the record without an add-on charge. A keyword with fewer than four emitted interest_over_time points whose hasData is not false is skipped and is not charged. Off by default: no insight, no add-on charge. Ignored in Trending now mode.",
            "default": false
          },
          "searchType": {
            "title": "Search property",
            "enum": [
              "",
              "images",
              "news",
              "froogle",
              "youtube"
            ],
            "type": "string",
            "description": "Which Google property the interest is measured on.",
            "default": ""
          },
          "category": {
            "title": "Category",
            "enum": [
              "0",
              "3",
              "5",
              "7",
              "8",
              "11",
              "12",
              "13",
              "14",
              "16",
              "18",
              "19",
              "20",
              "22",
              "29",
              "44",
              "45",
              "47",
              "65",
              "66",
              "67",
              "71",
              "174",
              "299",
              "533",
              "958"
            ],
            "type": "string",
            "description": "Keyword mode. Narrow the query to one Google Trends category.",
            "default": "0"
          },
          "language": {
            "title": "Language",
            "type": "string",
            "description": "Language for the returned labels, e.g. <code>en-US</code>, <code>de</code>, <code>es</code>.",
            "default": "en-US"
          },
          "timezoneOffsetMinutes": {
            "title": "Timezone offset (minutes)",
            "type": "integer",
            "description": "Offset used to bucket hourly data, in minutes. 0 is UTC.",
            "default": 0
          },
          "trendingHours": {
            "title": "Trending window",
            "enum": [
              "4",
              "24",
              "48",
              "168"
            ],
            "type": "string",
            "description": "Trending now mode only. How far back the trending board reaches.",
            "default": "24"
          },
          "trendingCategories": {
            "title": "Trending categories",
            "type": "array",
            "description": "Trending now mode. Keep only trends in these categories. Leave empty for all.",
            "items": {
              "type": "string",
              "enum": [
                "1",
                "2",
                "3",
                "4",
                "5",
                "6",
                "7",
                "8",
                "9",
                "10",
                "11",
                "13",
                "14",
                "15",
                "16",
                "17",
                "18",
                "19",
                "20"
              ],
              "enumTitles": [
                "Autos and Vehicles",
                "Beauty and Fashion",
                "Business and Finance",
                "Entertainment",
                "Food and Drink",
                "Games",
                "Health",
                "Hobbies and Leisure",
                "Jobs and Education",
                "Law and Government",
                "Other",
                "Pets and Animals",
                "Politics",
                "Science",
                "Shopping",
                "Sports",
                "Technology",
                "Travel and Transportation",
                "Climate"
              ]
            }
          },
          "trendStatus": {
            "title": "Trend status",
            "enum": [
              "all",
              "active",
              "ended"
            ],
            "type": "string",
            "description": "Trending now mode. Keep all trends, only those still rising, or only those that have ended.",
            "default": "all"
          },
          "maxItems": {
            "title": "Maximum results",
            "minimum": 0,
            "type": "integer",
            "description": "Stop after this many result rows. Leave empty for no limit."
          },
          "maxRunSeconds": {
            "title": "Run time budget (seconds)",
            "minimum": 0,
            "type": "integer",
            "description": "Stop starting new batches after this many seconds, so a Google-side outage cannot burn a long run. 0 disables the budget.",
            "default": 3600
          },
          "maxRetriesPerRequest": {
            "title": "Max retries per request",
            "minimum": 1,
            "maximum": 20,
            "type": "integer",
            "description": "How hard to retry when Google rate-limits a request. Each retry backs off and rotates the session onto a fresh proxy IP.",
            "default": 8
          },
          "rotateAfterRequests": {
            "title": "Rotate proxy IP every N requests",
            "minimum": 0,
            "maximum": 200,
            "type": "integer",
            "description": "Retire each proxy identity after this many requests, before Google throttles it. Lower is safer on large keyword lists; 0 disables proactive rotation.",
            "default": 24
          },
          "proxyConfiguration": {
            "title": "Proxy configuration",
            "type": "object",
            "description": "Google rate-limits datacenter IPs aggressively. Keeping Apify Proxy enabled is strongly recommended for reliable runs.",
            "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
                  }
                }
              }
            }
          }
        }
      }
    }
  }
}