# Document to Markdown & JSON for AI/RAG (`arpitgoriya/document-to-markdown`) Actor

Convert PDF, Word (DOCX), PowerPoint (PPTX), Excel (XLSX), HTML web pages, EPUB and text files into clean Markdown, plain text and metadata, with tables as Markdown and RAG-ready chunks with token counts and page numbers. Optional OCR.

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

## Pricing

from $4.00 / 1,000 document 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/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

## Document to Markdown & JSON for AI/RAG

Convert **PDF, Word (DOCX), PowerPoint (PPTX), Excel (XLSX), CSV, EPUB, HTML web pages, Markdown and text files** into clean **Markdown**, **plain text** and **metadata**, ready for LLMs, RAG pipelines and AI agents. Tables come out as Markdown tables, and each document can be split into **RAG-ready chunks** with token counts, heading paths and page numbers. Optional **OCR** reads scanned PDFs and images. You pay a fixed price per converted document, and **failed documents are free**.

### What does Document to Markdown & JSON do?

You give it links to documents or web pages (or files in your Apify storage). For each one it downloads the file, detects the format from its content, and returns one dataset row with:

- 📝 the full document as **Markdown**: headings, lists, bold/italic, **tables as Markdown tables**;
- 📄 the same content as **plain text**;
- 🧩 **RAG chunks** (optional): each chunk has its text, token count (OpenAI `cl100k_base`), **heading path** (e.g. `["3 Model Architecture", "3.2 Attention"]`) and **page range**;
- 🏷️ **metadata**: title, author, language, page/slide/sheet count, word and token counts, created/modified dates, and for web pages the site name, publish date and description;
- ⚠️ clear **warnings and errors**, for example "page 4 has no text layer; turn on OCR".

Run it from the Apify Console with no code, on a schedule, through the API, from Make, Zapier or n8n, or from an AI agent through the Apify MCP server.

### Why use it?

- **One tool for every common format.** PDF, DOCX, PPTX (with speaker notes and chart data), XLSX (every sheet), CSV, EPUB, HTML, Markdown, TXT and JSON, plus PNG/JPEG/TIFF/WebP images with OCR. The format is detected from the file content, so URLs without an extension work.
- **Clean text for embeddings.** Repeated page headers, footers and page numbers are removed from PDFs, broken words are re-joined ("exam-ple" → "example"), rotated margin text is dropped, and web pages keep only the main content (no menus, cookie banners or footers).
- **Structure that survives.** Headings are detected in PDFs from font sizes and numbering ("3.2 Results"), so chunks follow the document's sections. Ruled tables and "booktabs" tables (typical in papers and reports) become Markdown tables.
- **RAG-ready chunks.** Heading-aware chunking with exact token counts, overlap, heading paths and page numbers, so you can cite the source page in your answers. Big tables are split by rows with the header repeated.
- **Predictable price.** $4 per 1,000 documents, no start fee, compute included. OCR is off by default and charged per page only when you turn it on.
- **Fast.** A 15-page research paper converts in about 3 seconds.

### Use cases

- **RAG and chatbots:** turn PDFs, policies, manuals and help-center pages into chunks for Pinecone, Qdrant, Weaviate, pgvector, Chroma or any vector database.
- **AI agents:** give an agent a tool that reads any document link and returns Markdown it can reason over.
- **LLM fine-tuning and evaluation data:** bulk-convert reports, papers and e-books into clean text.
- **Search and knowledge bases:** index office documents and web pages with titles, languages and page anchors.
- **Back-office automation:** extract text and tables from invoices, statements or forms (scanned ones with OCR) for further processing.

### How to use it

1. Click **Try for free** (or **Start**).
2. Paste links into **Document or web page URLs**, or upload a file.
3. Pick a **RAG chunking** mode and chunk size if you need chunks. Turn on **OCR mode: Auto** if some PDFs are scanned.
4. Click **Start**. Open the **Output** tab to see each document, or export the dataset as JSON, CSV or Excel.

### Input example

```json
{
    "startUrls": [
        { "url": "https://arxiv.org/pdf/1706.03762" },
        { "url": "https://en.wikipedia.org/wiki/Retrieval-augmented_generation" },
        { "url": "https://calibre-ebook.com/downloads/demos/demo.docx" }
    ],
    "chunking": "inline",
    "chunkSize": 512,
    "chunkOverlap": 64,
    "ocrMode": "off"
}
```

Files that are already in Apify storage (for example the output of another Actor):

