{
  "openapi": "3.0.1",
  "info": {
    "title": "Web Scraper — CSS Selector & Data Extractor",
    "description": "Web Scraper pulls any CSS selector off any page, returning text, HTML, attributes, tables or counts — one row per page (lists: an items array), no browser.",
    "version": "0.2",
    "x-build-id": "Z8Ffhw7OVM6N8GPTV"
  },
  "servers": [
    {
      "url": "https://api.apify.com/v2"
    }
  ],
  "paths": {
    "/acts/webdatatools~css-selector-extractor/run-sync-get-dataset-items": {
      "post": {
        "operationId": "run-sync-get-dataset-items-webdatatools-css-selector-extractor",
        "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/webdatatools~css-selector-extractor/runs": {
      "post": {
        "operationId": "runs-sync-webdatatools-css-selector-extractor",
        "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/webdatatools~css-selector-extractor/run-sync": {
      "post": {
        "operationId": "run-sync-webdatatools-css-selector-extractor",
        "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": {
          "urls": {
            "title": "URLs",
            "type": "array",
            "description": "Enter one URL per row to fetch and run the selectors against, e.g. https://example.com. Each page fetched gets exactly one result row, even if the fetch fails (in item mode the row holds an items array). Rows are saved as pages finish; if the run timeout comes first, the run stops early and still ends SUCCEEDED with every page done so far.",
            "default": [
              "https://example.com"
            ],
            "items": {
              "type": "string"
            }
          },
          "selectors": {
            "title": "Selectors",
            "type": "array",
            "description": "Enter the fields to extract as a JSON array of {\"name\", \"selector\", \"type\"} objects. \"type\" is text, html, attr, count or table; \"attr\" also needs \"attribute\" (e.g. {\"name\":\"canonicalUrl\",\"selector\":\"link[rel='canonical']\",\"type\":\"attr\",\"attribute\":\"href\"}). \"table\" returns the matched <table> as an array of row objects keyed by its header row. Capped at 25 entries per run.",
            "default": [
              {
                "name": "title",
                "selector": "h1",
                "type": "text"
              }
            ]
          },
          "firstMatchOnly": {
            "title": "First match only",
            "type": "boolean",
            "description": "Keep this on to return only the first element each selector matches. Turn it off to return every match (up to Max matches per selector) as an array.",
            "default": true
          },
          "maxMatchesPerSelector": {
            "title": "Max matches per selector",
            "minimum": 1,
            "maximum": 500,
            "type": "integer",
            "description": "Enter the most matches to return for one selector when First match only is off, e.g. 20. Does not limit the reported match count, only how many values are returned.",
            "default": 20
          },
          "trimWhitespace": {
            "title": "Trim whitespace",
            "type": "boolean",
            "description": "Keep this on to collapse runs of whitespace and trim the ends of extracted text and attribute values. Turning it off returns text and attr values exactly as found in the page.",
            "default": true
          },
          "maxConcurrency": {
            "title": "Max concurrency",
            "minimum": 1,
            "maximum": 20,
            "type": "integer",
            "description": "Enter how many URLs to fetch in parallel, e.g. 5. Raise it for long URL lists or short run timeouts (a simple site handles roughly 10–20 pages per second at 5); lower it if a target site starts returning errors under load.",
            "default": 5
          },
          "itemSelector": {
            "title": "Item selector (list pages)",
            "type": "string",
            "description": "Optional. A CSS selector for repeated items, e.g. \"div.product-card\". When set, each matching element becomes one object in the row's \"items\" array, and every selector above is searched only inside that element. The row is still one per page."
          },
          "maxItemsPerPage": {
            "title": "Max items per page",
            "minimum": 1,
            "maximum": 1000,
            "type": "integer",
            "description": "Optional. Most items to return per page in item mode (default 200). \"itemCount\" always reports the full number."
          },
          "linkSelector": {
            "title": "Link selector (follow links)",
            "type": "string",
            "description": "Optional. A CSS selector for links to follow, e.g. \"a.next\" for pagination or \"a.product-link\" for detail pages. Every followed page is extracted the same way and billed as one page. Capped by Max pages."
          },
          "sitemapUrls": {
            "title": "Sitemap URLs",
            "type": "array",
            "description": "Optional. Sitemap or sitemap-index URLs, e.g. https://example.com/sitemap.xml. Every page URL listed (gzip and nested indexes handled) is added to the run, capped by Max pages.",
            "items": {
              "type": "string"
            }
          },
          "urlPattern": {
            "title": "URL pattern",
            "type": "string",
            "description": "Optional regular expression. Only followed links and sitemap URLs matching it are processed, e.g. \"/products/\"."
          },
          "urlTemplate": {
            "title": "URL template (pagination)",
            "type": "string",
            "description": "Optional. A URL with a {page} placeholder, e.g. \"https://books.toscrape.com/catalogue/page-{page}.html\". One URL per page number in Page range is added to the run (up to 10,000), after the URLs above. Each page is one result."
          },
          "pageRange": {
            "title": "Page range",
            "type": "object",
            "description": "Used with URL template: {\"from\": 1, \"to\": 10} and optionally \"step\" (e.g. 20 for offset-style URLs like ?start={page}). Inclusive; from defaults to 1."
          },
          "maxPages": {
            "title": "Max pages",
            "minimum": 1,
            "maximum": 100000,
            "type": "integer",
            "description": "Optional. Total page cap when following links or reading sitemaps (default 100). Plain URL lists are not capped by this."
          },
          "sameDomainOnly": {
            "title": "Stay on the same domain",
            "type": "boolean",
            "description": "Only follow links on the same host as the page they were found on (default on)."
          },
          "includeMetadata": {
            "title": "Include page metadata",
            "type": "boolean",
            "description": "Add a \"metadata\" object to each row: title, description, canonical URL, language, Open Graph tags and parsed JSON-LD (schema.org) blocks."
          },
          "headers": {
            "title": "Request headers",
            "type": "object",
            "description": "Optional. Extra HTTP headers sent with every page request, e.g. {\"Accept-Language\": \"de-DE\", \"Authorization\": \"Bearer …\"}. A \"User-Agent\" here replaces the default one. Values are never written to the log."
          },
          "cookies": {
            "title": "Cookies",
            "type": "array",
            "description": "Optional. Cookies sent with every page request, as [\"name=value\", …] or the [{\"name\": …, \"value\": …}] list a browser cookie-export extension produces (domain and path are ignored). Values are never written to the log; a raw Cookie header can also go in Request headers."
          },
          "proxyMode": {
            "title": "Proxy mode",
            "enum": [
              "auto",
              "always",
              "never"
            ],
            "type": "string",
            "description": "'auto' (recommended) requests each URL directly first and only switches to Apify Proxy for the rest of the run if a direct request gets blocked — this keeps proxy cost at $0 whenever a site isn't blocking datacenter IPs. 'always' skips the direct attempt and always uses the proxy. 'never' always requests directly, even if that means errors.",
            "default": "auto"
          },
          "proxyConfiguration": {
            "title": "Proxy configuration",
            "type": "object",
            "description": "Which Apify Proxy group to use when 'Proxy mode' above decides a request needs the proxy (either 'auto' after a block, or 'always'). Leave Residential proxy selected (the default) unless you know a datacenter group works for your target. Not needed when running locally with your own IP.",
            "default": {
              "useApifyProxy": true,
              "apifyProxyGroups": [
                "RESIDENTIAL"
              ]
            }
          },
          "inputDatasetId": {
            "title": "Input dataset ID (optional)",
            "type": "string",
            "description": "Take the items from another Actor run's dataset, e.g. \"aBcD1234\". Combined with the list above."
          },
          "inputField": {
            "title": "Field to read from that dataset",
            "type": "string",
            "description": "Column holding the value, e.g. \"url\" (the default). Array columns are flattened."
          }
        }
      },
      "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
                  }
                }
              }
            }
          }
        }
      }
    }
  }
}