{
  "openapi": "3.0.1",
  "info": {
    "title": "Smart Fetch - URL to Markdown from US, Singapore, EU or Taiwan",
    "description": "Fetch any public URL as clean Markdown, HTML and JSON metadata. Pick the region it is fetched from (US, Singapore, EU, Taiwan residential) or let Auto switch region when a site blocks. JavaScript rendering, robots.txt respected, failed pages free. From $1/1,000 pages.",
    "version": "0.1",
    "x-build-id": "i7E3uPDgO4Q7iR0N4"
  },
  "servers": [
    {
      "url": "https://api.apify.com/v2"
    }
  ],
  "paths": {
    "/acts/tidytools~smart-fetch/run-sync-get-dataset-items": {
      "post": {
        "operationId": "run-sync-get-dataset-items-tidytools-smart-fetch",
        "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/tidytools~smart-fetch/runs": {
      "post": {
        "operationId": "runs-sync-tidytools-smart-fetch",
        "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/tidytools~smart-fetch/run-sync": {
      "post": {
        "operationId": "run-sync-tidytools-smart-fetch",
        "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 to fetch, one per line: full URLs or bare domains like example.com. Up to 50,000 per run. Invalid lines become a result row with errorType \"invalid_input\" (not charged) instead of failing the run.",
            "items": {
              "type": "string"
            }
          },
          "region": {
            "title": "Fetch from (region)",
            "enum": [
              "auto",
              "cf",
              "us",
              "sg",
              "eu",
              "tw"
            ],
            "type": "string",
            "description": "Where the request leaves from. Auto (recommended): Cloudflare HTTP first; a JavaScript shell goes straight to a browser, while a blocked HTTP page tries our US server before a browser. A chosen region fetches only from there (turn on \"Try other regions\" to fall back). HTTP pages delivered from US, Singapore, EU or Taiwan add the region fee; browser pages do not.",
            "default": "auto"
          },
          "mode": {
            "title": "Page fetching",
            "enum": [
              "auto",
              "http",
              "browser"
            ],
            "type": "string",
            "description": "Auto: plain HTTP first; a short JavaScript shell goes straight to a browser. With region Auto, our Taiwan Chrome pool takes over when Cloudflare Browser Rendering is busy or at the 9-hour monthly cap. HTTP: never a browser. Browser: always render, from Cloudflare (Auto or Cloudflare) or our Taiwan residential Chrome (Taiwan); US, Singapore and Europe do not support Browser. A page is charged as a browser page only when the browser result is used.",
            "default": "auto"
          },
          "includeMarkdown": {
            "title": "Markdown",
            "type": "boolean",
            "description": "Clean Markdown of the page (PDF, Word and Excel files too) with a YAML header (title, description, image).",
            "default": true
          },
          "includeHtml": {
            "title": "HTML",
            "type": "boolean",
            "description": "The page's HTML as received (or as rendered in browser mode), up to 2,000,000 characters.",
            "default": false
          },
          "includeLinks": {
            "title": "Links",
            "type": "boolean",
            "description": "All absolute links on the page in metadata.links.",
            "default": false
          },
          "respectRobots": {
            "title": "Respect robots.txt",
            "type": "boolean",
            "description": "Skip pages that the site's robots.txt disallows for our user agent TidyToolsSmartFetch (errorType robots_disallowed, not charged).",
            "default": true
          },
          "tryOtherRegions": {
            "title": "Try other regions when blocked",
            "type": "boolean",
            "description": "Leave unset for the default: on for Auto, off for a chosen region. On: when the chosen region is refused, Cloudflare, US and Taiwan are tried too."
          },
          "removeBoilerplate": {
            "title": "Remove navigation, header and footer",
            "type": "boolean",
            "description": "Leave site navigation, cookie banners, headers and footers out of the Markdown.",
            "default": true
          },
          "mainContent": {
            "title": "Main content only",
            "type": "boolean",
            "description": "Convert only the page's main element (article / main) when it is unambiguous. Falls back to the whole page when that is nearly empty.",
            "default": false
          },
          "waitUntil": {
            "title": "Browser: wait until",
            "enum": [
              "load",
              "domcontentloaded",
              "networkidle2"
            ],
            "type": "string",
            "description": "When a browser page counts as loaded.",
            "default": "load"
          },
          "timeoutSecs": {
            "title": "Time limit per network (seconds)",
            "minimum": 5,
            "maximum": 60,
            "type": "integer",
            "description": "How long one attempt may take before the next region is tried.",
            "default": 30
          },
          "maxConcurrency": {
            "title": "Parallel URLs",
            "minimum": 1,
            "maximum": 20,
            "type": "integer",
            "description": "How many URLs are fetched at the same time.",
            "default": 5
          },
          "maxTokens": {
            "title": "Markdown token limit",
            "minimum": 1,
            "maximum": 1000000,
            "type": "integer",
            "description": "Return at most this many tokens of Markdown (about 4 characters per token for Latin text, one per CJK character). The Markdown is cut at a blank-line boundary so a block is never split in half; the row's nextStartIndex is where to continue (pass it as startIndex in the next run). Leave empty for the whole page."
          },
          "startIndex": {
            "title": "Start at character",
            "minimum": 0,
            "maximum": 50000000,
            "type": "integer",
            "description": "Return the Markdown from this character offset onward (a page you got earlier via nextStartIndex). 0 means the start of the page.",
            "default": 0
          },
          "links": {
            "title": "Links in Markdown",
            "enum": [
              "inline",
              "footnotes",
              "none"
            ],
            "type": "string",
            "description": "How links appear in the Markdown. Inline keeps [text](url). Footnotes moves the URLs to numbered [^n] notes at the end. None keeps the link text only.",
            "default": "inline"
          },
          "images": {
            "title": "Images in Markdown",
            "enum": [
              "all",
              "alt",
              "none"
            ],
            "type": "string",
            "description": "How images appear in the Markdown. Keep images leaves ![alt](url) as is; Alt text only keeps the image's alt text; None drops the images.",
            "default": "all"
          },
          "query": {
            "title": "Keep blocks matching a query",
            "type": "string",
            "description": "Rank the Markdown blocks with BM25 against this query and keep only the most relevant ones (up to Blocks kept for a query), in the original page order. No AI model is used. Leave empty to keep the whole page."
          },
          "queryMaxBlocks": {
            "title": "Blocks kept for a query",
            "minimum": 1,
            "maximum": 100,
            "type": "integer",
            "description": "How many blocks the query keeps (the most relevant ones, in page order).",
            "default": 5
          },
          "startUrls": {
            "title": "URL list files (optional)",
            "type": "array",
            "description": "Upload or link .txt/.csv files of URLs (every http(s) URL in a file is read). Full URLs only here.",
            "items": {
              "type": "object",
              "required": [
                "url"
              ],
              "properties": {
                "url": {
                  "type": "string",
                  "title": "URL of a web page",
                  "format": "uri"
                }
              }
            }
          }
        }
      },
      "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
                  }
                }
              }
            }
          }
        }
      }
    }
  }
}