```json
{
    "keyValueStoreId": "my-documents",
    "keyValueStoreKeys": ["contract.pdf", "slides.pptx"],
    "ocrMode": "auto",
    "chunking": "separate"
}
```

#### All input options

| Option | What it does | Default |
| --- | --- | --- |
| `startUrls` | Links to documents or web pages (list, pasted text or uploaded URL list) | — |
| `uploadedFile` | Upload one file from your computer | — |
| `keyValueStoreId` / `keyValueStoreKeys` | Convert records from your key-value store (all records if no keys are given) | — |
| `chunking` | `inline` (chunks inside each document row), `separate` (one row per chunk) or `none` | `inline` |
| `chunkSize` / `chunkOverlap` | Max tokens per chunk / tokens repeated between consecutive chunks | 512 / 64 |
| `headingAwareChunking` | Start a new chunk at each heading | `true` |
| `ocrMode` | `off`, `auto` (only pages without a text layer, and images) or `always` | `off` |
| `ocrLanguages` | Tesseract languages, e.g. `eng+deu`. Available: eng, deu, fra, spa, por, ita, nld, pol, hin | `eng` |
| `includeMarkdown` / `includePlainText` | Include the `markdown` / `text` fields | `true` / `true` |
| `includeTables` | Convert tables to Markdown tables | `true` |
| `pageMarkers` | Insert `<!-- page N -->` comments into the Markdown | `false` |
| `removeHeadersFooters` | Remove repeated PDF headers, footers and page numbers | `true` |
| `htmlExtraction` | `main` (article content only) or `full` (whole page) | `main` |
| `includeLinks` | Keep hyperlinks as `[text](url)` | `false` |
| `includeSpeakerNotes` | Add PPTX speaker notes | `true` |
| `saveMarkdownFiles` | Also save each document as a `.md` file with a download link | `false` |
| `maxPagesPerDocument` | Max PDF pages converted per document | 1000 |
| `maxRowsPerSheet` | Max rows per XLSX sheet / CSV | 5000 |
| `maxFileSizeMb` | Skip files larger than this | 100 |
| `maxConcurrency` | Parallel downloads | 4 |
| `proxyConfiguration` | Optional Apify Proxy for sites that block data-center IPs | off |

### Output example

One row per document (shortened; real output from the input example above):

```json
{
    "itemType": "document",
    "url": "https://arxiv.org/pdf/1706.03762",
    "format": "pdf",
    "success": true,
    "title": "Attention Is All You Need",
    "language": "en",
    "pageCount": 15,
    "pageUnit": "page",
    "wordCount": 6220,
    "tokenCount": 9568,
    "tableCount": 4,
    "headingCount": 27,
    "ocrPages": 0,
    "markdown": "# Attention Is All You Need\n\n...\n\n## Abstract\n\nThe dominant sequence transduction models are based on complex recurrent or convolutional neural networks ...\n\n### 3.5 Positional Encoding\n...\n\n| Layer Type | Complexity per Layer | Sequential | Maximum Path Length |\n| --- | --- | --- | --- |\n| Self-Attention | O(n2 · d) | O(1) | O(1) |\n| Recurrent | O(n · d2) | O(n) | O(n) |\n...",
    "text": "Attention Is All You Need\n\n...",
    "chunkCount": 29,
    "chunks": [
        {
            "chunkIndex": 1,
            "text": "## Abstract\n\nThe dominant sequence transduction models are based on complex recurrent or convolutional neural networks ...",
            "tokenCount": 430,
            "charCount": 2232,
            "headings": ["Attention Is All You Need", "Abstract"],
            "pageStart": 1,
            "pageEnd": 1
        }
    ],
    "metadata": {
        "creator": "LaTeX with hyperref",
        "producer": "pdfTeX-1.40.25",
        "createdAt": "2024-04-10T21:11:43Z",
        "modifiedAt": "2024-04-10T21:11:43Z"
    },
    "warnings": [],
    "error": null
}
```

With `"chunking": "separate"`, each chunk is also written as its own row (`"itemType": "chunk"`) with the document's `url`, `title`, `format` and `language`, so you can import the dataset straight into a vector database. Failed documents get a row with `"success": false` and an `error` message, and are not charged.

### How much does it cost to convert documents?

Pay per event. Platform compute is included, there is **no start fee**, and **failed documents are free**.

| Event | When it is charged | Price |
| --- | --- | --- |
| `document-converted` | A document was converted (includes up to 50 PDF pages) | **$0.004** ($4 per 1,000 documents) |
| `extra-page` | Each PDF page after the first 50 of a document | **$0.0001** ($0.10 per 1,000 pages) |
| `page-ocr` | Each page or image read with OCR (only when OCR mode is on) | **$0.005** |

