# URL to Markdown: bulk pages to Markdown chunks for LLMs (`examsens.ai/url-to-markdown`) Actor

Turns a list of web page URLs into clean Markdown of the main content, with page metadata, link and image options, and token counted chunks ready for embeddings and retrieval. Optional JavaScript rendering.

- **URL**: https://apify.com/examsens.ai/url-to-markdown.md
- **Developed by:** [Ed Rayyis](https://apify.com/examsens.ai) (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 $4.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: bulk pages to Markdown chunks for LLMs

Give it a list of web page URLs and it returns, for each page, clean Markdown of the main content, the page metadata, and the Markdown already split into chunks with a token count on every chunk. The output is ready to load into a vector store, a retrieval pipeline or a prompt.

### Chunking and page handling

- Many URLs in one run, fetched in parallel, five at a time by default.
- Each page is split at paragraph boundaries into chunks of the size you set, each with a token count from the `o200k_base` tokenizer. Each chunk carries the headings it sits under, so a chunk keeps its context when it is retrieved alone. Optional overlap repeats whole paragraphs from the end of one chunk at the start of the next.
- Links stay inline with absolute URLs, move to a numbered reference list at the end of the page, or drop to their text alone.
- Images stay with absolute URLs, give way to their alt text, or come out.
- A list of every link and image, when you want one, with the link text and alt text.
- Pages that build their content in the browser can be opened in headless Chromium first.

### Input

- Page URLs (required)
- Content to keep: main content (default) keeps the article or page body and drops menus, headers and footers; whole page keeps the full body and still drops scripts, styles, menus, header and footer elements
- Render JavaScript (default off)
- Links: inline (default), reference list at the end, or text only
- Images: keep (default), alt text only, or remove
- Include tables (default on), written as Markdown tables
- Chunk size in tokens (default 1,000; 0 turns chunking off) and chunk overlap in tokens (default 100)
- Include link and image lists (default off)
- Pages at once (default 5), page timeout (default 30 seconds), and an extra wait after load for rendered pages

### Output

Dataset: one item per URL.

- `url`, `finalUrl` after redirects, `statusCode`, `rendered`
- `title`, `description`, `author`, `date`, `siteName`, `language`, `canonicalUrl`, `image` when the page gives them
- `markdown`, with `characters`, `words` and `tokens`
- `chunks`: each with `index`, `tokens`, `headings` and `text`, plus `chunkCount`
- `linkCount` and `imageCount`, and the `links` and `images` lists when you ask for them
- `ok`, and `error` when a page could not be converted

A page that fails returns an item with `ok: false` and the reason, such as `HTTP 404`, a host that does not resolve, an address that is not http or https, or a file that is not an HTML page (an image, for example). The rest of the run carries on.

Export as JSON, CSV or Excel, or read it over the API.

### Pricing

Pay per event: one event per page converted. A page that fails is not charged. The run stops when it reaches the maximum charge you set.

### Scope and conduct

Each URL you list is fetched once. Links on the page are not followed. Use it on pages you are allowed to process. No login is used and no personal data is collected beyond what the pages you list contain.

### Support

Questions and problems: the Issues tab on this page.

# Actor input Schema

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

Web pages to convert, as many as you need.

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

Main content keeps the article or page body and drops menus, headers and footers. Whole page keeps the full body, still dropping scripts, styles, menus, header and footer elements.

## `renderJavaScript` (type: `boolean`):

Open each page in headless Chromium and convert the HTML after scripts have run. Turn on for pages that build their content in the browser. Slower and uses more memory than a plain HTTP fetch.

## `links` (type: `string`):

Inline keeps [text](url) with the URL made absolute. Reference numbers each link and lists the URLs at the end of the Markdown, which keeps the text shorter. Text only drops the URLs and keeps the link text.

## `images` (type: `string`):

Keep writes ![alt](url) with the URL made absolute. Alt text only writes \[Image: alt] and drops images with no alt text. Remove drops every image.

## `includeTables` (type: `boolean`):

Keep HTML tables as Markdown tables.

## `chunkTokens` (type: `integer`):

Split each page's Markdown into chunks of at most this many tokens (o200k_base tokenizer), breaking at paragraph boundaries. Each chunk carries its token count and the headings above it. Set 0 for no chunks.

## `chunkOverlapTokens` (type: `integer`):

Repeat up to this many tokens of whole paragraphs from the end of one chunk at the start of the next.

## `includeLinkList` (type: `boolean`):

Add a list of every unique link (URL and text) and image (URL and alt text) found in the converted content.

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

How many pages to fetch in parallel. With JavaScript rendering, at most 3.

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

Give up on a page after this many seconds.

## `waitAfterLoadMs` (type: `integer`):

With JavaScript rendering, wait this long after the page loads before reading it.

## Actor input object example

```json
{
  "urls": [
    {
      "url": "https://en.wikipedia.org/wiki/Markdown"
    },
    {
      "url": "https://docs.apify.com/platform/actors"
    }
  ],
  "contentScope": "main",
  "renderJavaScript": false,
  "links": "inline",
  "images": "keep",
  "includeTables": true,
  "chunkTokens": 1000,
  "chunkOverlapTokens": 100,
  "includeLinkList": false,
  "maxConcurrency": 5,
  "timeoutSecs": 30,
  "waitAfterLoadMs": 0
}
```

# Actor output Schema

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

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

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

```

## MCP server setup

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