# URL to Markdown - Clean Web Page Text for LLMs (`scrapewise/url-to-markdown`) Actor

Turn any web page into clean Markdown and plain text for LLMs, RAG and summaries. Finds the real article, drops menus, cookie banners and scripts, keeps headings, lists, links, images, quotes and code, and returns title, author, date and language. No browser. Failed pages are free.

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

## Pricing

$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

## URL to Markdown: clean web page text for LLMs

Give it a list of page URLs and get back **clean Markdown and plain text**, ready to paste into
a prompt, index in a RAG pipeline or store as a document. No browser, no API key, no HTML
cleanup on your side.

### What comes out

| Field | What it holds |
|---|---|
| `markdown` | headings, lists, links, images, quotes and code blocks, with every link absolute |
| `text` | the same content as plain text, for embeddings and search |
| `wordCount`, `charCount`, `headingCount`, `linkCount`, `imageCount` | size and shape of what was found |
| `title`, `description`, `author`, `publishedAt`, `language`, `siteName`, `imageUrl`, `canonicalUrl` | the metadata a document pipeline usually wants |
| `finalUrl`, `statusCode`, `htmlBytes`, `renderedByJavaScript` | what actually happened when fetching |

### Why it is not just "strip the tags"

- **It finds the article.** `<article>`, `<main>`, `[role=main]`, or the densest block of
  paragraphs, and drops navigation, footer, sidebar, cookie banner, script and style.
- **It survives minified HTML.** Attributes without quotes (`href=/docs class=x`) are common in
  production builds and break naive parsers; here they are handled.
- **It tells you when a page is JavaScript-only.** `renderedByJavaScript` is true when the HTML
  is big but the text is tiny, so you know the page needs a browser instead of getting a stub
  and not noticing.
- **You can set a floor.** `minWords` turns anything thinner into a free error row, so a broken
  page never enters your dataset as if it were content.

### Errors, all free

| errorCode | Meaning |
|---|---|
| `NOT_FOUND` | 404 or 410 |
| `BLOCKED` | 401 or 403: the site refused. Turn the proxy on and try again. |
| `FETCH_FAILED` | DNS, timeout or a server error that did not clear on retry |
| `TOO_LITTLE_TEXT` | The page came back with less text than your `minWords` |
| `ITEM_UNREADABLE` | The page came in a shape this Actor cannot read |
| `UNEXPECTED` | Something unforeseen broke on that page; the rest of the run still delivers |

### Pricing

**US$ 2.00 per 1,000 pages**, pay per event: no monthly fee, no charge per run, error rows free.
A thousand pages for a RAG index cost US$ 2.00.

### FAQ

**How is this different from stripping the tags myself?** The Actor picks the content block
(`<article>`, `<main>`, `[role=main]` or the densest block of paragraphs) and drops navigation,
footer, sidebar, cookie banner and script, so what you get is the article and not the whole page.

**What if the page only renders with JavaScript?** You still get whatever is in the HTML, and
`renderedByJavaScript` is set to true so you can route those URLs to a browser-based Actor
instead of silently indexing a stub.

**Can I refuse thin pages?** Yes. Set `minWords` and anything below it comes back as a free
`TOO_LITTLE_TEXT` row instead of entering your dataset as content.

**Are the links usable?** Yes, every link and image is made absolute against the final URL,
after redirects.

**Do failed pages cost anything?** No. 404, 403, timeouts and thin pages are all free rows.

### Notes

- Proxy is off by default and the platform cost is a fraction of the price. Turn it on for sites
  that block datacenter IPs.
- This Actor does not run JavaScript. For pages that only render in a browser, `markdown` will be
  short and `renderedByJavaScript` will be true.

# Actor input Schema

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

One per line. Any article, documentation page, blog post or news page. Addresses without https:// are accepted.

## `minWords` (type: `integer`):

Pages with less text than this come back as a free error row instead of being charged. Useful when feeding a pipeline that cannot use stubs. 0 accepts everything.

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

Off by default. Turn it on for sites that block datacenter traffic or rate-limit by IP.

## Actor input object example

```json
{
  "urls": [
    "https://en.wikipedia.org/wiki/Markdown"
  ],
  "minWords": 0,
  "proxyConfiguration": {
    "useApifyProxy": false
  }
}
```

# Actor output Schema

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

No description

## `resultsCsv` (type: `string`):

No description

# 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"
    ]
};

// Run the Actor and wait for it to finish
const run = await client.actor("scrapewise/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": ["https://en.wikipedia.org/wiki/Markdown"] }

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

```

## MCP server setup

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