# Webpage to Markdown for LLM & RAG (`klyve1/webpage-to-markdown`) Actor

Turn any list of web pages into clean Markdown and plain text: main content only (no menus, ads or footers), with title, author, date, word count and links. Ready for LLMs, RAG pipelines and AI agents.

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

## Pricing

from $2.00 / 1,000 page converteds

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

## Webpage to Markdown for LLM & RAG

Turn any list of web pages into **clean Markdown and plain text**, ready to feed an LLM, a RAG pipeline, a vector database or an AI agent. Menus, cookie banners, ads, sidebars and footers are removed with Mozilla Readability (the engine behind Firefox Reader View), then the main content is converted to GitHub-flavoured Markdown with headings, lists, tables, code blocks and links kept.

No browser, no proxy, no login: it is fast and cheap, and it respects robots.txt.

### Who uses it

- **AI and RAG builders**: ingest documentation, blog posts or help centres into a vector store with clean chunks.
- **Agents and chatbots**: give your LLM the readable content of a URL without HTML noise (fewer tokens, better answers).
- **Content and SEO teams**: archive articles, compare competitors' pages, count words.
- **Researchers**: build text corpora from lists of URLs.

### Example output

```json
{
  "url": "https://blog.apify.com/what-is-web-scraping/",
  "finalUrl": "https://blog.apify.com/what-is-web-scraping/",
  "statusCode": 200,
  "title": "What is web scraping?",
  "author": "David Barton",
  "extraction": "main-content",
  "wordCount": 1358,
  "markdown": "# What is web scraping?\n\nWeb scraping is the process of automatically extracting data from a website. You use a program called a web scraper to access a web page, interpret the data, and extract what you need. [...] see [web crawling vs. web scraping](https://blog.apify.com/web-crawling-vs-web-scraping). ...",
  "text": "Web scraping is the process of automatically extracting data from a website. ...",
  "links": ["https://blog.apify.com/web-crawling-vs-web-scraping", "..."],
  "error": null
}
```

Each row also has `description`, `siteName`, `publishedTime`, `language`, `characterCount`, `truncated` and `crawledAt`.

### Input

| Field | What it does | Default |
|---|---|---|
| `urls` | Pages to convert, one per line | required |
| `mainContentOnly` | Keep only the article or main content. Off converts the whole body | true |
| `includeLinks` | Keep `[text](url)` links and return the list of links | true |
| `includeImages` | Keep `![alt](url)` images | false |
| `maxCharacters` | Cut each page after N characters to fit a context window (0 = no limit) | 0 |
| `respectRobotsTxt` | Skip pages disallowed by robots.txt | true |
| `concurrency` | Pages fetched in parallel | 5 |
| `timeoutSecs` | Timeout per page | 30 |

### Pricing

Pay per result: **$0.002 per page converted**. Failed pages, timeouts, non-HTML files and pages blocked by robots.txt are free.

### Good to know

- Works on server-rendered pages (most blogs, docs, news, wikis, e-commerce content). Pages that need JavaScript to show their text return an error and are not charged.
- All links and images are made absolute, so the Markdown works outside the original site.
- Only use it on pages you are allowed to process. The Actor identifies itself with a clear user agent and follows robots.txt.
- Call it from the API, a schedule, Make, Zapier, n8n or as a tool of your AI agent through the Apify MCP server.

# Actor input Schema

## `urls` (type: `array`):

Web pages to convert, one per line. Missing https:// is added automatically.

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

Keep only the article or main content (Mozilla Readability, the engine of Firefox Reader View). Turn off to convert the whole page body.

## `includeLinks` (type: `boolean`):

Keep hyperlinks in the Markdown as [text](url) and add the list of absolute links found on the page. Off gives plain text links.

## `includeImages` (type: `boolean`):

Keep images in the Markdown as ![alt](url).

## `maxCharacters` (type: `integer`):

Cut Markdown and text after this many characters, useful to fit an LLM context window. 0 means no limit.

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

Skip pages that the site's robots.txt disallows for all bots. Skipped pages are free.

## `concurrency` (type: `integer`):

How many pages are fetched at the same time.

## `timeoutSecs` (type: `integer`):

A page that takes longer is reported as a timeout (free).

## Actor input object example

```json
{
  "urls": [
    "https://en.wikipedia.org/wiki/Markdown",
    "https://developer.mozilla.org/en-US/docs/Web/HTTP/Overview",
    "https://blog.apify.com/what-is-web-scraping/"
  ],
  "mainContentOnly": true,
  "includeLinks": true,
  "includeImages": false,
  "maxCharacters": 0,
  "respectRobotsTxt": true,
  "concurrency": 5,
  "timeoutSecs": 30
}
```

# Actor output Schema

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

All rows produced by the run.

# 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 = {
    "urls": [
        "https://en.wikipedia.org/wiki/Markdown",
        "https://developer.mozilla.org/en-US/docs/Web/HTTP/Overview",
        "https://blog.apify.com/what-is-web-scraping/"
    ]
};

// Run the Actor and wait for it to finish
const run = await client.actor("klyve1/webpage-to-markdown").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 = { "urls": [
        "https://en.wikipedia.org/wiki/Markdown",
        "https://developer.mozilla.org/en-US/docs/Web/HTTP/Overview",
        "https://blog.apify.com/what-is-web-scraping/",
    ] }

# Run the Actor and wait for it to finish
run = client.actor("klyve1/webpage-to-markdown").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 '{
  "urls": [
    "https://en.wikipedia.org/wiki/Markdown",
    "https://developer.mozilla.org/en-US/docs/Web/HTTP/Overview",
    "https://blog.apify.com/what-is-web-scraping/"
  ]
}' |
apify call klyve1/webpage-to-markdown --silent --output-dataset

```

## MCP server setup

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

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/vTxLGCGkXk9YDshCi/builds/FFjKUzqlyPiqVvrA1/openapi.json