Examples:

- 1,000 web pages, Word files or PDFs of up to 50 pages: **$4.00**.
- One 300-page PDF: $0.004 + 250 × $0.0001 = **$0.029**.
- A 10-page scanned PDF with OCR: $0.004 + 10 × $0.005 = **$0.054**.

Your **Maximum cost per run** setting is always respected: documents (and OCR pages) that would go over it are skipped instead of started, and the run finishes normally with a message saying so. On the Apify free plan you can try it with your monthly free credits.

### Call it from the API

Run synchronously and get the results in one request (replace `YOUR_TOKEN`):

```bash
curl -X POST "https://api.apify.com/v2/acts/arpitgoriya~document-to-markdown/run-sync-get-dataset-items?token=YOUR_TOKEN" \
  -H "Content-Type: application/json" \
  -d '{"startUrls":[{"url":"https://arxiv.org/pdf/1706.03762"}],"chunking":"inline","chunkSize":512}'
```

Python (`apify-client`), feeding chunks into your own vector store:

```python
from apify_client import ApifyClient

client = ApifyClient("YOUR_TOKEN")
run = client.actor("arpitgoriya/document-to-markdown").call(run_input={
    "startUrls": [{"url": "https://example.com/handbook.pdf"}],
    "chunking": "separate",
    "chunkSize": 400,
    "chunkOverlap": 50,
})
for item in client.dataset(run["defaultDatasetId"]).iterate_items():
    if item["itemType"] == "chunk":
        # item["text"], item["headings"], item["pageStart"], item["url"]
        ...
```

JavaScript (`apify-client`):

```js
import { ApifyClient } from 'apify-client';

const client = new ApifyClient({ token: process.env.APIFY_TOKEN });
const run = await client.actor('arpitgoriya/document-to-markdown').call({
    startUrls: [{ url: 'https://calibre-ebook.com/downloads/demos/demo.docx' }],
});
const { items } = await client.dataset(run.defaultDatasetId).listItems();
console.log(items[0].markdown);
```

### Use it from AI agents (MCP)

