# Website to Markdown for AI & RAG (`ransigroup_tools/website-to-markdown-for-ai`) Actor

Crawl any website into clean, LLM-ready Markdown: main content only, tables kept, optional chunks with token counts. Flat $1 per 1,000 pages, with no compute charges. Pages without readable text and failed pages are never charged.

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

## Pricing

$1.00 / 1,000 page delivereds

This Actor is paid per event. You are not charged for the Apify platform usage, but only a fixed price for specific events.

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 for AI & RAG

**A flat $1 per 1,000 pages, with no compute or memory charges on top. Pages with no readable text, duplicate pages and failed pages are never charged.**

Point it at any website and get clean, **LLM-ready Markdown** for each page. Navigation, footers, sidebars, cookie banners and scripts are removed. Headings, lists, code blocks, links and **tables** are kept. You can also split every page into **chunks with token estimates**, ready for a vector database.

### Why this crawler

- **A predictable price.** You pay $0.001 per delivered page, and you know the cost before you run.
- **A spending cap.** Set *Spending cap (USD)* and the crawl stops before it charges more.
- **Main content only.** It uses Mozilla Readability, the engine behind Firefox Reader View, so your AI gets the article, not the menu.
- **Tables survive.** HTML tables become Markdown tables.
- **RAG chunks built in.** Chunks start at headings where possible, and each one carries a token estimate.
- **No duplicates.** Pages with identical content are delivered and charged once, and tracking parameters (`utm_`, `gclid`…) are removed from links.
- **Polite by default.** It respects robots.txt and stays on the websites you list.
- **Plain-English errors.** When a page can't be read, you see why. For example: "the page doesn't exist", "it isn't a web page (it's a PDF)", or "the site's robots.txt asks crawlers not to visit it".

### Output (one item per page)

```json
{
  "url": "https://docs.apify.com/storage",
  "title": "Storage | Platform | Apify Documentation",
  "description": "Store anything from images and key-value pairs to structured output data.",
  "language": "en",
  "markdown": "# Storage\n\nThe Apify platform provides three types of storage...",
  "wordCount": 1213,
  "tokenEstimate": 2627,
  "chunks": [{ "index": 0, "text": "# Storage\n\n...", "tokenEstimate": 498 }],
  "depth": 1,
  "crawledAt": "2026-11-23T08:00:00.000Z"
}
```

`chunks` is included only when *Chunk size (tokens)* is above 0. `tokenEstimate` assumes ~4 characters per token, a standard estimate for English.

### Use cases

- Build a **RAG chatbot** on your docs, help center or website.
- Give **AI agents** clean context from web pages (it works with the Apify MCP server).
- **Fine-tuning and evaluation datasets** made from public content.
- **Content audits:** word counts per page, and a quick view of a site's content.
- **n8n, Make and Zapier** workflows: crawl a site and send each page to OpenAI, Pinecone, Qdrant or Google Sheets.

### Input tips

| Goal | Settings |
|---|---|
| A single page | `maxDepth: 0` |
| Just the docs section | Start at `/docs/` and turn on *Stay under the start URL's path* |
| Several sites, fair coverage | Set *Max pages per website* |
| Skip tag and pagination pages | *Skip URLs containing*: `/tag/`, `?page=` |
| Keep the full page, including menus | Turn off *Main content only* |

### Pricing

| Event | Price |
|---|---|
| Page delivered with readable text | $0.001 ($1 per 1,000 pages) |

Not charged:

- pages with less than 20 words of readable text
- duplicate pages
- non-HTML files (PDF, images…)
- pages that fail to load
- pages blocked by robots.txt

### Limitations

- **JavaScript-only sites.** This crawler reads the HTML the server sends, which is fast and cheap. Sites that build their content only with JavaScript in the browser may return little text, and those pages are not charged.
- **Logins.** It doesn't sign in to websites, so only public pages are crawled.
- **Your responsibility.** You're responsible for having the right to crawl and use the content of the sites you choose.

### Support

Open an issue on the **Issues** tab. Feature requests are welcome.

# Actor input Schema

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

Pages to start from. The crawler follows links from them. Any format works: "docs.apify.com" or a full URL.

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

Stop after delivering this many pages.

## `maxPagesPerSite` (type: `integer`):

Optional. When crawling several websites, stop each one after this many pages so every site gets covered. 0 = no per-site limit.

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

How many clicks away from the start URLs to go. 0 = only the start URLs.

## `stayInStartPath` (type: `boolean`):

Example: starting at /docs/ only crawls pages under /docs/.

## `urlIncludes` (type: `array`):

Optional. Only follow links whose URL contains one of these texts, e.g. "/blog/".

## `urlExcludes` (type: `array`):

Optional. Never follow links whose URL contains one of these texts, e.g. "/tag/" or "?page=".

## `mainContentOnly` (type: `boolean`):

Remove menus, headers, footers, sidebars and cookie banners (uses Mozilla Readability). Turn off to keep the whole page.

## `chunkSizeTokens` (type: `integer`):

Optional. Also split each page into chunks of about this many tokens for vector databases. Chunks start at headings where possible. 0 = no chunks.

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

Skip pages the site asks crawlers not to visit.

## `maxCostUsd` (type: `number`):

The crawl stops before it would charge you more than this.

## `proxyConfiguration` (type: `object`):

Off by default. Turn on only if a site blocks the crawler.

## Actor input object example

```json
{
  "startUrls": [
    "https://docs.apify.com/academy/web-scraping-for-beginners"
  ],
  "maxPages": 10,
  "maxPagesPerSite": 0,
  "maxDepth": 3,
  "stayInStartPath": false,
  "mainContentOnly": true,
  "chunkSizeTokens": 0,
  "respectRobotsTxt": true,
  "maxCostUsd": 5,
  "proxyConfiguration": {
    "useApifyProxy": false
  }
}
```

# Actor output Schema

## `pages` (type: `string`):

URL, title, word count, token estimate and Markdown for each page.

## `allFields` (type: `string`):

Every field including description, language, depth, crawl time and RAG chunks.

## `summary` (type: `string`):

Pages delivered, skipped (no text, duplicates, non-HTML), failed, and the amount charged.

# 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.apify.com/academy/web-scraping-for-beginners"
    ],
    "maxPages": 10
};

// Run the Actor and wait for it to finish
const run = await client.actor("ransigroup_tools/website-to-markdown-for-ai").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.apify.com/academy/web-scraping-for-beginners"],
    "maxPages": 10,
}

# Run the Actor and wait for it to finish
run = client.actor("ransigroup_tools/website-to-markdown-for-ai").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.apify.com/academy/web-scraping-for-beginners"
  ],
  "maxPages": 10
}' |
apify call ransigroup_tools/website-to-markdown-for-ai --silent --output-dataset

```

## MCP server setup

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

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/5cS4ezgVjRXrnAPOv/builds/sJcAQ9gdFHkDgnE6n/openapi.json
