{
  "openapi": "3.0.1",
  "info": {
    "title": "URL to Markdown: Website & PDF to Markdown for LLM/RAG",
    "description": "Convert web pages, sitemaps, docs sites and PDFs to clean Markdown for LLMs and RAG, in bulk. Keeps headings, code blocks and tables, adds exact token counts and ready-made RAG chunks. Automatic JavaScript rendering for dynamic sites.",
    "version": "1.1",
    "x-build-id": "dS5GckeHagybzhZ4O"
  },
  "servers": [
    {
      "url": "https://api.apify.com/v2"
    }
  ],
  "paths": {
    "/acts/mosaicked_sponge~url-to-markdown-for-llm-rag/run-sync-get-dataset-items": {
      "post": {
        "operationId": "run-sync-get-dataset-items-mosaicked_sponge-url-to-markdown-for-llm-rag",
        "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/mosaicked_sponge~url-to-markdown-for-llm-rag/runs": {
      "post": {
        "operationId": "runs-sync-mosaicked_sponge-url-to-markdown-for-llm-rag",
        "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/mosaicked_sponge~url-to-markdown-for-llm-rag/run-sync": {
      "post": {
        "operationId": "run-sync-mosaicked_sponge-url-to-markdown-for-llm-rag",
        "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": "Web pages, PDFs or Markdown/text files to convert. One URL per line; up to 10,000 per run. Pages behind a login are not supported.",
            "default": [
              "https://docs.python.org/3/tutorial/introduction.html",
              "https://developer.mozilla.org/en-US/docs/Web/HTTP/Guides/Overview",
              "https://llmstxt.org/"
            ],
            "items": {
              "type": "string"
            }
          },
          "sitemapUrls": {
            "title": "Sitemap URLs (optional)",
            "type": "array",
            "description": "sitemap.xml, sitemap index, .xml.gz or plain-text sitemap. Every page listed is added to the run (up to Max URLs).",
            "items": {
              "type": "string"
            }
          },
          "urlsFileUrl": {
            "title": "URL list file: TXT, CSV or Google Sheet link (optional)",
            "type": "string",
            "description": "A public link to a .txt or .csv file, or a Google Sheet shared as \"Anyone with the link\". Every cell that looks like a web address is added to the run (any column, header row ignored)."
          },
          "maxUrls": {
            "title": "Max URLs",
            "minimum": 1,
            "maximum": 10000,
            "type": "integer",
            "description": "Hard cap on pages processed in one run (URLs + sitemap pages).",
            "default": 100
          },
          "crawlDepth": {
            "title": "Crawl links (depth, 0 = off)",
            "minimum": 0,
            "maximum": 5,
            "type": "integer",
            "description": "0 converts only the URLs you list. 1 also converts the pages those URLs link to (inside the crawl scope), 2 goes one level further, and so on. Max URLs still caps the total.",
            "default": 0
          },
          "crawlScope": {
            "title": "Crawl scope",
            "enum": [
              "samePath",
              "sameHost",
              "sameDomain"
            ],
            "type": "string",
            "description": "Which links are followed when crawling. Same folder keeps a docs crawl inside /docs/.",
            "default": "samePath"
          },
          "includeUrlPatterns": {
            "title": "Only follow URLs matching (optional)",
            "type": "array",
            "description": "Glob patterns like https://example.com/blog/* or regular expressions wrapped in slashes like /\\/docs\\/v2\\//. Empty = all links in scope.",
            "items": {
              "type": "string"
            }
          },
          "excludeUrlPatterns": {
            "title": "Never follow URLs matching (optional)",
            "type": "array",
            "description": "Glob or /regex/ patterns to skip, e.g. *?page=* or */tag/*.",
            "items": {
              "type": "string"
            }
          },
          "extractionMode": {
            "title": "Extraction mode",
            "enum": [
              "main",
              "full"
            ],
            "type": "string",
            "description": "Main content: the article/body without menus, headers, footers, cookie banners or sidebars (best for RAG). Full page: everything visible in the HTML except scripts, navigation and footers.",
            "default": "main"
          },
          "contentSelector": {
            "title": "Content CSS selector (optional)",
            "type": "string",
            "description": "Override automatic main-content detection with your own CSS selector, e.g. article.post or #docs-content. Pages where it matches nothing fall back to automatic detection."
          },
          "removeSelectors": {
            "title": "Remove elements (CSS selector, optional)",
            "type": "string",
            "description": "Elements to strip before conversion, e.g. .newsletter-box, .author-card, table.ads"
          },
          "outputFormats": {
            "title": "Output formats",
            "type": "array",
            "description": "Markdown keeps headings, lists, tables, code blocks and links. Plain text strips the Markdown syntax. Raw HTML is the page source (large).",
            "items": {
              "type": "string",
              "enum": [
                "markdown",
                "text",
                "html"
              ],
              "enumTitles": [
                "Markdown",
                "Plain text",
                "Raw HTML"
              ]
            },
            "default": [
              "markdown"
            ]
          },
          "chunkSizeTokens": {
            "title": "RAG chunk size (tokens, 0 = off)",
            "minimum": 0,
            "maximum": 8000,
            "type": "integer",
            "description": "Split each page into heading-aware chunks of about this many tokens, ready for embeddings and vector databases. Each chunk keeps its heading path.",
            "default": 0
          },
          "chunkOverlapTokens": {
            "title": "Chunk overlap (tokens)",
            "minimum": 0,
            "maximum": 2000,
            "type": "integer",
            "description": "Tokens repeated between consecutive chunks so context is not lost at the boundary.",
            "default": 100
          },
          "keepLinksInMarkdown": {
            "title": "Keep hyperlinks in Markdown",
            "type": "boolean",
            "description": "Keep [text](url) links (as absolute URLs). Turn off for shorter, cheaper LLM input.",
            "default": true
          },
          "includeLinksList": {
            "title": "Add list of all page links",
            "type": "boolean",
            "description": "Adds a de-duplicated links[] array (absolute URL + anchor text) to each row. Useful for building your own crawl.",
            "default": false
          },
          "keepImages": {
            "title": "Keep images in Markdown",
            "type": "boolean",
            "description": "Keep ![alt](src) image references in main-content mode.",
            "default": false
          },
          "convertPdfs": {
            "title": "Convert PDFs to text",
            "type": "boolean",
            "description": "Extract the text layer of PDF links (no OCR for scanned PDFs).",
            "default": true
          },
          "maxContentChars": {
            "title": "Max characters per page (0 = no limit)",
            "minimum": 0,
            "type": "integer",
            "description": "Truncate very long pages to keep LLM context and dataset size under control.",
            "default": 0
          },
          "minContentChars": {
            "title": "Min characters to count as extracted",
            "minimum": 0,
            "type": "integer",
            "description": "Pages with less text than this are reported in ERRORS as no-content (for example JavaScript-only apps) instead of returning an empty row.",
            "default": 50
          },
          "respectRobotsTxt": {
            "title": "Respect robots.txt",
            "type": "boolean",
            "description": "Skip URLs the site's robots.txt disallows. Turn off only for your own sites or with permission.",
            "default": true
          },
          "maxConcurrency": {
            "title": "Max parallel requests",
            "minimum": 1,
            "maximum": 50,
            "type": "integer",
            "description": "Total pages fetched in parallel across all sites.",
            "default": 10
          },
          "maxConcurrencyPerDomain": {
            "title": "Max parallel requests per domain",
            "minimum": 1,
            "maximum": 10,
            "type": "integer",
            "description": "Keeps the load on each website polite.",
            "default": 3
          },
          "requestTimeoutSecs": {
            "title": "Request timeout (seconds)",
            "minimum": 5,
            "maximum": 120,
            "type": "integer",
            "description": "Give up on a URL after this many seconds (per attempt).",
            "default": 30
          },
          "maxRetries": {
            "title": "Retries per URL",
            "minimum": 0,
            "maximum": 5,
            "type": "integer",
            "description": "Retries on network errors, 429 and 5xx.",
            "default": 2
          },
          "renderJavaScript": {
            "title": "JavaScript rendering",
            "enum": [
              "auto",
              "never",
              "always"
            ],
            "type": "string",
            "description": "Auto fetches every page with fast HTTP and switches to a headless browser only when the page is built by JavaScript (empty app shell) or shows a bot check. Same price either way.",
            "default": "auto"
          },
          "renderWaitMs": {
            "title": "Extra wait after render (ms)",
            "minimum": 0,
            "maximum": 30000,
            "type": "integer",
            "description": "Additional time to wait in the browser for late-loading content. Usually not needed: the browser already waits for the network to go quiet.",
            "default": 0
          },
          "retryBlockedWithBrowserFingerprint": {
            "title": "Retry refused pages with a real-browser fingerprint",
            "type": "boolean",
            "description": "When a site answers 401/403/429/503 or a bot check, retry with a Chrome/Safari TLS fingerprint before giving up. Free and on by default.",
            "default": true
          },
          "proxyConfiguration": {
            "title": "Proxy for blocked pages (optional)",
            "type": "object",
            "description": "Off by default. If you turn on Apify Proxy (datacenter) or add your own proxy URLs, it is used ONLY for pages that still refuse after the fingerprint retry. Residential proxy is not supported.",
            "default": {
              "useApifyProxy": false
            }
          },
          "saveCombinedMarkdown": {
            "title": "Also save one combined Markdown file",
            "type": "boolean",
            "description": "Saves all converted pages as a single all-pages.md file in the run's key-value store: ready to upload to a Custom GPT, Claude Project or NotebookLM.",
            "default": true
          },
          "exactTokenCounts": {
            "title": "Exact token counts",
            "type": "boolean",
            "description": "Adds tokens (exact count with OpenAI's o200k_base tokenizer, used by GPT-4o/4.1/o-series) to each page and chunk, and sizes chunks by real tokens.",
            "default": true
          },
          "userAgent": {
            "title": "Custom User-Agent (optional)",
            "type": "string",
            "description": "Leave empty to use a standard desktop browser User-Agent."
          }
        }
      },
      "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
                  }
                }
              }
            }
          }
        }
      }
    }
  }
}