{
  "openapi": "3.0.1",
  "info": {
    "title": "Google Trends API, Breakout Keywords and Comparison Scraper",
    "description": "Google Trends scraper for breakout rising queries, multi-keyword share-of-search comparisons, regional demand, and real-time trends with news.",
    "version": "0.1",
    "x-build-id": "TT3Se89hVja4VxPfZ"
  },
  "servers": [
    {
      "url": "https://api.apify.com/v2"
    }
  ],
  "paths": {
    "/acts/xenikii~google-trends-scraper/run-sync-get-dataset-items": {
      "post": {
        "operationId": "run-sync-get-dataset-items-xenikii-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/xenikii~google-trends-scraper/runs": {
      "post": {
        "operationId": "runs-sync-xenikii-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/xenikii~google-trends-scraper/run-sync": {
      "post": {
        "operationId": "run-sync-xenikii-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": "Scraping Mode",
            "enum": [
              "explore",
              "trending_now",
              "both"
            ],
            "type": "string",
            "description": "Choose keyword trend analysis (explore), real-time trending searches (trending_now), or both in one run.",
            "default": "explore"
          },
          "keywords": {
            "title": "Keywords",
            "type": "array",
            "description": "Keywords, phrases, or Google Knowledge Graph topic MIDs (e.g. /m/02wbm) to analyze in Explore mode.",
            "default": [
              "claude code",
              "cursor ai"
            ],
            "items": {
              "type": "string"
            }
          },
          "compareKeywords": {
            "title": "Compare Keywords Head-to-Head",
            "type": "boolean",
            "description": "When enabled, compares up to 5 keywords on the same normalized 0-100 scale and calculates relative Share of Search.",
            "default": false
          },
          "geo": {
            "title": "Country or Region Code (ISO)",
            "type": "string",
            "description": "Two-letter country code (e.g. US, GB, DE, FR, IN, BR, JP) or subregion code (e.g. US-CA). Leave empty for Worldwide.",
            "default": "US"
          },
          "timeframe": {
            "title": "Timeframe",
            "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",
              "custom"
            ],
            "type": "string",
            "description": "Preset Google Trends window or select Custom to provide an exact YYYY-MM-DD YYYY-MM-DD range.",
            "default": "today 12-m"
          },
          "customTimeRange": {
            "title": "Custom Date Range",
            "type": "string",
            "description": "Optional exact range in 'YYYY-MM-DD YYYY-MM-DD' format (e.g. '2025-01-01 2026-11-01'). Overrides timeframe if provided."
          },
          "property": {
            "title": "Google Search Property",
            "enum": [
              "",
              "youtube",
              "froogle",
              "news",
              "images"
            ],
            "type": "string",
            "description": "Target Google search vertical for Explore mode.",
            "default": ""
          },
          "category": {
            "title": "Explore Category ID",
            "minimum": 0,
            "type": "integer",
            "description": "Google Trends numeric category filter (0 = All categories, 5 = Computers & Electronics, 12 = Business & Industrial, 18 = Shopping, etc.).",
            "default": 0
          },
          "language": {
            "title": "Interface Language (hl)",
            "type": "string",
            "description": "BCP-47 locale tag for labels and related queries (e.g. en-US, en-GB, de, es, fr, pt-BR, ja).",
            "default": "en-US"
          },
          "includeRegionBreakdown": {
            "title": "Include Interest by Region",
            "type": "boolean",
            "description": "Fetch geographic breakdown (countries for Worldwide, states/regions for country-level queries).",
            "default": true
          },
          "includeRelatedQueries": {
            "title": "Include Rising & Breakout Related Queries",
            "type": "boolean",
            "description": "Fetch top related queries and fast-rising / Breakout (>5000% growth) search terms.",
            "default": true
          },
          "includeSemanticTopics": {
            "title": "Include Knowledge Graph Semantic Topics",
            "type": "boolean",
            "description": "Resolve matching Google Knowledge Graph topic entities (MID, title, entity type) for each keyword.",
            "default": true
          },
          "trendingCountries": {
            "title": "Trending Now Countries",
            "type": "array",
            "description": "ISO two-letter country codes to fetch real-time surging trends for when mode is 'trending_now' or 'both' (e.g. US, GB, DE).",
            "default": [
              "US"
            ],
            "items": {
              "type": "string"
            }
          },
          "trendingHours": {
            "title": "Trending Now Window",
            "enum": [
              "4",
              "24",
              "48",
              "168"
            ],
            "type": "string",
            "description": "Lookback window for Real-Time Trending Now: 4h, 24h, 48h, or 168h (7 days).",
            "default": "24"
          },
          "trendingCategory": {
            "title": "Trending Now Category",
            "minimum": 0,
            "type": "integer",
            "description": "Category filter for Real-Time Trending Now (0 = All, 18 = Technology, 3 = Business & Finance, 15 = Shopping, 7 = Health, 17 = Sports, 4 = Entertainment, 14 = Science).",
            "default": 0
          },
          "onlyActiveTrends": {
            "title": "Only Active Surging Trends",
            "type": "boolean",
            "description": "Return only currently active surging trends and exclude cooled-down trends.",
            "default": false
          },
          "maxTrendingItems": {
            "title": "Max Trending Items per Country",
            "minimum": 1,
            "maximum": 500,
            "type": "integer",
            "description": "Maximum number of real-time trending searches to emit per country.",
            "default": 50
          },
          "maxConcurrency": {
            "title": "Max Concurrency",
            "minimum": 1,
            "maximum": 8,
            "type": "integer",
            "description": "Parallel keyword requests (keep between 1 and 5 to avoid rate limiting).",
            "default": 3
          },
          "proxyConfiguration": {
            "title": "Proxy Configuration",
            "type": "object",
            "description": "Runs without proxies by default for minimal cost. Optional Apify Proxy fallback if running large keyword batches.",
            "default": {
              "useApifyProxy": 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
                  }
                }
              }
            }
          }
        }
      }
    }
  }
}