{
  "openapi": "3.0.1",
  "info": {
    "title": "Universal Web Scraper API",
    "description": "Scrape any URL through a global, anti-bot-resistant Scraper API. JS rendering, geo-targeting, residential proxies, CSS-selector extraction, and optional LLM processing.",
    "version": "1.0",
    "x-build-id": "5QM97UybXcB1V7d3e"
  },
  "servers": [
    {
      "url": "https://api.apify.com/v2"
    }
  ],
  "paths": {
    "/acts/fayoussef~universal-scraper-api/run-sync-get-dataset-items": {
      "post": {
        "operationId": "run-sync-get-dataset-items-fayoussef-universal-scraper-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/fayoussef~universal-scraper-api/runs": {
      "post": {
        "operationId": "runs-sync-fayoussef-universal-scraper-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/fayoussef~universal-scraper-api/run-sync": {
      "post": {
        "operationId": "run-sync-fayoussef-universal-scraper-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",
        "required": [
          "apiKey",
          "startUrls"
        ],
        "properties": {
          "apiKey": {
            "title": "Scraper API Token",
            "type": "string",
            "description": "Your personal Scraper API token — usage is billed to your own API account. 👉 Don't have one? **[Create a free account and get 1,000 free monthly credits](https://scrape.do/?fpr=automationbyexperts)** — no credit card required. Paste your token from the dashboard once you sign up."
          },
          "startUrls": {
            "title": "Start URLs",
            "type": "array",
            "description": "List of URLs to scrape. Each URL is fetched through the Scraper API and pushed to the dataset as a structured record.",
            "items": {
              "type": "object",
              "required": [
                "url"
              ],
              "properties": {
                "url": {
                  "type": "string",
                  "title": "URL of a web page",
                  "format": "uri"
                }
              }
            }
          },
          "render": {
            "title": "Render JavaScript",
            "type": "boolean",
            "description": "Enable a real headless browser to execute JavaScript before returning HTML. Turn ON for SPAs / dynamic sites (React, Vue, Angular). Costs more API credits per request.",
            "default": false
          },
          "geoCode": {
            "title": "Geo-targeting location",
            "enum": [
              "",
              "ae",
              "al",
              "ar",
              "at",
              "au",
              "br",
              "ca",
              "ch",
              "cl",
              "cn",
              "cr",
              "cy",
              "cz",
              "de",
              "dk",
              "ee",
              "eg",
              "es",
              "fi",
              "fr",
              "gb",
              "gr",
              "hr",
              "ie",
              "it",
              "jp",
              "lt",
              "lv",
              "mt",
              "nl",
              "no",
              "pk",
              "pl",
              "pt",
              "ro",
              "rs",
              "ru",
              "se",
              "sg",
              "si",
              "sk",
              "tr",
              "ua",
              "us",
              "za"
            ],
            "type": "string",
            "description": "Route the request through a proxy located in the selected country. Choose \"Worldwide\" for automatic selection.",
            "default": ""
          },
          "superProxy": {
            "title": "Use residential / premium proxy",
            "type": "boolean",
            "description": "Route requests through the residential / premium proxy pool. Best for heavily protected targets. Costs more credits per request.",
            "default": false
          },
          "extractRules": {
            "title": "Structured extraction rules",
            "type": "object",
            "description": "Optional mapping of field name → CSS selector. For every record the Actor returns the text of the first element matching each selector under `extractedFields`. Example: {\"title\": \"h1\", \"price\": \".price\", \"author\": \".author span\"}."
          },
          "llmEnabled": {
            "title": "🤖 Enable LLM processing",
            "type": "boolean",
            "description": "After scraping each page, run an LLM over its content (summarize, classify, or extract structured data with your own prompt). Powered by OpenRouter. Leave OFF to skip LLM processing entirely.",
            "default": false
          },
          "llmModel": {
            "title": "LLM model (cheapest → most capable)",
            "enum": [
              "deepseek/deepseek-v4-flash",
              "qwen/qwen3.6-flash",
              "google/gemini-3.1-flash-lite",
              "deepseek/deepseek-v4-pro",
              "qwen/qwen3.6-max-preview",
              "x-ai/grok-4.3",
              "google/gemini-3.5-flash",
              "mistralai/mistral-medium-3.5",
              "anthropic/claude-fable-5",
              "openai/gpt-5.5-pro",
              "openrouter/fusion"
            ],
            "type": "string",
            "description": "OpenRouter model used to process each page, listed cheapest to most expensive. The flash / flash-lite models with 1M context are ideal for reading and extracting from long scraped pages at low cost. Need a model not listed here? Use \"Custom model slug\" below.",
            "default": "google/gemini-3.1-flash-lite"
          },
          "llmModelCustom": {
            "title": "Custom model slug (optional, overrides the dropdown)",
            "type": "string",
            "description": "Optional. Any OpenRouter model slug (e.g. \"anthropic/claude-opus-4.8\"). When set, this takes priority over the dropdown above — useful for models not in the list or newly released ones. See https://openrouter.ai/models for all slugs."
          },
          "llmPrompt": {
            "title": "LLM prompt / instruction",
            "type": "string",
            "description": "Instruction applied to each page's content. Examples: \"Summarize this page in 3 bullet points.\" or \"Extract the product name, price and availability.\" The scraped page text is appended automatically.",
            "default": "Summarize the key information on this page in 3-5 concise bullet points."
          },
          "llmJsonOutput": {
            "title": "Force JSON output",
            "type": "boolean",
            "description": "Ask the model to return a strict JSON object (sets response_format=json_object) and parse it into `llmResult`. Best paired with a prompt that describes the exact JSON fields you want.",
            "default": false
          },
          "llmMaxInputChars": {
            "title": "Max input characters sent to LLM",
            "minimum": 500,
            "maximum": 100000,
            "type": "integer",
            "description": "The page text is truncated to this many characters before being sent to the model, to control token cost. Increase for fuller context.",
            "default": 12000
          },
          "llmMaxTokens": {
            "title": "Max output tokens",
            "minimum": 1,
            "maximum": 16000,
            "type": "integer",
            "description": "Maximum number of tokens in the LLM response.",
            "default": 1024
          },
          "llmTemperature": {
            "title": "LLM temperature",
            "type": "string",
            "description": "Sampling temperature 0.0–2.0. Lower is more deterministic (good for extraction); higher is more creative. Leave empty for the model default."
          },
          "concurrencyPercentage": {
            "title": "Concurrency (% of your plan)",
            "minimum": 1,
            "maximum": 100,
            "type": "integer",
            "description": "How much of your plan's concurrent-request limit to use, as a percentage. The Actor reads your live plan limit from the API and scrapes with that percentage of your allowed concurrency. Example: a plan allowing 40 concurrent requests at 50% → 20 parallel requests. Default 100 = full speed (your entire plan limit).",
            "default": 100
          },
          "maxRetries": {
            "title": "Max retries per URL",
            "minimum": 0,
            "maximum": 10,
            "type": "integer",
            "description": "How many times to retry a failing URL (on network errors, rate limits, or 5xx responses) with exponential backoff before giving up.",
            "default": 3
          },
          "requestTimeout": {
            "title": "Request timeout (seconds)",
            "minimum": 10,
            "maximum": 180,
            "type": "integer",
            "description": "Per-request timeout in seconds when calling the Scraper API.",
            "default": 60
          },
          "customHeaders": {
            "title": "Custom request headers",
            "type": "object",
            "description": "Optional HTTP headers forwarded to the target site (e.g. a specific User-Agent or Accept-Language)."
          },
          "storeHtml": {
            "title": "Store raw HTML in dataset",
            "type": "boolean",
            "description": "Include the full raw HTML in each dataset record. Disable to keep datasets small when you only need cleaned text or extracted fields.",
            "default": true
          },
          "telegramAlert": {
            "title": "Send Telegram report on finish",
            "type": "boolean",
            "description": "When enabled, a run report (counts, config, account status, and errors) is sent to Telegram when the Actor finishes.",
            "default": true
          },
          "telegramBotToken": {
            "title": "Telegram bot token (optional)",
            "type": "string",
            "description": "Optional. Override the default Telegram bot token. Leave empty to use the built-in default."
          },
          "telegramChatId": {
            "title": "Telegram chat ID (optional)",
            "type": "string",
            "description": "Optional. Override the default Telegram chat ID that receives the report. Leave empty to use the built-in default."
          },
          "openRouterApiKey": {
            "title": "OpenRouter API key (optional)",
            "type": "string",
            "description": "Optional. Only used when LLM processing is enabled. Provide your own OpenRouter API key to be billed directly by OpenRouter at their rates. Leave EMPTY to use Apify's hosted OpenRouter (https://apify.com/apify/openrouter) and pay with your Apify credits instead — no extra signup needed. Get an OpenRouter key at https://openrouter.ai/keys."
          }
        }
      },
      "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
                  }
                }
              }
            }
          }
        }
      }
    }
  }
}