# URL to Markdown - Clean Page Text for AI, RAG & LLMs (`ennobling_spray/url-to-markdown`) Actor

Turn any list of web pages into clean Markdown, plain text and metadata for AI agents, RAG pipelines and LLM prompts. Main-content extraction removes menus and ads. Obeys robots.txt. Pay only per page converted.

- **URL**: https://apify.com/ennobling_spray/url-to-markdown.md
- **Developed by:** [Conor Wilson](https://apify.com/ennobling_spray) (community)
- **Categories:** AI, Developer tools, Agents
- **Stats:** 2 total users, 1 monthly users, 100.0% runs succeeded, 0 bookmarks
- **User rating**: No ratings yet

## Pricing

$0.80 / 1,000 pages

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

## URL to Markdown

Turn any list of web pages into **clean Markdown** (plus optional plain text) with title, description, author, language and word count. Built for AI agents, RAG pipelines, LLM prompts and knowledge bases.

**$0.80 per 1,000 pages.** Pages that fail, are blocked or are disallowed by robots.txt are returned with the reason and **never charged**.

### Why this one

- **Main-content extraction.** A readability algorithm removes menus, cookie bars, footers and sidebars, so you pay for fewer LLM tokens. Switch it off to convert the whole page.
- **Clean, consistent Markdown.** ATX headings, fenced code blocks, absolute links, optional images, collapsed whitespace.
- **Cheap and fast.** Plain HTTP fetching with no browser, so runs finish in seconds.
- **Token control.** `maxCharacters` truncates long pages and flags them with `truncated: true`.
- **Respectful by design.** Obeys robots.txt, identifies itself honestly, and never bypasses logins, paywalls or bot protection.

### Quick start

```json
{
    "urls": [{ "url": "https://en.wikipedia.org/wiki/Markdown" }, { "url": "https://docs.apify.com/platform/actors" }],
    "mainContentOnly": true,
    "includeLinks": true,
    "maxCharacters": 20000
}
```

Call it from code (one row per page comes back):

```bash
curl -X POST "https://api.apify.com/v2/acts/ennobling_spray~url-to-markdown/run-sync-get-dataset-items?token=<YOUR_TOKEN>" \
  -H "Content-Type: application/json" \
  -d '{"urls":[{"url":"https://en.wikipedia.org/wiki/Markdown"}]}'
```

### Output

| Field | Description |
| --- | --- |
| `markdown` | Page content as Markdown |
| `text` | Plain text, if `includeText` is on |
| `title`, `description`, `author`, `siteName`, `language`, `publishedTime` | Page metadata when available |
| `wordCount`, `truncated` | Size of the extracted content |
| `url`, `finalUrl`, `statusCode`, `fetchedAt` | Request details |
| `ok`, `error` | Whether conversion succeeded, and why not |

### Input options

| Option | Default | Notes |
| --- | --- | --- |
| `urls` | required | Pages to convert |
| `mainContentOnly` | `true` | Readability extraction; off converts the whole `<body>` |
| `includeLinks` | `true` | Keep hyperlinks (absolute URLs) |
| `includeImages` | `false` | Keep image references |
| `includeText` | `false` | Also return plain text |
| `maxCharacters` | `0` | Truncate Markdown above this length (0 = no limit) |
| `maxConcurrency` | `8` | Parallel requests; a per-site pace of about 4 requests per second always applies |

### Limits and good use

- JavaScript-only pages (content rendered entirely in the browser) may come back short. Most news, docs, blogs and reference sites work well.
- PDFs are not converted here. Use **PDF to Text** from the same author.
- The actor fetches only what robots.txt allows for its user agent `WilsDataTools`. Disallowed or bot-protected pages are reported, not bypassed.
- You are responsible for having the right to use the content you convert, for example under the site's terms or a licence.

### Pricing

Pay per event: one event per page successfully converted. Set a maximum cost per run to cap spend.

# Actor input Schema

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

Pages to convert. Each successfully converted page is one billable event.

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

Strip navigation, footers, sidebars and ads using a readability algorithm. Turn off to convert the whole <body>.

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

Keep hyperlinks in the Markdown. Turn off for plain prose (fewer tokens).

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

Keep image references in the Markdown.

## `includeText` (type: `boolean`):

Add a plain-text version alongside the Markdown.

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

Truncate Markdown longer than this (0 = no limit). Useful to cap LLM token usage.

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

How many pages to fetch at once (per-site pacing still applies).

## Actor input object example

```json
{
  "urls": [
    {
      "url": "https://docs.apify.com/platform/actors"
    },
    {
      "url": "https://en.wikipedia.org/wiki/Markdown"
    }
  ],
  "mainContentOnly": true,
  "includeLinks": true,
  "includeImages": false,
  "includeText": false,
  "maxCharacters": 0,
  "maxConcurrency": 8
}
```

# Actor output Schema

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

Turn any list of web pages into clean Markdown, plain text and metadata for AI agents, RAG pipelines and LLM prompts.

# 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": [
        {
            "url": "https://docs.apify.com/platform/actors"
        },
        {
            "url": "https://en.wikipedia.org/wiki/Markdown"
        }
    ]
};

// Run the Actor and wait for it to finish
const run = await client.actor("ennobling_spray/url-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": [
        { "url": "https://docs.apify.com/platform/actors" },
        { "url": "https://en.wikipedia.org/wiki/Markdown" },
    ] }

# Run the Actor and wait for it to finish
run = client.actor("ennobling_spray/url-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": [
    {
      "url": "https://docs.apify.com/platform/actors"
    },
    {
      "url": "https://en.wikipedia.org/wiki/Markdown"
    }
  ]
}' |
apify call ennobling_spray/url-to-markdown --silent --output-dataset

```

## MCP server setup

```json
{
    "mcpServers": {
        "apify": {
            "type": "http",
            "url": "https://mcp.apify.com/?tools=fetch-actor-details,ennobling_spray/url-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/toYp33w8MRwDmCVdG/builds/uCDC3DbFoRh2mBHsa/openapi.json
