# Web Page to Markdown: URL to LLM-Ready Text (`publicrecords/url-to-markdown`) Actor

Turn any web page URL into clean, LLM-ready Markdown with title, description, language and canonical URL. Plain HTTP, no browser, so it is fast and cheap for RAG and AI agents.

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

## Pricing

from $1.20 / 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

## Web Page to Markdown: URL to LLM-Ready Text

Give it web page URLs and get back clean Markdown for each page, ready for an LLM, a RAG index or an AI agent. Menus, headers, footers, scripts and cookie banners are dropped; headings, lists, links, images and tables are kept, with every link made absolute. Each row also carries the page title, description, language, canonical URL and published date when the page states them.

It fetches pages over plain HTTP with no browser, so it is fast and cheap. It is a single-page tool, not a site crawler: you choose the URLs.

**Who it's for:** developers building RAG and AI-agent pipelines, and anyone who needs readable text from a list of pages.

### Web page to Markdown: what each page gets

| Field | What it holds |
|---|---|
| `markdown` | Clean Markdown of the page's main content (or the whole page, or your CSS selector) |
| `title`, `description`, `language`, `canonicalUrl`, `publishedAt`, `siteName`, `imageUrl` | Page metadata, when the page has it |
| `chars`, `tokensEstimate`, `truncated` | Size of the Markdown and a rough LLM token count |
| `needsJavaScript` | True when the page looks built by JavaScript, so its static HTML may be incomplete |
| `links` | Every link on the page with its text and internal/external flag (turn on **Include page links**) |
| `url`, `finalUrl`, `statusCode`, `contentType`, `extractedFrom`, `fetchedAt` | What was fetched and from which part of the page |

Plain-text pages (such as `.txt` files) are returned as they are.

### Sample input

```json
{
  "urls": [
    "https://en.wikipedia.org/wiki/Web_scraping",
    "https://quotes.toscrape.com/"
  ]
}
```

### Sample output (from a real run, Markdown shortened)

```json
{
  "url": "https://quotes.toscrape.com/",
  "finalUrl": "https://quotes.toscrape.com/",
  "statusCode": 200,
  "contentType": "text/html",
  "title": "Quotes to Scrape",
  "description": null,
  "language": "en",
  "canonicalUrl": null,
  "publishedAt": null,
  "imageUrl": null,
  "siteName": null,
  "extractedFrom": "body",
  "markdown": "# [Quotes to Scrape](https://quotes.toscrape.com/)\n\n[Login](https://quotes.toscrape.com/login)\n\n“The world as we have created it is a process of our thinking. It cannot be changed without changing our thinking.” by Albert Einstein [(about)](https://quotes.toscrape.com/author/Albert-Einstein)\n\nTags: …",
  "chars": 4239,
  "tokensEstimate": 1060,
  "truncated": false,
  "needsJavaScript": false,
  "fetchedAt": "2026-11-25T21:38:26.395Z"
}
```

### Pricing

Pay per event: one start fee per run, then one charge per page converted and written to your dataset.

| Event | Price |
|---|---|
| Actor start (per GB of memory, minimum one; the default 512 MB run is one event) | $0.002 |
| Page converted | $0.0012 |

Example: 1,000 pages at the default memory = 1 start ($0.002) + 1,000 × $0.0012 ($1.20) = **$1.202**.

Not charged per page (the start fee still applies once per run): invalid or private URLs, pages that return an HTTP error, pages that are not HTML or text, pages with no text in their HTML, and hosts that cannot be reached. They are listed in the run's `OUTPUT` record with the reason.

### LLM-ready text options

- **Content to keep:** main content (default) or the full page.
- **CSS selector:** keep only part of a page, e.g. `article` or `#content`.
- **Max Markdown characters:** cut very long pages; the row then says `truncated: true`.
- **Include page links:** add the page's links to each row.

### Limits

- Up to 1,000 URLs per run. HTML per page: 3.5 MB at the default 512 MB, 5 MB at 1 GB or more. Each page has 5 to 30 seconds to answer (default 15).
- If 10 URLs cannot be reached (DNS, connection or timeout) before any page is converted, the remaining URLs are not tried and not charged; they are listed in `OUTPUT`.
- No JavaScript rendering. Pages built in the browser (single-page apps) may come back short; `needsJavaScript` flags them.
- No PDF, Word or image files. For PDF and DOCX links, use [PDF to Text & Markdown Extractor](https://apify.com/publicrecords/pdf-docx-to-markdown).
- Pages behind a login or bot wall are usually skipped with their HTTP status (401, 403, 429). A challenge page served with status 200 is converted like any page; check the Markdown if a site uses one.

### Errors and empty runs

A run never fails because of your input. If no URL is valid, or every host is unreachable, the run still ends as SUCCEEDED with 0 rows, and both the status message and the `OUTPUT` record say why.

### FAQ

**Does it crawl a whole site?** No. It converts the URLs you give it, one row per page.

**Why is a page short or empty?** The page may build its content with JavaScript; check `needsJavaScript`.

**Can an AI agent call it?** Yes, through the Apify API or MCP. Agents can pass a single `url` instead of `urls`.

**Do you keep the pages?** Only in your run's dataset, under your Apify data retention.

# Actor input Schema

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

Web pages to convert to Markdown, one per line (up to 1,000 per run). A URL without http(s):// gets https://.

## `contentScope` (type: `string`):

main: the page's main content (main/article), or the body without menus, headers and footers. full: the whole page body.

## `cssSelector` (type: `string`):

Keep only the elements matching this selector, e.g. article or #content. Overrides Content to keep.

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

Add the page's links (URL, text, internal or external) to each row.

## `maxChars` (type: `integer`):

Longer Markdown is cut and the row says truncated: true.

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

How long to wait for a page to answer before it is skipped (not charged). The download may take up to 1.5x this.

## Actor input object example

```json
{
  "urls": [
    "https://en.wikipedia.org/wiki/Web_scraping",
    "https://quotes.toscrape.com/"
  ],
  "contentScope": "main",
  "includeLinks": false,
  "maxChars": 200000,
  "timeoutSecs": 15
}
```

# Actor output Schema

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

No description

## `summary` (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/Web_scraping",
        "https://quotes.toscrape.com/"
    ]
};

// Run the Actor and wait for it to finish
const run = await client.actor("publicrecords/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/Web_scraping",
        "https://quotes.toscrape.com/",
    ] }

# Run the Actor and wait for it to finish
run = client.actor("publicrecords/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/Web_scraping",
    "https://quotes.toscrape.com/"
  ]
}' |
apify call publicrecords/url-to-markdown --silent --output-dataset

```

## MCP server setup

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