{
  "openapi": "3.0.1",
  "info": {
    "title": "Google Trends Scraper & API",
    "description": "Google Trends scraper and API: interest over time, interest by region, related queries and Trending Now searches. Compare any number of keywords on one scale. Pay only for results with data.",
    "version": "1.0",
    "x-build-id": "xf0TQVa7xnDlfIvEE"
  },
  "servers": [
    {
      "url": "https://api.apify.com/v2"
    }
  ],
  "paths": {
    "/acts/graylark~google-trends-scraper/run-sync-get-dataset-items": {
      "post": {
        "operationId": "run-sync-get-dataset-items-graylark-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/graylark~google-trends-scraper/runs": {
      "post": {
        "operationId": "runs-sync-graylark-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/graylark~google-trends-scraper/run-sync": {
      "post": {
        "operationId": "run-sync-graylark-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": [
              "keywords",
              "trendingNow"
            ],
            "type": "string",
            "description": "Keyword trends: interest over time, by region and related queries for your terms. Trending now: today's fastest-rising searches in a country.",
            "default": "keywords"
          },
          "searchTerms": {
            "title": "Search terms",
            "type": "array",
            "description": "Keywords or phrases, one per line, e.g. 'bitcoin' or 'electric car'. Duplicates are removed. Keyword trends only.",
            "items": {
              "type": "string"
            }
          },
          "trendsUrls": {
            "title": "Google Trends links (optional)",
            "type": "array",
            "description": "Paste links from trends.google.com/trends/explore. Each link is scraped exactly as shown (its terms, country, dates, category and search type), so you can mix different settings in one run.",
            "items": {
              "type": "string"
            }
          },
          "geo": {
            "title": "Country or region code",
            "pattern": "^$|^[A-Za-z]{2}(-[A-Za-z0-9]{1,3})?$",
            "type": "string",
            "description": "Two-letter country code like US, GB or DE (use GB, not UK), or a region like US-CA. Keyword trends: leave empty for worldwide. Trending now: leave empty for US.",
            "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"
            ],
            "type": "string",
            "description": "How far back to look. Short ranges have less data, so small terms may come back as 'noData' (not charged). Keyword trends only.",
            "default": "today 12-m"
          },
          "compareTerms": {
            "title": "Compare terms on one scale",
            "type": "boolean",
            "description": "On: all terms share one 0-100 scale like Google's compare view, even with more than 5 terms. Off: each term gets its own 0-100 scale.",
            "default": false
          },
          "includeInterestByRegion": {
            "title": "Include interest by region",
            "type": "boolean",
            "description": "Adds a breakdown of interest by country, region or city.",
            "default": true
          },
          "regionResolution": {
            "title": "Region detail",
            "enum": [
              "COUNTRY",
              "REGION",
              "CITY",
              "DMA"
            ],
            "type": "string",
            "description": "Optional. Leave empty for Google's default. Worldwide searches only support Country, and Metro area only works for US locations."
          },
          "includeRelatedQueries": {
            "title": "Include related queries",
            "type": "boolean",
            "description": "Top and rising related searches for each term.",
            "default": true
          },
          "trendingHours": {
            "title": "Time window (Trending now)",
            "enum": [
              "4",
              "24",
              "48",
              "168"
            ],
            "type": "string",
            "description": "How recent the trending searches should be.",
            "default": "24"
          },
          "maxTrendingItems": {
            "title": "Max results (Trending now)",
            "minimum": 1,
            "maximum": 1000,
            "type": "integer",
            "description": "Maximum number of trending searches to return. Each result is one billed event.",
            "default": 100
          },
          "customTimeRange": {
            "title": "Custom date range",
            "pattern": "^$|^\\s*\\d{4}-\\d{2}-\\d{2}\\s+\\d{4}-\\d{2}-\\d{2}\\s*$",
            "type": "string",
            "description": "Overrides Time range. Two dates, oldest first: '2024-01-01 2024-06-30'. Keyword trends only."
          },
          "category": {
            "title": "Topic category (optional)",
            "minimum": 0,
            "type": "integer",
            "description": "Google Trends category ID, for example 7 = Finance, 71 = Food & Drink, 20 = Sports. 0 means all categories. Tip: pick a category on trends.google.com and copy the 'cat=' number from the link.",
            "default": 0
          },
          "searchProperty": {
            "title": "Search type",
            "enum": [
              "web",
              "images",
              "news",
              "froogle",
              "youtube"
            ],
            "type": "string",
            "description": "Which Google search to measure: web, images, news, Google Shopping or YouTube.",
            "default": "web"
          },
          "language": {
            "title": "Language",
            "pattern": "^[A-Za-z]{2,3}([-_][A-Za-z0-9]{2,8})*$",
            "type": "string",
            "description": "Language for date labels, e.g. en-US, en-GB, de. Does not change which searches are counted.",
            "default": "en-US"
          },
          "maxConcurrency": {
            "title": "Speed: parallel IPs",
            "minimum": 1,
            "maximum": 10,
            "type": "integer",
            "description": "How many IPs work in parallel (8 recommended). The scraper replaces rate-limited IPs automatically; higher finishes long lists faster.",
            "default": 8
          },
          "useCache": {
            "title": "Reuse recent results",
            "type": "boolean",
            "description": "If the same keywords with the same settings were scraped recently, return that result instantly instead of asking Google again (fresh for 12 hours for most time ranges, 1 hour for past day / 7 days, never cached for past hour / 4 hours). Turn off to always fetch live data.",
            "default": true
          },
          "proxyConfiguration": {
            "title": "Proxy",
            "type": "object",
            "description": "Apify Proxy is used by default and works best. Rate-limited IPs are replaced automatically; terms that keep failing get a last retry through residential IPs if your account has them.",
            "default": {
              "useApifyProxy": true
            }
          },
          "includeRelatedTopics": {
            "title": "Include related topics",
            "type": "boolean",
            "description": "Google currently withholds related topics from automated requests, so this is usually empty.",
            "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
                  }
                }
              }
            }
          }
        }
      }
    }
  }
}