{
  "openapi": "3.0.1",
  "info": {
    "title": "Web Fetch API",
    "description": "Web fetch API for LLM and RAG: send one URL or a batch and get clean Markdown or plain text with a token count per page. Reads HTML, PDF and DOCX, renders JavaScript only when a page needs it, can follow same-domain links and alerts you when a page's text changes. Failed pages are free.",
    "version": "0.1",
    "x-build-id": "JbguzHhcZckM4zM7U"
  },
  "servers": [
    {
      "url": "https://api.apify.com/v2"
    }
  ],
  "paths": {
    "/acts/datahamster~web-fetch-api/run-sync-get-dataset-items": {
      "post": {
        "operationId": "run-sync-get-dataset-items-datahamster-web-fetch-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/datahamster~web-fetch-api/runs": {
      "post": {
        "operationId": "runs-sync-datahamster-web-fetch-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/datahamster~web-fetch-api/run-sync": {
      "post": {
        "operationId": "run-sync-datahamster-web-fetch-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",
        "properties": {
          "urls": {
            "title": "URLs",
            "type": "array",
            "description": "Pages or documents to fetch, one per line: web pages, PDF and DOCX files, e.g. \"https://docs.python.org/3/library/asyncio-task.html\". Any number per run, fetched in parallel. Private and internal addresses are refused.",
            "default": [
              "https://docs.python.org/3/library/asyncio-task.html"
            ],
            "items": {
              "type": "string"
            }
          },
          "formats": {
            "title": "Output formats",
            "type": "array",
            "description": "What to return per page: Markdown, plain text, or both. The token count is taken from the Markdown when it is requested, otherwise from the text.",
            "items": {
              "type": "string",
              "enum": [
                "markdown",
                "text"
              ],
              "enumTitles": [
                "Markdown (headings, lists, tables, code)",
                "Plain text (no markup)"
              ]
            },
            "default": [
              "markdown"
            ]
          },
          "maxTokensPerPage": {
            "title": "Max tokens per page",
            "minimum": 50,
            "maximum": 2000000,
            "type": "integer",
            "description": "Optional: cut each page's Markdown/text to this many tokens (o200k_base, the GPT-4o tokenizer), e.g. 4000. The row gets truncated: true. Empty = no limit."
          },
          "crawlLinks": {
            "title": "Also fetch same-domain links (depth 1)",
            "type": "boolean",
            "description": "true = for every listed URL, also fetch up to Max links per URL pages it links to on the same domain (one level deep). Login, cart, privacy and similar pages are skipped.",
            "default": false
          },
          "maxLinksPerUrl": {
            "title": "Max links per URL",
            "minimum": 1,
            "maximum": 100,
            "type": "integer",
            "description": "With link following on: how many same-domain links to fetch per listed URL, in page order, e.g. 10.",
            "default": 10
          },
          "includeUrlPatterns": {
            "title": "Include link patterns",
            "type": "array",
            "description": "With link following on: glob patterns a link must match, e.g. \"*/docs/*\". Empty = any same-domain link.",
            "items": {
              "type": "string"
            }
          },
          "excludeUrlPatterns": {
            "title": "Exclude link patterns",
            "type": "array",
            "description": "With link following on: glob patterns of links to skip, e.g. \"*/blog/*\".",
            "items": {
              "type": "string"
            }
          },
          "renderJs": {
            "title": "JavaScript rendering",
            "enum": [
              "auto",
              "never",
              "always"
            ],
            "type": "string",
            "description": "auto = plain HTTP first; a page is opened in headless Chromium only when the HTTP answer is an app shell with almost no text. always = every page in a browser (slower). never = plain HTTP only.",
            "default": "auto"
          },
          "waitFor": {
            "title": "Wait for selector",
            "type": "string",
            "description": "Only for browser-rendered pages: CSS selector to wait for before reading, e.g. \"article\"."
          },
          "documents": {
            "title": "Read PDF and DOCX",
            "type": "boolean",
            "description": "true = extract the text of PDF (with a text layer) and Word DOCX files up to 25 MB. false = skip them as free failed rows.",
            "default": true
          },
          "includeLinks": {
            "title": "Include links",
            "type": "boolean",
            "description": "true = keep links inline in the Markdown and add a links list (absolute URL and anchor text) to each row.",
            "default": false
          },
          "includeImages": {
            "title": "Include images",
            "type": "boolean",
            "description": "true = keep images in the Markdown and add an images list (absolute URL and alt text) to each row.",
            "default": false
          },
          "proxyTier": {
            "title": "Proxy",
            "enum": [
              "auto",
              "none",
              "datacenter",
              "residential",
              "unblocker"
            ],
            "type": "string",
            "description": "auto = start without a proxy and step up to datacenter, residential and Web Unblocker only when a page answers with a block or challenge. The working tier is remembered per site.",
            "default": "auto"
          },
          "proxyCountry": {
            "title": "Proxy country",
            "type": "string",
            "description": "Optional two-letter country for proxy exits, e.g. \"US\" or \"DE\"."
          },
          "concurrency": {
            "title": "Parallel fetches",
            "minimum": 1,
            "maximum": 20,
            "type": "integer",
            "description": "How many URLs are fetched at the same time, e.g. 5. Requests to one site stay at least Delay per domain apart.",
            "default": 5
          },
          "domainDelaySecs": {
            "title": "Delay per domain (s)",
            "minimum": 0,
            "maximum": 60,
            "type": "number",
            "description": "Minimum pause between two requests to the same site, in seconds, e.g. 0.5.",
            "default": 0.5
          },
          "timeout": {
            "title": "Page timeout (s)",
            "minimum": 5,
            "maximum": 300,
            "type": "integer",
            "description": "Timeout of one request in seconds, e.g. 45. One URL gets at most 3 times this across all proxy tiers and the browser.",
            "default": 45
          },
          "maxItems": {
            "title": "Max items",
            "minimum": 1,
            "type": "integer",
            "description": "Stop after this many successful pages (failed pages are free and do not count), e.g. 10.",
            "default": 100
          },
          "mode": {
            "title": "Mode",
            "enum": [
              "scrape",
              "monitor"
            ],
            "type": "string",
            "description": "scrape = full results; monitor = only new/changed items since the previous run of this task",
            "default": "scrape"
          },
          "monitorStateId": {
            "title": "Monitor state id",
            "type": "string",
            "description": "Optional state id when not running as a saved task (monitor mode)"
          },
          "webhookUrl": {
            "title": "Webhook URL",
            "type": "string",
            "description": "POST a change summary here in monitor mode"
          },
          "telegramBotToken": {
            "title": "Telegram bot token",
            "type": "string",
            "description": "Optional: bot token for monitor-mode change summaries"
          },
          "telegramChatId": {
            "title": "Telegram chat id",
            "type": "string",
            "description": "Optional: chat id that receives monitor-mode summaries"
          }
        }
      },
      "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
                  }
                }
              }
            }
          }
        }
      }
    }
  }
}