This Actor is available as a tool through the [Apify MCP server](https://docs.apify.com/platform/integrations/mcp), so Claude, ChatGPT, Cursor, VS Code, n8n and any other MCP client can call it directly. The input schema becomes the tool's parameters automatically.

```json
{
  "mcpServers": {
    "document-to-markdown": {
      "url": "https://mcp.apify.com?tools=arpitgoriya/document-to-markdown"
    }
  }
}
```

Or locally: `npx -y @apify/actors-mcp-server --tools arpitgoriya/document-to-markdown`.

Then ask, for example: *"Read this PDF and summarize section 3: https://arxiv.org/pdf/1706.03762"*. For agents, set `"chunking": "none"` and `"includePlainText": false` to keep the response small.

### Supported formats

| Format | What you get |
| --- | --- |
| **PDF** (text-based) | Headings (font size + numbering), paragraphs, bullet lists, ruled and booktabs tables, metadata. Multi-column layouts are usually read in column order (layout analysis by pdfminer.six). |
| **PDF** (scanned) | With OCR mode `auto`/`always`: text via Tesseract, per page. |
| **DOCX** | Headings (Title, Heading 1–6), bold/italic, lists, tables (merged cells handled), links (optional), core properties. |
| **PPTX** | One section per slide with its title, text boxes in reading order, bullet levels, tables, chart data as tables, speaker notes. |
| **XLSX** / **CSV** | One Markdown table per sheet (calculated values, dates in ISO format), empty rows/columns trimmed. |
| **HTML / web pages** | Main content (trafilatura) or the whole page, tables, metadata (title, author, date, site name, description, language). |
| **EPUB** | Chapters in reading order with headings, lists and metadata. |
| **Markdown, TXT, JSON** | Cleaned and split into blocks; JSON pretty-printed. |
| **Images** (PNG, JPEG, TIFF, WebP, BMP, GIF) | With OCR mode on: text via Tesseract (multi-page TIFF supported). |

Not supported: legacy binary Office files (DOC, XLS, PPT), RTF and OpenDocument (ODT/ODS/ODP). Save them as DOCX/XLSX/PPTX or PDF first. Web pages that need JavaScript to show their text, or a login, are not supported.

### FAQ

**My PDF gave "No text found".**
It is scanned (an image of text). Set **OCR mode** to **Auto**. Only pages without a text layer are OCR'd and charged.

**How good is table extraction from PDFs?**
Tables drawn with lines (grids) and tables with horizontal rules only (common in papers and financial reports) are detected. Tables laid out with spaces only and no rules stay as text. Complex merged headers may need a manual check.

**Which tokenizer is used for chunk sizes?**
OpenAI's `cl100k_base` (text-embedding-3-small/large, GPT-4). Other tokenizers give similar counts for English text, so leave some headroom below your embedding model's limit.

**Are math formulas kept?**
Text-based formulas are kept as plain characters (e.g. `O(n2 · d)`); they are not converted to LaTeX.

**Is my data stored?**
Documents are processed in your own Apify run. Results stay in your run's dataset and key-value store under your account's data retention settings. Nothing is sent to third-party AI services.

**Can I convert files behind a login?**
Not directly. Upload the file, put it in a key-value store, or give a pre-signed URL (S3, Google Cloud Storage, Dropbox `?dl=1` links all work).

**How big can files be?**
Up to 500 MB (`maxFileSizeMb`, 100 MB by default). Very long results are saved to the key-value store as a `.md` file, and the row links to it.

### Open source and credits

Built on permissively licensed open-source software: pdfplumber and pdfminer.six (MIT), pypdfium2/PDFium (Apache-2.0/BSD), python-docx, python-pptx, openpyxl (MIT), trafilatura (Apache-2.0), markdownify and Beautiful Soup (MIT), tiktoken (MIT) and Tesseract OCR (Apache-2.0).

### Other tools from us

- [Website Screenshot & PDF Generator](https://apify.com/arpitgoriya/website-screenshot-pdf): full-page screenshots and PDFs of any web page.
- [Website Tech Stack Lookup & Domain Intel](https://apify.com/arpitgoriya/website-tech-stack-lookup): technologies, DNS, email provider and hosting for any domain.
- [Company Jobs Feed](https://apify.com/arpitgoriya/company-jobs-feed): live job listings from your own company list across 7 ATSs, with new-jobs-only monitoring.
- [Google Sheets Export & Sync](https://apify.com/arpitgoriya/google-sheets-export): send any Apify dataset to a Google Sheet with your own credentials: append, upsert by key, add only new rows, dedupe.

### Feedback and support

Found a document that doesn't convert well, or need a format? Open an issue on the **Issues** tab with a link to a sample file. We read every issue and reply as quickly as we can.

# Changelog

This Actor's version history is a separate document: https://apify.com/arpitgoriya/document-to-markdown/changelog.md

# Actor input Schema

## `startUrls` (type: `array`):

Links to files (PDF, DOCX, PPTX, XLSX, CSV, EPUB, Markdown, TXT, JSON; images with OCR) or to web pages. The file type is detected from the content, so URLs without an extension work too. Add them one by one, paste a list, or upload a text file with one URL per line. Duplicates are converted (and charged) only once.

## `uploadedFile` (type: `string`):

Upload one document from your computer instead of giving a URL. It is stored in your Apify storage and converted like any URL.

## `chunking` (type: `string`):

Split each document into chunks for embeddings / vector databases. 'Inside each document item' adds a `chunks` array to the document's result. 'As separate dataset items' adds one row per chunk (handy for direct import into a vector DB); document rows are still written. Chunking is free.

## `chunkSize` (type: `integer`):

Maximum chunk length in tokens, counted with OpenAI's cl100k_base tokenizer (used by text-embedding-3 models). 256–1024 suits most embedding models.

## `chunkOverlap` (type: `integer`):

Tokens from the end of a chunk that are repeated at the start of the next one when a long section is split, so sentences that span a boundary keep their context. At most half of the chunk size.

## `headingAwareChunking` (type: `boolean`):

Begin a new chunk at each heading (once the current chunk holds a quarter of the chunk size), so chunks follow the document's sections. Every chunk always lists its heading path and page range.

## `ocrMode` (type: `string`):

OCR reads text from scanned PDFs and images with Tesseract. 'Off' is cheapest: scanned pages are reported as having no text. 'Auto' OCRs only pages without a text layer (and image files). 'Always' OCRs every PDF page, for PDFs with a broken text layer. Each OCR'd page is charged as a 'page-ocr' event.

## `ocrLanguages` (type: `string`):

Tesseract language codes, joined with '+'. Available: eng, deu, fra, spa, por, ita, nld, pol, hin. Example: 'eng+deu'.

## `includeMarkdown` (type: `boolean`):

Add the full document as Markdown (headings, lists, bold/italic, tables) in the `markdown` field.

## `includePlainText` (type: `boolean`):

Add the document as plain text (no Markdown syntax; tables as tab-separated lines) in the `text` field.

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

Convert tables to Markdown tables. In PDFs this finds ruled tables and 'booktabs' tables (horizontal rules only). Turn off for faster PDF processing.

## `pageMarkers` (type: `boolean`):

Insert `<!-- page N -->` comments (or slide/sheet/chapter) into the Markdown where each page starts. Chunks carry page numbers either way.

## `removeHeadersFooters` (type: `boolean`):

Drop page numbers and running headers/footers that repeat on most pages, so they don't pollute your chunks.

## `htmlExtraction` (type: `string`):

'Main content' keeps the article/body text and drops navigation, menus, cookie banners, footers and ads (trafilatura). 'Whole page' converts everything visible in the HTML. Pages that need JavaScript to show their text are not supported.

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

Keep hyperlinks as Markdown links [text](url). Off by default because link URLs add tokens without adding meaning for most RAG uses.

## `includeSpeakerNotes` (type: `boolean`):

Add each slide's speaker notes as a quote below the slide content.

## `saveMarkdownFiles` (type: `boolean`):

Save each converted document as a .md file in the run's key-value store, with a download link in `markdownFileUrl`.

## `keyValueStoreId` (type: `string`):

Convert files stored in one of your Apify key-value stores (for example the output of another Actor). Give the store ID or name.

## `keyValueStoreKeys` (type: `array`):

Keys of the records to convert from the key-value store above. Leave empty to convert every record in the store.

## `maxPagesPerDocument` (type: `integer`):

Convert at most this many pages of each PDF (or frames of a multi-page image). The first 50 pages of every PDF are included in the document price; each further page is charged as 'extra-page'.

## `maxRowsPerSheet` (type: `integer`):

Rows kept per spreadsheet sheet or CSV file. Larger sheets are cut and a warning is added.

## `maxFileSizeMb` (type: `integer`):

Files larger than this are skipped with an error (not charged).

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

How many documents are downloaded at the same time.

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

Optional. Use Apify Proxy if a site blocks downloads from data-center IPs.

## Actor input object example

```json
{
  "startUrls": [
    {
      "url": "https://arxiv.org/pdf/1706.03762"
    },
    {
      "url": "https://en.wikipedia.org/wiki/Retrieval-augmented_generation"
    }
  ],
  "chunking": "inline",
  "chunkSize": 512,
  "chunkOverlap": 64,
  "headingAwareChunking": true,
  "ocrMode": "off",
  "ocrLanguages": "eng",
  "includeMarkdown": true,
  "includePlainText": true,
  "includeTables": true,
  "pageMarkers": false,
  "removeHeadersFooters": true,
  "htmlExtraction": "main",
  "includeLinks": false,
  "includeSpeakerNotes": true,
  "saveMarkdownFiles": false,
  "maxPagesPerDocument": 1000,
  "maxRowsPerSheet": 5000,
  "maxFileSizeMb": 100,
  "maxConcurrency": 4,
  "proxyConfiguration": {
    "useApifyProxy": false
  }
}
```

# Actor output Schema

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

One item per document: URL, format, title, language, pages, word/token counts, Markdown, text, chunks, metadata and error (if any).

## `markdown` (type: `string`):

URL, title and the full Markdown of each document.

## `files` (type: `string`):

The run's key-value store: RUN_SUMMARY and, if enabled, .md files.

# 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 = {
    "startUrls": [
        {
            "url": "https://arxiv.org/pdf/1706.03762"
        },
        {
            "url": "https://en.wikipedia.org/wiki/Retrieval-augmented_generation"
        },
        {
            "url": "https://calibre-ebook.com/downloads/demos/demo.docx"
        }
    ]
};

// Run the Actor and wait for it to finish
const run = await client.actor("arpitgoriya/document-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 = { "startUrls": [
        { "url": "https://arxiv.org/pdf/1706.03762" },
        { "url": "https://en.wikipedia.org/wiki/Retrieval-augmented_generation" },
        { "url": "https://calibre-ebook.com/downloads/demos/demo.docx" },
    ] }

# Run the Actor and wait for it to finish
run = client.actor("arpitgoriya/document-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 '{
  "startUrls": [
    {
      "url": "https://arxiv.org/pdf/1706.03762"
    },
    {
      "url": "https://en.wikipedia.org/wiki/Retrieval-augmented_generation"
    },
    {
      "url": "https://calibre-ebook.com/downloads/demos/demo.docx"
    }
  ]
}' |
apify call arpitgoriya/document-to-markdown --silent --output-dataset

```

## MCP server setup

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