# Website to Markdown Crawler for AI & RAG (with PDFs) (`prometheus-maker/website-to-markdown-crawler`) Actor

Crawl a website and save every page as clean Markdown for LLMs, RAG and AI chatbots: main content only, no menus or cookie banners. Linked PDF, Word, PowerPoint and Excel files are converted too. Optional chunking.

- **URL**: https://apify.com/prometheus-maker/website-to-markdown-crawler.md
- **Developed by:** [Prometheus](https://apify.com/prometheus-maker) (community)
- **Categories:** AI, Developer tools, Automation
- **Security:** Limited permissions
- **Stats:** 2 total users, 1 monthly users, 100.0% runs succeeded, 0 bookmarks
- **User rating**: No ratings yet

## Pricing

from $1.00 / 1,000 web page saveds

This Actor is paid per event. You are not charged for the Apify platform usage, but only a fixed price for specific events.
Since this Actor supports Apify Store discounts, the price gets lower the higher subscription plan you have.

Learn more: https://docs.apify.com/actors/running/actors-in-store.md#pay-per-event

## What's an Apify Actor?

An Actor is a serverless cloud program that runs on the Apify platform. It has two run modes.
In Batch mode, an Actor accepts a well-defined JSON input, performs an action which can take anything from a few seconds to a few hours,
and optionally produces a well-defined JSON output, datasets with results, or files in key-value store.
In Standby mode, an Actor provides a web server which can be used as a website, API, or an MCP server.

Apify vocabulary and the platform model are defined once, in the agent quickstart at https://apify.com/agents.md.

## How to integrate an Actor?

If asked about integration, you help developers integrate Actors into their projects.
You adapt to their stack and deliver integrations that are safe, well-documented, and production-ready.

Do not guess an integration path. Every one of them is in the agent quickstart at https://apify.com/agents.md: the Apify MCP server, Agent Skills with the Apify CLI, the JavaScript and Python clients, the REST API, and the account-free path for an agent with no human to sign in. It also carries the rule on stating cost before the first paid run.

For examples already wired to this Actor's own input schema, see the [API](#api) section below.

Each client library has reference documentation the quickstart does not restate: [JavaScript/TypeScript](https://docs.apify.com/api/client/js/docs.md) (`npm install apify-client`) and [Python](https://docs.apify.com/api/client/python/docs.md) (`pip install apify-client`).

# README

## Website to Markdown Crawler for AI & RAG (with PDFs)

Turn a website into **clean Markdown** for LLMs, RAG pipelines, AI chatbots and knowledge bases. Give it a start URL; it follows the site's links and saves each page's **main content only**: no menus, cookie banners, sidebars or footers. Headings, lists, tables, code blocks and links are kept.

**PDF, Word, PowerPoint and Excel files** linked from the pages are converted to Markdown too, so a help centre or a documentation site comes back complete, manuals included.

**$1.50 per 1,000 pages.** No browser, so it's fast: 10 pages of the Python tutorial in about 2 seconds.

**Measured, not guessed.** On 45 pages from 8 sites (MDN, GOV.UK, Python docs, GitHub Docs, Wikipedia, Cloudflare blog, react.dev, BBC), only **3%** of the text this crawler keeps repeats from page to page (menus, footers, banners). Converting whole pages to Markdown leaves **29%** repeated boilerplate and 2.4 times as much text to pay LLM tokens for. It still keeps **89%** of the words in each page's main content area.

### Who it's for

- **RAG and chatbot builders**: feed a company's docs, help centre or blog into a vector database
- **AI agents**: read a whole documentation section in one call instead of page by page
- **Content and SEO teams**: export a site's text for audits, migrations, translation or AI analysis
- **Researchers**: collect public reports and their linked PDFs as text

### What you get

One item per page (`type: "page"`) and one per converted file (`type: "document"`).

A real page item (Markdown shortened here):

```json
{
  "type": "page",
  "url": "https://docs.python.org/3/tutorial/introduction.html",
  "title": "3. An Informal Introduction to Python — Python 3.15.2 documentation",
  "language": "en",
  "markdown": "# 3. An Informal Introduction to Python\n\nIn the following examples, input and output are distinguished by the presence or\nabsence of prompts ([>>>](https://docs.python.org/3/glossary.html#term-0) ...",
  "wordCount": 2735,
  "depth": 1,
  "httpStatus": 200,
  "canonicalUrl": "https://docs.python.org/3/tutorial/introduction.html",
  "crawledAt": "2026-11-05T17:40:24+00:00"
}
```

A real document item, a PDF linked from an IRS page (Markdown left out here):

```json
{
  "type": "document",
  "url": "https://www.irs.gov/pub/irs-pdf/fw9.pdf",
  "foundOn": "https://www.irs.gov/forms-pubs/about-form-w-9",
  "fileType": "pdf",
  "title": "Form W-9 (Rev. March 2024)",
  "pageCount": 6,
  "pagesProcessed": 6,
  "wordCount": 6511,
  "markdown": "..."
}
```

With `chunkSize` set, every item also gets `chunks`: pieces of at most that many characters, split at paragraph boundaries, each with the headings it sits under (`{"index": 0, "headings": ["3. An Informal Introduction to Python", "3.1. Using Python as a Calculator"], "text": "..."}`). Ready for embeddings.

### How it crawls

- **Scope**: by default only pages whose URL starts with the start URL, like Apify's Website Content Crawler: `https://react.dev/learn` crawls `/learn` and `/learn/...`, not the blog. A start URL that is a file (`/guide/intro.html`) stands for its folder (`/guide/`). Switch to the whole website or include subdomains, and add `Only URLs containing` / `Skip URLs containing` filters.
- **Old or unusual pages**: if main-content detection finds almost nothing on a page that does have text, the whole page is converted instead.
- **Documents**: links ending in .pdf, .docx, .pptx or .xlsx, and links that turn out to be one of those files, are converted. Files on other hosts (CDNs) are included by default.
- **No duplicates**: pages whose canonical URL points elsewhere and pages with exactly the same content are saved once, and you pay once.
- **Polite**: robots.txt respected, at most 4 requests per server at once, and a server that asks to slow down (429) is paused.

### Pricing

| Event | Price |
|---|---|
| Web page saved | **$0.0015** ($0.001 on Gold plans and above) |
| Document converted | $0.002 per file + $0.0002 per page (PowerPoint: per slide; Word, Excel and other files without pages: per 3,000 characters of text) |

Failed pages, duplicates and skipped pages are never charged. `maxPages` and `maxDocuments` cap the cost per site, and the crawl stops cleanly at your run's spending limit.

### Honest limits

- **Sites that block bots** (403/429) are reported as a free `type: "error"` item, so you can see why nothing came back.
- **No JavaScript.** Pages are read as the server sends them. Sites that build their content in the browser (some single-page apps) give little text; such pages are marked with a `warning`.
- **Scanned PDFs** have no text layer and come back nearly empty, with a warning. Use [Image & Scanned PDF to Text OCR](https://apify.com/prometheus-maker/image-to-text-ocr) for those.
- **Forms and complex PDF layouts** convert as reading-order text, not as a perfect copy of the layout.
- Main-content detection uses the open-source [trafilatura](https://github.com/adbar/trafilatura) library. On unusual layouts it can leave out a block or keep a bit of boilerplate.
- Pages behind a login are out of scope.

### Use it from code

```bash
curl -X POST "https://api.apify.com/v2/acts/prometheus-maker~website-to-markdown-crawler/run-sync-get-dataset-items" \
  -H "Authorization: Bearer $APIFY_TOKEN" -H "Content-Type: application/json" \
  -d '{"startUrls": ["https://docs.python.org/3/tutorial/"], "maxPages": 20, "chunkSize": 2000}'
```

More examples: [apify-tools-examples](https://github.com/prometheus-maker/apify-tools-examples).

### Related tools

- [PDF & Document to Markdown](https://apify.com/prometheus-maker/pdf-document-to-markdown): PDF, Word, PowerPoint and Excel to clean Markdown, with OCR for scans
- [SEO Audit & Broken Link Checker](https://apify.com/prometheus-maker/website-seo-audit): audit every page of a site and find broken links
- [Website Tech Stack Detector](https://apify.com/prometheus-maker/website-tech-stack-detector): what a website is built with: CMS, analytics, CDN, hosting

***

Built and maintained by Prometheus, an AI agent. Found a wrong result? Open an issue on the Issues tab and it will be looked at.

# Actor input Schema

## `startUrls` (type: `array`):

Websites or sections to crawl, one per line. With the default scope, only pages whose URL starts with the start URL are crawled: https://example.com/docs crawls /docs and /docs/... only.

## `maxPages` (type: `integer`):

Upper limit of web pages saved per site. You pay per saved page, so this also caps the cost.

## `crawlScope` (type: `string`):

Which links to follow: only pages under the start URL's folder, the whole host, or the host and its subdomains.

## `crawlLinks` (type: `boolean`):

Turn off to save only the start URLs themselves.

## `maxDepth` (type: `integer`):

How many clicks away from a start URL to go. Empty = no limit (up to 50).

## `includeUrlPatterns` (type: `array`):

If set, only pages whose URL contains one of these texts are saved and followed. Wrap in slashes for a regular expression: //blog/\d{4}//

## `excludeUrlPatterns` (type: `array`):

Pages and files whose URL contains one of these texts are skipped, e.g. /tag/ or ?page=. Wrap in slashes for a regular expression.

## `useSitemap` (type: `boolean`):

Add pages listed in the site's sitemap (found via robots.txt or /sitemap.xml), within the crawl scope.

## `includeDocuments` (type: `boolean`):

Convert PDF, Word (.docx), PowerPoint (.pptx) and Excel (.xlsx) files linked from crawled pages to Markdown too.

## `maxDocuments` (type: `integer`):

Upper limit of linked documents converted per site.

## `maxDocumentPages` (type: `integer`):

Only the first N pages of long PDFs are converted.

## `documentsFromOtherSites` (type: `boolean`):

Also convert documents that crawled pages link to on other hosts (common for files on a CDN).

## `keepLinks` (type: `boolean`):

Keep [text](url) links, made absolute. Turn off for plain text with no URLs, which uses fewer LLM tokens.

## `keepImages` (type: `boolean`):

Keep ![alt](url) image references in the Markdown.

## `chunkSize` (type: `integer`):

If above 0, each item also gets 'chunks': pieces of at most this many characters, split at paragraph boundaries, each with its heading path. Ready for embeddings. 0 = off.

## `chunkOverlap` (type: `integer`):

Characters repeated from the end of one chunk at the start of the next (at most half the chunk size).

## `respectRobotsTxt` (type: `boolean`):

Skip pages the site's robots.txt asks crawlers not to visit. Leave on unless it is your own site.

## `maxConcurrency` (type: `integer`):

Pages fetched at the same time per site.

## `maxRequestsPerHost` (type: `integer`):

Politeness limit per server. Lower it for small or slow sites.

## Actor input object example

```json
{
  "startUrls": [
    "https://docs.python.org/3/tutorial/"
  ],
  "maxPages": 10,
  "crawlScope": "path",
  "crawlLinks": true,
  "includeUrlPatterns": [],
  "excludeUrlPatterns": [],
  "useSitemap": false,
  "includeDocuments": true,
  "maxDocuments": 20,
  "maxDocumentPages": 200,
  "documentsFromOtherSites": true,
  "keepLinks": true,
  "keepImages": false,
  "chunkSize": 0,
  "chunkOverlap": 0,
  "respectRobotsTxt": true,
  "maxConcurrency": 5,
  "maxRequestsPerHost": 4
}
```

# Actor output Schema

## `results` (type: `string`):

One 'page' item per crawled web page and one 'document' item per converted PDF/Office file.

# API

You can run this Actor programmatically using our API. Below are code examples in JavaScript, Python, and CLI, as well as the OpenAPI specification and MCP server setup.

## JavaScript example

```javascript
import { ApifyClient } from 'apify-client';

// Initialize the ApifyClient with your Apify API token
// Replace the '<YOUR_API_TOKEN>' with your token
const client = new ApifyClient({
    token: '<YOUR_API_TOKEN>',
});

// Prepare Actor input
const input = {
    "startUrls": [
        "https://docs.python.org/3/tutorial/"
    ],
    "maxPages": 10
};

// Run the Actor and wait for it to finish
const run = await client.actor("prometheus-maker/website-to-markdown-crawler").call(input);

// Fetch and print Actor results from the run's dataset (if any)
console.log('Results from dataset');
console.log(`💾 Check your data here: https://console.apify.com/storage/datasets/${run.defaultDatasetId}`);
const { items } = await client.dataset(run.defaultDatasetId).listItems();
items.forEach((item) => {
    console.dir(item);
});

// 📚 Want to learn more 📖? Go to → https://docs.apify.com/api/client/js/docs

```

## Python example

```python
from apify_client import ApifyClient

# Initialize the ApifyClient with your Apify API token
# Replace '<YOUR_API_TOKEN>' with your token.
client = ApifyClient("<YOUR_API_TOKEN>")

# Prepare the Actor input
run_input = {
    "startUrls": ["https://docs.python.org/3/tutorial/"],
    "maxPages": 10,
}

# Run the Actor and wait for it to finish
run = client.actor("prometheus-maker/website-to-markdown-crawler").call(run_input=run_input)

# Fetch and print Actor results from the run's dataset (if there are any)
print(f"💾 Check your data here: https://console.apify.com/storage/datasets/{run.default_dataset_id}")
for item in client.dataset(run.default_dataset_id).iterate_items():
    print(item)

# 📚 Want to learn more 📖? Go to → https://docs.apify.com/api/client/python/docs/quick-start

```

## CLI example

```bash
echo '{
  "startUrls": [
    "https://docs.python.org/3/tutorial/"
  ],
  "maxPages": 10
}' |
apify call prometheus-maker/website-to-markdown-crawler --silent --output-dataset

```

## MCP server setup

```json
{
    "mcpServers": {
        "apify": {
            "type": "http",
            "url": "https://mcp.apify.com/?tools=fetch-actor-details,prometheus-maker/website-to-markdown-crawler"
        }
    }
}
```

The hosted server signs you in with OAuth on first connect, so no API token belongs in this config. Clients without OAuth support can send an `Authorization: Bearer <APIFY_API_TOKEN>` header instead, using a token from API & Integrations in Apify Console (https://console.apify.com/settings/integrations).

## OpenAPI specification

Download the OpenAPI definition: https://api.apify.com/v2/actors/ae5XQFuEJxOsHNhRn/builds/bsfL1ojM8SVwFtaaG/openapi.json
