# URL to Markdown Converter (`quaky_knickknack/url-to-markdown-converter`) Actor

Convert any public URL to clean markdown optimized for LLM/RAG pipelines. Batch processing (100 URLs), metadata extraction, SSRF protection, robots.txt respect. Integrates with LangChain, LlamaIndex, n8n, Make.

- **URL**: https://apify.com/quaky_knickknack/url-to-markdown-converter.md
- **Developed by:** [Troy Johnson](https://apify.com/quaky_knickknack) (community)
- **Features:** Limited permissions
- **Stats:** 1 total users, 0 monthly users, 0.0% runs succeeded, 0 bookmarks
- **User rating**: No ratings yet

## Pricing

Pay per usage

This Actor is paid per platform usage. The Actor is free to use, and you only pay for the Apify platform usage, which gets cheaper the higher subscription plan you have.

Learn more: https://docs.apify.com/actors/running/actors-in-store.md#pay-per-usage

## 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 Converter

**Convert any public URL to clean markdown optimized for LLM/RAG pipelines.**

[![Apify Store](https://img.shields.io/badge/Apify-Store-blue)](https://apify.com/quaky_knickknack/url-to-markdown-converter)
[![License](https://img.shields.io/badge/license-MIT-green)](./LICENSE)

Extract clean, structured markdown from any public URL. Built for AI pipelines with SSRF protection, robots.txt respect, and metadata extraction.

### What it does

![A Python docs page converted to clean Markdown by this Actor (real output, captured 2026-11-17)](https://api.apify.com/v2/key-value-stores/eM9bZajN5D1usWzbM/records/url-to-markdown-01-before-after?signature=a1sZXJph7sWEoTsSS8Hg)

![One dataset item: the Markdown plus title, source URL and page metadata (real output)](https://api.apify.com/v2/key-value-stores/eM9bZajN5D1usWzbM/records/url-to-markdown-02-dataset?signature=ugD30RnpBcDsaHxvBYNg)

### Quick Start

```python
from apify_client import ApifyClient

client = ApifyClient("<APIFY_TOKEN>")
run = client.actor("quaky_knickknack/url-to-markdown-converter").call(
    run_input={"urls": ["https://example.com/article"]}
)
for record in client.dataset(run["defaultDatasetId"]).iterate_items():
    print(record["markdown"])
```

### Use Cases

#### RAG Pipelines

Feed clean markdown directly into vector databases for retrieval-augmented generation. The extracted content preserves document structure (headings, lists, tables, links) while removing navigation, ads, and boilerplate.

```python
from apify_client import ApifyClient
from langchain.text_splitter import RecursiveCharacterTextSplitter

client = ApifyClient("<APIFY_TOKEN>")
run = client.actor("quaky_knickknack/url-to-markdown-converter").call(
    run_input={
        "urls": ["https://docs.example.com/guide"],
        "outputFormat": "markdown",
        "includeMetadata": True
    }
)

## Split into chunks for embedding
text_splitter = RecursiveCharacterTextSplitter(chunk_size=1000, chunk_overlap=200)
for record in client.dataset(run["defaultDatasetId"]).iterate_items():
    if record["status"] == "success":
        chunks = text_splitter.split_text(record["markdown"])
        # Embed and store in vector DB
```

#### LangChain Integration

Use as a document loader in LangChain chains:

```python
from langchain_community.document_loaders import ApifyDatasetLoader
from langchain_core.documents import Document

def dataset_to_documents(dataset_id):
    from apify_client import ApifyClient
    client = ApifyClient("<APIFY_TOKEN>")
    docs = []
    for record in client.dataset(dataset_id).iterate_items():
        if record["status"] == "success":
            docs.append(Document(
                page_content=record["markdown"],
                metadata={
                    "source": record["url"],
                    "title": record.get("title", ""),
                    **record.get("metadata", {})
                }
            ))
    return docs

## Use in a chain
loader = ApifyDatasetLoader(
    dataset_id="your-dataset-id",
    dataset_mapping_function=dataset_to_documents
)
documents = loader.load()
```

#### LlamaIndex Integration

Convert URLs to documents for LlamaIndex:

```python
from llama_index.core import Document, VectorStoreIndex
from apify_client import ApifyClient

client = ApifyClient("<APIFY_TOKEN>")
run = client.actor("quaky_knickknack/url-to-markdown-converter").call(
    run_input={"urls": ["https://example.com/docs"]}
)

documents = []
for record in client.dataset(run["defaultDatasetId"]).iterate_items():
    if record["status"] == "success":
        documents.append(Document(
            text=record["markdown"],
            metadata={"url": record["url"], "title": record.get("title", "")}
        ))

index = VectorStoreIndex.from_documents(documents)
query_engine = index.as_query_engine()
response = query_engine.query("What is this about?")
```

#### n8n Workflow Automation

Use in n8n workflows to convert URLs from triggers (webhooks, schedules, forms):

```json
{
  "nodes": [
    {
      "type": "n8n-nodes-base.apify",
      "parameters": {
        "actorId": "quaky_knickknack/url-to-markdown-converter",
        "input": {
          "urls": "={{ $json.url }}",
          "outputFormat": "markdown"
        }
      }
    }
  ]
}
```

#### Make (Integromat) Integration

Connect to Make scenarios via HTTP module:

```
POST https://api.apify.com/v2/acts/quaky_knickknack~url-to-markdown-converter/runs?token=YOUR_TOKEN
Content-Type: application/json

{
  "urls": ["{{trigger.url}}"],
  "outputFormat": "markdown"
}
```

### Input

| Field | Type | Default | Description |
|-------|------|---------|-------------|
| `urls` | array | required | List of public HTTP/HTTPS URLs (max 100) |
| `outputFormat` | string | `markdown` | Output format: `markdown`, `json`, or `text` |
| `includeMetadata` | boolean | `true` | Extract page metadata (title, author, date) |
| `respectRobots` | boolean | `true` | Check robots.txt before fetching |
| `maxContentLength` | integer | `0` | Max content length per URL (0 = unlimited) |

#### Example Input

```json
{
  "urls": [
    "https://example.com/article1",
    "https://example.com/article2"
  ],
  "outputFormat": "markdown",
  "includeMetadata": true,
  "respectRobots": true,
  "maxContentLength": 50000
}
```

### Output

Each URL produces one dataset record:

```json
{
  "url": "https://example.com/article",
  "title": "Example Article",
  "markdown": "# Example Article\n\nContent here...",
  "metadata": {
    "url": "https://example.com/article",
    "title": "Example Article",
    "description": "Article description",
    "author": "John Doe",
    "published_date": "2026-01-15",
    "site_name": "Example Site"
  },
  "status": "success"
}
```

### Example Tasks

#### Task 1: Blog Post Archiver

Convert blog posts to markdown for offline reading or backup.

**Input:**

```json
{
  "urls": ["https://blog.example.com/post-1", "https://blog.example.com/post-2"],
  "outputFormat": "markdown",
  "includeMetadata": true
}
```

#### Task 2: Documentation Scraper

Extract documentation pages for RAG or search.

**Input:**

```json
{
  "urls": [
    "https://docs.example.com/getting-started",
    "https://docs.example.com/api-reference",
    "https://docs.example.com/examples"
  ],
  "outputFormat": "markdown",
  "respectRobots": true
}
```

#### Task 3: News Article Extractor

Extract news articles with metadata for analysis.

**Input:**

```json
{
  "urls": ["https://news.example.com/article-123"],
  "outputFormat": "markdown",
  "includeMetadata": true,
  "maxContentLength": 10000
}
```

#### Task 4: Batch Content Processor

Process up to 100 URLs in a single run.

**Input:**

```json
{
  "urls": ["https://site1.com/page1", "https://site2.com/page2", "..."],
  "outputFormat": "text",
  "includeMetadata": false
}
```

#### Task 5: JSON Export for Analysis

Export structured JSON for data analysis.

**Input:**

```json
{
  "urls": ["https://example.com/data"],
  "outputFormat": "json",
  "includeMetadata": true
}
```

### Integration Snippets

#### REST API

```bash
## Start a run
curl -X POST "https://api.apify.com/v2/acts/quaky_knickknack~url-to-markdown-converter/runs?token=YOUR_TOKEN" \
  -H "Content-Type: application/json" \
  -d '{"urls": ["https://example.com"]}'

## Get results
curl "https://api.apify.com/v2/datasets/DATASET_ID/items?token=YOUR_TOKEN"
```

#### MCP (Model Context Protocol)

```json
{
  "tool": "url-to-markdown",
  "parameters": {
    "urls": ["https://example.com"],
    "outputFormat": "markdown"
  }
}
```

#### JavaScript/Node.js

```javascript
import { ApifyClient } from 'apify-client';

const client = new ApifyClient({ token: 'YOUR_TOKEN' });

const run = await client.actor('quaky_knickknack/url-to-markdown-converter').call({
  urls: ['https://example.com'],
  outputFormat: 'markdown'
});

const dataset = await client.dataset(run.defaultDatasetId).listItems();
console.log(dataset.items[0].markdown);
```

### Comparison with Alternatives

| Feature | This Actor | Jina Reader | Firecrawl | Crawl4AI |
|---------|-----------|-------------|-----------|----------|
| **SSRF Protection** | ✅ DNS pinning + IP validation | ❌ | ❌ | ❌ |
| **robots.txt** | ✅ Checked by default | ✅ | ✅ | ✅ |
| **Batch Processing** | ✅ Up to 100 URLs | ❌ Single URL | ✅ | ✅ |
| **Metadata Extraction** | ✅ Title, author, date | ✅ | ✅ | ❌ |
| **Output Formats** | ✅ Markdown, JSON, text | ✅ Markdown | ✅ Markdown | ✅ Markdown |
| **Size Limits** | ✅ 10MB per URL | ✅ | ✅ | ❌ |
| **Time Limits** | ✅ 30s per URL | ✅ | ✅ | ❌ |
| **Rate Limiting** | ✅ 1s between URLs | ❌ | ❌ | ❌ |
| **Self-Hosted** | ❌ Apify only | ❌ SaaS | ❌ SaaS | ✅ |
| **JavaScript Rendering** | ❌ Static HTML | ❌ | ✅ | ✅ |
| **Pricing** | Pay-per-use (Apify) | Free tier | Paid | Free (self-hosted) |

**When to use this Actor:**

- You need SSRF protection for production use
- You're processing public, static HTML pages
- You want batch processing with rate limiting
- You need metadata extraction
- You're already using Apify

**When to use alternatives:**

- JavaScript-heavy SPAs → Firecrawl or Crawl4AI
- Self-hosted requirement → Crawl4AI
- Single URL with JS → Jina Reader

### Security Features

- **SSRF Protection**: DNS resolved once, connection pinned to validated IP
- **IP Validation**: Blocks private networks (127.0.0.0/8, 10.0.0.0/8, 172.16.0.0/12, 192.168.0.0/16, 169.254.0.0/16)
- **TLS Verification**: HTTPS certificates verified against hostname, not IP
- **Redirect Validation**: Every redirect target re-validated
- **robots.txt**: Checked before fetching (fail-closed)
- **Size Limits**: 10MB max per URL
- **Time Limits**: 30 seconds per URL
- **Rate Limiting**: 1 second delay between URLs

### Pricing

- **Free tier**: Available on Apify (check current pricing)
- **Pay-per-use**: Set in Apify Console once monetization is configured
- **Self-hosted**: Not supported (Apify platform only)

### Changelog

#### v1.0.4 (2026-11-17)

- Added output schema and dataset schema for Apify Store
- Improved README with use-case examples

#### v1.0.0 (2026-11-17)

- Initial release
- SSRF protection with DNS pinning
- robots.txt support
- Batch processing (up to 100 URLs)
- Metadata extraction
- Multiple output formats

### Support

- **Issues**: Open an issue on [GitHub](https://github.com/tajj-AI-comphw-2024/apify-url-to-markdown/issues)
- **Apify Store**: [Leave a review](https://apify.com/quaky_knickknack/url-to-markdown-converter)
- **Response time**: Within 24 hours

### License

MIT. See [LICENSE](./LICENSE).

# Actor input Schema

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

List of public HTTP or HTTPS URLs (max 100 per run)

## `outputFormat` (type: `string`):

Output format for the converted content

## `includeMetadata` (type: `boolean`):

Include page metadata (title, description, author, published date) in output

## `respectRobots` (type: `boolean`):

Check robots.txt before fetching; retrieval failures block the page, 4xx responses allow it.

## `maxContentLength` (type: `integer`):

Maximum content length per URL (0 = unlimited). Truncate longer content.

## Actor input object example

```json
{
  "outputFormat": "markdown",
  "includeMetadata": true,
  "respectRobots": true,
  "maxContentLength": 0
}
```

# Actor output Schema

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

Records produced by the Actor run.

# 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 = {};

// Run the Actor and wait for it to finish
const run = await client.actor("quaky_knickknack/url-to-markdown-converter").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 = {}

# Run the Actor and wait for it to finish
run = client.actor("quaky_knickknack/url-to-markdown-converter").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 '{}' |
apify call quaky_knickknack/url-to-markdown-converter --silent --output-dataset

```

## MCP server setup

```json
{
    "mcpServers": {
        "apify": {
            "type": "http",
            "url": "https://mcp.apify.com/?tools=fetch-actor-details,quaky_knickknack/url-to-markdown-converter"
        }
    }
}
```

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/oj2JiNGUP6kjU7ifO/builds/VH9j2trd6sEohvse9/openapi.json
