# Website to Markdown API (`api_harbor/website-to-markdown`) Actor

Website to Markdown API: convert any web page to clean Markdown for LLMs, RAG and AI agents, with JavaScript rendering. $0.80 per 1,000 pages, pay-per-page, failed items never charged. Callable from any MCP client (Claude, Cursor, ChatGPT).

- **URL**: https://apify.com/api_harbor/website-to-markdown.md
- **Developed by:** [Api Harbor](https://apify.com/api_harbor) (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 $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

## Website to Markdown API

Convert any web page to clean Markdown for LLMs, RAG pipelines and AI agents. Give it URLs, get the title, meta description, language and main content as Markdown, with navigation and clutter left out. JavaScript pages are rendered in a real browser when needed. Use it as a URL-to-Markdown API at $0.80 per 1,000 pages.

**Price promise:** $0.80 per 1,000 pages, pay-per-page. Rows that fail come back with an `error` field and are never charged. No proxy fees, no extra compute to budget: the price per page is all you pay (plus $0.00005 per run start).

### What does Website to Markdown do?

For each URL, it fetches the page and returns:

- `markdown`: the page content as clean Markdown (headings, lists, links, tables)
- `title`, `description` and `language`
- `empty: true` when the page has no readable content

If the plain HTML is empty (single-page apps), the page is rendered in Chromium before conversion.

### Why use this URL to Markdown converter?

- **Cheap.** $0.80 per 1,000 pages. Comparable Store tools cost about $1.50 per 1,000 (Web Fetch) to $2.28 per 1,000 (RAG Web Browser).
- **LLM-ready.** Markdown is compact, readable and token-efficient compared to raw HTML.
- **Robust.** Direct fetch first, residential proxy fallback when a site blocks.
- **Failures are free.** A page that cannot be read returns a row with an `error` field and is never billed.

### Use cases

- **RAG and vector databases:** feed documentation, blogs or help centers into embeddings.
- **AI agents:** give your agent a cheap "read this URL" tool.
- **Content monitoring:** store a Markdown snapshot of pages and diff them over time.
- **Dataset building:** collect clean text for training or evaluation.
- **Research and sales copilots:** let an assistant read a company's pricing or about page and summarize it.

### How much does it cost to convert web pages to Markdown?

| What | Price |
|---|---|
| Run start | $0.00005 per run |
| Page converted | $0.80 per 1,000 pages (with `targets`: one page per distinct target page found, the home page itself not billed) |

| You get | You pay |
|---|---|
| 1,000 pages | $0.80 |
| 10,000 pages | $8 |
| 100,000 pages | $80 |

### How to convert a website to Markdown

1. Click **Try for free**.
2. Paste the **URLs** of the pages, one per line.
3. Click **Start**, then download your data as JSON, CSV or Excel, or read it from the API.

Each URL is converted on its own: the Actor does not follow links. List every page you need, or use `targets` to let it find a site's pages for you (see below).

### Input

| Field | Description |
|---|---|
| `urls` | Page URLs (bare domains are read as their home page) |
| `targets` | Optional. Pages to find on each site, up to 10: `{ "name", "pattern" }` (see below) |

```json
{
  "urls": ["https://apify.com", "https://docs.apify.com/platform/actors"]
}
```

#### Find specific pages on a site (`targets`)

Don't know the URL of a company's references, team or pricing page? Give each page a `name` and a `pattern`. The Actor reads the home page, collects the links it finds there and the URLs of `/sitemap.xml` (same site only), and picks for each target the page whose path or link text matches the pattern. When several pages match, the shortest path wins.

- `name`: lowercase letters, digits and `_`, starting with a letter, up to 40 characters, unique.
- `pattern`: a regular expression (RE2 syntax), case-insensitive, up to 200 characters. Accents are ignored: `references` matches `/références` and the link text "Nos références".
- At most 10 pages are read per site. Several targets can point to the same page.

```json
{
  "urls": ["agence-x.fr"],
  "targets": [
    { "name": "references", "pattern": "referen|realisation|portfolio" },
    { "name": "team", "pattern": "equipe|team|qui-sommes-nous" }
  ]
}
```

With `targets`, the home page is only read to find links: it is neither returned nor billed unless a target matches it. You pay one page per distinct target page found and converted. A target with no matching page (`found: false`) is free, and a site where no target is found costs nothing.

### What you get back

One row per page. Fields:

| Field | Type | Description |
|---|---|---|
| `input` | string | URL as you gave it |
| `url` | string | Page read |
| `domain` | string | Domain, without `www.` |
| `title` | string | Page title |
| `description` | string | Meta description |
| `language` | string | Page language, e.g. `fr-FR` |
| `markdown` | string | Main content as clean Markdown (headings, lists, links, tables) |
| `empty` | boolean | `true` when the page has no readable content |
| `targets` | array | With `targets` in the input only (the row then has no page-level `title`, `description`, `language`, `markdown` or `empty`), in the same order: `name`, `found` (boolean), and for found pages `url`, `title` and `markdown` (up to 20,000 characters) |
| `error` | string | Error message, on failed rows only (never billed) |

### Output example

Trimmed item from a real run:

```json
{
  "url": "https://www.blogdumoderateur.com/",
  "domain": "blogdumoderateur.com",
  "title": "BDM",
  "description": "Le média des pros du digital : marketing, social media, IA, SEO, product, design, tech... Suivez l'actualité du numérique, comparez les outils, découvrez les événements.",
  "language": "fr-FR",
  "markdown": "# Le média des pros du digital\n\n## Les derniers articles\n\n \n\nAdobe12 novembreRéservé aux membres  \n\nRéglementation12 novembre  \n\nRéglementation12 novembreRéservé aux membres \n\n \n\nEnfin une newsletter efficace !\n\nGagnez du temps, abonnez-vous :S'inscrire à la newsletter\n\nChaque matin, l'essentiel de l'actu, par emailActiver la quotidienne\n\n \n\n \n\nAnthropic12 novembre  \n\nProductivité12 novembre  \n\nOpenAI10 novembre  \n\nS …",
  "empty": false
}
```

Fields: `url`, `domain`, `title`, `description`, `language`, `markdown`, `empty`, `targets` when you ask for target pages, and `error` on failed items.

### Use it from AI agents (MCP)

This Actor is callable from any MCP client (Claude, Cursor, ChatGPT, VS Code) through the Apify MCP server. Your agent gets it as a tool and calls it on demand.

- **MCP server URL:** `https://mcp.apify.com/?actors=api_harbor/website-to-markdown`
- **Token:** your Apify API token, from Apify Console > Settings > Integrations.

**Claude Desktop** (`claude_desktop_config.json`):

```json
{
  "mcpServers": {
    "apify": {
      "url": "https://mcp.apify.com/?actors=api_harbor/website-to-markdown",
      "headers": {
        "Authorization": "Bearer <APIFY_TOKEN>"
      }
    }
  }
}
```

**Claude Code:**

```bash
claude mcp add --transport http apify "https://mcp.apify.com/?actors=api_harbor/website-to-markdown" --header "Authorization: Bearer <APIFY_TOKEN>"
```

**Cursor** (`.cursor/mcp.json`) or **VS Code** (`.vscode/mcp.json`, use `"servers"` instead of `"mcpServers"`):

```json
{
  "mcpServers": {
    "apify": {
      "url": "https://mcp.apify.com/?actors=api_harbor/website-to-markdown",
      "headers": {
        "Authorization": "Bearer <APIFY_TOKEN>"
      }
    }
  }
}
```

Example prompts:

- "Read https://docs.apify.com/platform/actors and summarize it in 5 bullets."
- "Convert these 30 help-center URLs to Markdown so I can add them to my knowledge base."
- "Fetch the pricing page of example.com and extract the plans into a table."

### Caching and errors

- **Caching:** identical requests made shortly after each other can be served from cache, so results come back faster.
- **Structured errors:** a page that cannot be processed still returns a row, with the input and an `error` field explaining why. These rows are never charged, so a batch never fails silently and you never pay for a miss.

### FAQ

**Does it crawl the whole website?**
No. It converts exactly the URLs you give it. Combine it with a sitemap or link list to process a full site.

**Does it handle JavaScript pages?**
Yes. When the HTML has no content, the page is rendered in a headless browser first.

**Is it legal to scrape web pages?**
Reading public pages is generally allowed, but the content may be copyrighted. You are responsible for how you use it.

**Can I call it from Python or an API?**
Yes, with the Apify API or the `apify-client` package for Python or JavaScript.

**Can I use it with LangChain, Make, Zapier or n8n?**
Yes, through Apify's integrations or a webhook at the end of each run.

**Can I use it from Claude, Cursor or ChatGPT (MCP)?**
Yes. Add `https://mcp.apify.com/?actors=api_harbor/website-to-markdown` as an MCP server with your Apify token, see [Use it from AI agents (MCP)](#use-it-from-ai-agents-mcp). Your agent then calls it as a tool and is billed per page like any other run.

### Related Actors

- [Website Contact Scraper](https://apify.com/api_harbor/website-contact-scraper): emails, phones and social profiles from any website
- [Website Technology Detector](https://apify.com/api_harbor/website-tech-detector): the tech stack of any website
- [YouTube Transcript Scraper](https://apify.com/api_harbor/youtube-transcript-scraper): video transcripts for your LLM pipeline

# Actor input Schema

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

Website URLs or bare domains, e.g. https://example.com or example.com.

## `targets` (type: `array`):

Optional. Pages to find on each site (up to 10). Each target has a name (lowercase letters, digits, \_) and a pattern (RE2 regular expression, case-insensitive, accents ignored) tested on the page path and on the link text. Candidates: links of the home page and URLs of /sitemap.xml, same site only; the shortest matching path wins. The home page is only read to find links and is not billed. Each distinct page found is billed as one page; not found is free. Example: \[{"name": "references", "pattern": "referen|realisation|portfolio"}]

## Actor input object example

```json
{
  "urls": [
    "https://apify.com"
  ],
  "targets": [
    {
      "name": "references",
      "pattern": "referen|realisation|portfolio"
    },
    {
      "name": "team",
      "pattern": "equipe|team"
    }
  ]
}
```

# 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": [
        "https://apify.com"
    ]
};

// Run the Actor and wait for it to finish
const run = await client.actor("api_harbor/website-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://apify.com"] }

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

```

## MCP server setup

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