{
  "openapi": "3.0.1",
  "info": {
    "title": "Google SERP & AEO Scraper",
    "description": "Scrape Google organic SERP with geo targeting, search operators, and flat SEO export. Match Google ranks vs ChatGPT and other LLM citations in one dataset. Includes a Google Sheets template — run scans from a spreadsheet, no code required.",
    "version": "0.0",
    "x-build-id": "TU9xTONwSse1mdOrm"
  },
  "servers": [
    {
      "url": "https://api.apify.com/v2"
    }
  ],
  "paths": {
    "/acts/morph_coder~google-serp-aeo-scraper/run-sync-get-dataset-items": {
      "post": {
        "operationId": "run-sync-get-dataset-items-morph_coder-google-serp-aeo-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/morph_coder~google-serp-aeo-scraper/runs": {
      "post": {
        "operationId": "runs-sync-morph_coder-google-serp-aeo-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/morph_coder~google-serp-aeo-scraper/run-sync": {
      "post": {
        "operationId": "run-sync-morph_coder-google-serp-aeo-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": [
          "queries"
        ],
        "properties": {
          "queries": {
            "title": "Search queries",
            "type": "array",
            "description": "One or more keywords or Google Search URLs. All results go to one dataset; use the keyword column to filter. API clients may also pass a newline-separated string.",
            "items": {
              "type": "string"
            }
          },
          "countryCode": {
            "title": "Country",
            "enum": [
              "us",
              "gb",
              "de",
              "fr",
              "es",
              "it",
              "in",
              "au",
              "ca",
              "br",
              "mx",
              "jp",
              "kr",
              "nl",
              "pl",
              "ua",
              "ae",
              "sg",
              "hk",
              "tw",
              "se",
              "no",
              "dk",
              "fi",
              "be",
              "at",
              "ch",
              "cz",
              "ro",
              "pt",
              "gr",
              "tr",
              "il",
              "sa",
              "za",
              "ng",
              "ph",
              "id",
              "my",
              "th",
              "vn",
              "nz",
              "ie",
              "ar",
              "cl",
              "co",
              "pe"
            ],
            "type": "string",
            "description": "ISO 3166-1 alpha-2 country code: selects Google domain (google.co.in, …), GOOGLE_SERP proxy country (with fallback), and default UI language.",
            "default": "us"
          },
          "maxPagesPerQuery": {
            "title": "Max pages per query",
            "minimum": 1,
            "maximum": 10,
            "type": "integer",
            "description": "Stop after this many SERP pages when maxResultsPerQuery is not set (1–10). Ignored when maxResultsPerQuery is set — the actor fetches extra pages until the organic target is met."
          },
          "maxResultsPerQuery": {
            "title": "Max organic results per keyword",
            "minimum": 1,
            "maximum": 100,
            "type": "integer",
            "description": "Top-N organic rows for each keyword (e.g. 20 = top-20 per keyword). With 10 keywords this can mean up to 200 rows — use maxTotalResults to cap the whole run."
          },
          "maxTotalResults": {
            "title": "Max organic results (whole run)",
            "minimum": 1,
            "maximum": 1000,
            "type": "integer",
            "description": "Optional hard cap on total organic rows across all keywords. When set, keywords are processed sequentially and the budget is consumed in order — e.g. maxTotalResults 34 with two keywords at top-20 gives 20 + 14 rows. Omit for full maxResultsPerQuery on every keyword."
          },
          "outputFormat": {
            "title": "Output format",
            "enum": [
              "page",
              "flat",
              "both"
            ],
            "type": "string",
            "description": "page = one row per SERP page; flat = one row per result; both = both formats.",
            "default": "both"
          },
          "mobileResults": {
            "title": "Mobile results",
            "type": "boolean",
            "description": "Scrape mobile SERP layout instead of desktop.",
            "default": false
          },
          "forceExactMatch": {
            "title": "Force exact match",
            "type": "boolean",
            "description": "Wrap each query in double quotes.",
            "default": false
          },
          "site": {
            "title": "Site filter",
            "type": "string",
            "description": "Restrict results to a domain (site: operator)."
          },
          "relatedToSite": {
            "title": "Related to site",
            "type": "string",
            "description": "Find pages related to a domain (related: operator). Ignored if site is set."
          },
          "wordsInTitle": {
            "title": "Words in title",
            "type": "array",
            "description": "Add intitle: filters.",
            "items": {
              "type": "string"
            }
          },
          "wordsInText": {
            "title": "Words in text",
            "type": "array",
            "description": "Add intext: filters.",
            "items": {
              "type": "string"
            }
          },
          "wordsInUrl": {
            "title": "Words in URL",
            "type": "array",
            "description": "Add inurl: filters.",
            "items": {
              "type": "string"
            }
          },
          "fileTypes": {
            "title": "File types",
            "type": "array",
            "description": "Restrict to file types (pdf, doc, xls, ppt, etc.).",
            "items": {
              "type": "string"
            }
          },
          "quickDateRange": {
            "title": "Quick date range",
            "enum": [
              "",
              "d",
              "d10",
              "w2",
              "m6",
              "y1"
            ],
            "type": "string",
            "description": "Relative date filter: d (1 day), d10, w2, m6, y1."
          },
          "beforeDate": {
            "title": "Before date",
            "type": "string",
            "description": "Absolute date filter (YYYY-MM-DD)."
          },
          "afterDate": {
            "title": "After date",
            "type": "string",
            "description": "Absolute date filter (YYYY-MM-DD)."
          },
          "searchLanguage": {
            "title": "Search language (lr)",
            "type": "string",
            "description": "Restrict result language (Google lr parameter)."
          },
          "languageCode": {
            "title": "UI language (hl)",
            "type": "string",
            "description": "Google interface language."
          },
          "locationUule": {
            "title": "Location UULE",
            "type": "string",
            "description": "Encoded geolocation (uule parameter)."
          },
          "focusOnPaidAds": {
            "title": "Focus on paid ads",
            "type": "boolean",
            "description": "Enhanced ad extraction with up to 3 retries per page.",
            "default": false
          },
          "includeUnfilteredResults": {
            "title": "Include unfiltered results",
            "type": "boolean",
            "description": "Include lower-quality or duplicate results that Google normally filters out.",
            "default": false
          },
          "saveHtml": {
            "title": "Save HTML to dataset",
            "type": "boolean",
            "description": "Store raw SERP HTML in each dataset row (large payloads).",
            "default": false
          },
          "saveHtmlToKeyValueStore": {
            "title": "Save HTML to key-value store",
            "type": "boolean",
            "description": "Save HTML snapshots to the run key-value store and link via htmlSnapshotUrl.",
            "default": true
          },
          "includeIcons": {
            "title": "Include favicon icons",
            "type": "boolean",
            "description": "Embed base64 favicon images in result objects.",
            "default": false
          },
          "disableGoogleSearchResults": {
            "title": "Disable Google SERP (LLM only)",
            "type": "boolean",
            "description": "Skip Google SERP scraping and run LLM add-ons only.",
            "default": false
          },
          "targetBrand": {
            "title": "Target brand",
            "type": "string",
            "description": "Brand name for visibility comparison in LLM results."
          },
          "targetDomains": {
            "title": "Target domains",
            "type": "array",
            "description": "Domains to track in results.",
            "items": {
              "type": "string"
            }
          },
          "llmSearchScope": {
            "title": "LLM search scope",
            "enum": [
              "perQuery",
              "perPage"
            ],
            "type": "string",
            "description": "perQuery = one LLM call per keyword; perPage = call on each SERP page.",
            "default": "perQuery"
          },
          "llmQueryMode": {
            "title": "LLM query mode",
            "enum": [
              "sameAsKeyword",
              "conversational"
            ],
            "type": "string",
            "description": "sameAsKeyword sends the exact Google keyword to the LLM web search (recommended). conversational expands short keywords into a question.",
            "default": "sameAsKeyword"
          },
          "llmApplyTo": {
            "title": "Run LLM for",
            "enum": [
              "brandLike",
              "targetOnly",
              "all"
            ],
            "type": "string",
            "description": "brandLike = short brand-style keywords only (default). targetOnly = keywords matching targetBrand/targetDomains. all = every keyword.",
            "default": "brandLike"
          },
          "aiModeSearch": {
            "title": "Google AI Mode",
            "type": "object",
            "description": "Google AI Mode (Playwright UI — coming soon).",
            "properties": {
              "enableAiMode": {
                "title": "Enable AI Mode",
                "type": "boolean",
                "description": "Scrape Google AI Mode UI (requires Playwright — coming soon).",
                "default": false
              }
            }
          },
          "chatGptSearch": {
            "title": "ChatGPT search",
            "type": "object",
            "description": "Fetch AI answer via OpenAI Responses API with web search (requires OPENAI_API_KEY secret).",
            "properties": {
              "enableChatGpt": {
                "title": "Enable ChatGPT",
                "type": "boolean",
                "description": "Fetch a web-grounded AI answer via OpenAI Responses API + web_search (requires OPENAI_API_KEY secret).",
                "default": false
              }
            }
          },
          "copilotSearch": {
            "title": "Copilot search",
            "type": "object",
            "description": "Fetch AI answer via Azure OpenAI (requires AZURE_OPENAI_* secrets).",
            "properties": {
              "enableCopilot": {
                "title": "Enable Copilot",
                "type": "boolean",
                "description": "Fetch an AI answer for each keyword via Azure OpenAI.",
                "default": false
              }
            }
          },
          "geminiSearch": {
            "title": "Gemini search",
            "type": "object",
            "description": "Fetch AI answer via Gemini API (requires GEMINI_API_KEY secret).",
            "properties": {
              "enableGemini": {
                "title": "Enable Gemini",
                "type": "boolean",
                "description": "Fetch an AI answer for each keyword via Google Gemini API.",
                "default": false
              }
            }
          },
          "perplexitySearch": {
            "title": "Perplexity search",
            "type": "object",
            "description": "Fetch AI answer via Perplexity API (requires PERPLEXITY_API_KEY secret).",
            "properties": {
              "enablePerplexity": {
                "title": "Enable Perplexity",
                "type": "boolean",
                "description": "Fetch an AI answer with citations via Perplexity Sonar API.",
                "default": false
              },
              "returnImages": {
                "title": "Return images",
                "type": "boolean",
                "description": "Include image URLs in the Perplexity response when available.",
                "default": false
              },
              "returnRelatedQuestions": {
                "title": "Return related questions",
                "type": "boolean",
                "description": "Include related follow-up questions from Perplexity.",
                "default": false
              },
              "searchRecency": {
                "title": "Search recency",
                "type": "string",
                "description": "Limit Perplexity web search to recent content.",
                "enum": [
                  "day",
                  "week",
                  "month",
                  "year"
                ],
                "default": "month"
              }
            }
          },
          "deepSeekSearch": {
            "title": "DeepSeek search (experimental)",
            "type": "object",
            "description": "Experimental: DeepSeek chat completion only (no web citations). $0.02/call ($20 / 1,000). Requires DEEPSEEK_API_KEY in Actor secrets.",
            "properties": {
              "enableDeepSeek": {
                "title": "Enable DeepSeek (experimental)",
                "type": "boolean",
                "description": "Test add-on: chat answer without web search citations. Not suitable for AEO URL ranking yet.",
                "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
                  }
                }
              },
              "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
                  }
                }
              }
            }
          }
        }
      }
    }
  }
}