# Document to Markdown (PDF, Office, OCR) for AI agents (`sapphire_studio/document-to-markdown`) Actor

Turn PDF, Word, PowerPoint, Excel, CSV, HTML, EPUB, image, legacy DOC/PPT, RTF and OpenDocument links into clean Markdown for LLMs and RAG: tables, headings, metadata, per-page text, OCR and ready-made chunks. Priced per document plus per OCR page; failed files are free.

- **URL**: https://apify.com/sapphire_studio/document-to-markdown.md
- **Developed by:** [Sapphire Studio](https://apify.com/sapphire_studio) (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 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/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

### What does Document to Markdown do?

Document to Markdown turns links to documents into clean, LLM-ready Markdown. Give it a list of URLs to PDF, Word (DOCX and legacy DOC), PowerPoint (PPTX and legacy PPT), Excel (XLSX, XLS, ODS), OpenDocument (ODT, ODP), RTF, CSV, HTML, EPUB, Markdown, text, JSON or image files, and you get one dataset row per document with:

- the whole document as Markdown: headings, paragraphs, bullet and numbered lists, links and **tables as GFM Markdown tables**;
- title, author, language, creation and modification dates, page count, word count, token estimate and table count;
- optional **per-page Markdown** (PDF pages, slides, sheets or EPUB chapters);
- optional **RAG chunks** split at headings and paragraphs, each with its heading, character range and page range;
- **OCR** (Tesseract) for scanned PDF pages and images, used only on pages that have no text layer unless you ask for more.

It is built for AI agents whose fetch tool hits a PDF, RAG and search pipelines that need clean text with tables intact, legal, research and procurement teams turning filings, papers and tenders into text, and anyone chaining it after a crawler that collects file links.

### Why use it?

- **One tool for every common format.** PDFs with multi-column layouts, Word reports, slide decks with speaker notes and chart data, spreadsheets with several sheets, e-books and web pages all come out in the same Markdown shape. Old `.doc` and `.ppt` files from document archives, RTF exports and OpenDocument files from LibreOffice work too.
- **Tables survive.** PDF tables are rebuilt from text positions, Word, PowerPoint and HTML tables are converted cell by cell, and every sheet of a workbook becomes a table.
- **Clean text.** Running headers, footers and page numbers are removed, two- and three-column pages are read column by column, and words hyphenated across lines are joined.
- **Fair price.** One price per converted document, plus a small per-page price only for pages that really needed OCR. Failed, blocked and skipped documents are free.
- **No proxy costs.** Files are downloaded directly, with Apify Proxy only as a fallback for downloads that fail; no residential proxy traffic is used.

### How to use it

1. Paste one or more document URLs into **Document URLs**. Google Drive, Google Docs, Dropbox and GitHub share links are turned into direct downloads automatically. Files you upload to an Apify key-value store work too (use the record URL).
2. Choose the OCR mode and languages if your files contain scans or images.
3. Turn on **Split into chunks for RAG** and **Include per-page Markdown** if you need them.
4. Run the Actor and read the dataset, or call it from your agent through the Apify API or the Apify MCP server.

#### Example input

```json
{
  "urls": [
    "https://arxiv.org/pdf/1706.03762",
    "https://raw.githubusercontent.com/microsoft/markitdown/main/packages/markitdown/tests/test_files/test.docx"
  ],
  "ocr": "auto",
  "chunking": true,
  "chunkSize": 800
}
```

### Input

| Field | Type | Default | Description |
|---|---|---|---|
| `urls` | list of URLs | required | Documents to convert, up to 1000 per run. |
| `ocr` | `auto`, `always`, `off` | `auto` | Automatic OCRs scanned PDF pages and images only. Always OCRs every PDF page. Off never OCRs. |
| `ocrLanguages` | list | `["eng"]` | English, German, French, Spanish, Italian, Portuguese, Dutch. |
| `outputPages` | boolean | `false` | Add the Markdown of every page, slide, sheet or chapter. |
| `chunking` | boolean | `false` | Add RAG chunks. |
| `chunkSize` | integer | `800` | Target chunk size in tokens (100 to 8000). |
| `chunkOverlap` | integer | `80` | Tokens repeated between chunks (at most half the chunk size). |
| `maxPagesPerDocument` | integer | `300` | Pages, slides, sheets or chapters converted per document. |
| `maxOcrPagesPerDocument` | integer | `10` | Scanned pages OCRed (and charged as `ocr_page`) per document. |
| `maxFileSizeMb` | integer | `50` | Larger files are skipped as `invalid_input`. |
| `maxConcurrency` | integer | `3` | Documents processed in parallel (Advanced). |
| `debug` | boolean | `false` | Save a diagnostic record per document to the key-value store (Advanced). |

### Output

One row per input URL, always with the same keys in the same order. This is a real row from a live run, with the long text fields shortened for this page:

```json
{
  "url": "https://nvlpubs.nist.gov/nistpubs/CSWP/NIST.CSWP.29.pdf",
  "final_url": "https://nvlpubs.nist.gov/nistpubs/CSWP/NIST.CSWP.29.pdf",
  "file_name": "NIST.CSWP.29.pdf",
  "status": "ok",
  "ok": true,
  "error": null,
  "format": "pdf",
  "content_type": "application/pdf",
  "file_size_bytes": 1518858,
  "title": "The NIST Cybersecurity Framework (CSF) 2.0",
  "author": "National Institute of Standards and Technology",
  "language": "EN-US",
  "created_at": "2024-03-06T20:46:45.000Z",
  "modified_at": "2025-06-04T14:58:23.000Z",
  "page_count": 32,
  "pages_converted": 32,
  "ocr_pages": 0,
  "extraction": "text",
  "table_count": 7,
  "word_count": 8923,
  "char_count": 66784,
  "token_estimate": 16696,
  "markdown": "# The NIST Cybersecurity Framework (CSF) 2.0\n\nNational Institute of Standards and Technology\n\nThis publication is available free of charge from: https://doi.org/10.6028/NIST.CSWP.29\n\nFebruary 26, 2024\n\nAbstract\n\nThe NIST Cybersecurity Framework (CSF) 2.0 provides guidance to industry, government agencies, and other organizations to manage cybersecurity risks. ...",
  "markdown_truncated": false,
  "full_markdown_url": null,
  "pages": [
    { "page": 1, "markdown": "# The NIST Cybersecurity Framework (CSF) 2.0\n\nNational Institute of Standards and Technology\n\nThis p ...", "char_count": 200, "ocr": false }
  ],
  "chunks": [
    { "index": 1, "text": "cyberframework@nist.gov.\n\nTable of Contents\n\n1. Cybersecurity Framework (CSF) Overview ....", "heading": "The NIST Cybersecurity Framework (CSF) 2.0", "char_start": 3105, "char_end": 6086, "page_start": 4, "page_end": 5, "token_estimate": 825 }
  ],
  "metadata": {
    "subject": "The NIST Cybersecurity Framework (CSF) 2.0 provides guidance to industry, government agencies, and other organizations to manage cybersecurity risks. ...",
    "keywords": "cybersecurity; Cybersecurity Framework (CSF); cybersecurity risk governance; cybersecurity risk management; enterprise risk management; Profiles; Tiers",
    "creator": "Acrobat PDFMaker 23 for Word",
    "producer": "Adobe PDF Library 23.8.53",
    "pdf_version": "1.6",
    "encrypted": false,
    "has_forms": false
  },
  "warnings": null,
  "checked_at": "2026-10-27T00:13:10.252Z",
  "attempts": 1,
  "fetch_mode": "direct"
}
```

A failed row from the same run (this site answers automated downloads with a bot-protection challenge, which the Actor never tries to solve; the row is not charged):

```json
{
  "url": "https://eur-lex.europa.eu/legal-content/EN/TXT/PDF/?uri=CELEX:32016R0679",
  "final_url": null,
  "status": "blocked",
  "ok": false,
  "error": "HTTP 202: the site answered with a bot-protection challenge.",
  "format": null,
  "markdown": null,
  "checked_at": "2026-10-27T00:14:04.657Z",
  "attempts": 3,
  "fetch_mode": null
}
```

(The failed row has every other key too, set to `null`.) The run also writes a `SUMMARY` record to the key-value store with counts by status, formats, pages and OCR pages converted, charged `document` and `ocr_page` events, LibreOffice conversions and their average time, download sizes and the run duration.

#### Legacy and OpenDocument formats

`.doc`, `.ppt`, `.rtf`, `.odt` and `.odp` files are converted with LibreOffice (headless) and then read like DOCX and PPTX, so they get the same headings, lists, tables, links and footnotes, and presentations get one page per slide. Their rows carry `extraction: "libreoffice"` and `metadata.converted_with` and `metadata.conversion_ms`. This is a real `.doc` row from a live run (Markdown shortened):

```json
{
  "url": "https://raw.githubusercontent.com/apache/tika/main/tika-parsers/tika-parsers-standard/tika-parsers-standard-modules/tika-parser-microsoft-module/src/test/resources/test-documents/testWORD.doc",
  "final_url": "https://raw.githubusercontent.com/apache/tika/main/tika-parsers/tika-parsers-standard/tika-parsers-standard-modules/tika-parser-microsoft-module/src/test/resources/test-documents/testWORD.doc",
  "file_name": "testWORD.doc",
  "status": "ok",
  "ok": true,
  "error": null,
  "format": "doc",
  "content_type": "application/octet-stream",
  "file_size_bytes": 32768,
  "title": "Sample Word Document",
  "author": "User A",
  "language": null,
  "created_at": "2010-11-12T16:22:00.000Z",
  "modified_at": "2010-11-12T16:22:00.000Z",
  "page_count": null,
  "pages_converted": null,
  "ocr_pages": 0,
  "extraction": "libreoffice",
  "table_count": 1,
  "word_count": 109,
  "char_count": 750,
  "token_estimate": 188,
  "markdown": "# Sample Word Document Title\n\n## And now for a subtitle\n\n# Main Heading\n\n# Heading Level 1\n\n## Heading Level 2\n\n### Heading Level 3\n\nThis is a sample Microsoft Word Document.\n\nThis document includes text that is **BOLD** and _ITALIC_.\n\n| This is a table |  |\n| --- | --- |\n|  | Nested tableMore of our nested table |\n| The table h ...",
  "markdown_truncated": false,
  "full_markdown_url": null,
  "pages": null,
  "chunks": null,
  "metadata": {
    "subject": null,
    "keywords": null,
    "description": null,
    "language": "en-US",
    "application": null,
    "word_count_reported": null,
    "converted_with": "LibreOffice 25.2.3.2",
    "conversion_ms": 952
  },
  "warnings": null,
  "checked_at": "2026-10-27T03:46:20.602Z",
  "attempts": 1,
  "fetch_mode": "direct"
}
```

One real ok row per new format from the same run (20 of 20 legacy files ok):

| Format | File | Title | Pages | Words | Tables | Conversion ms | Markdown starts with |
|---|---|---|---|---|---|---|---|
| `doc` | testWORD_various.doc |  |  | 127 | 1 | 283 | Footnote appears here\[1]  Here is a text box  **Bold** *italic* underline superscript subscript  *italic*  *italic*  *underline*  Here is a list:  - ... |
| `ppt` | testPPT_various.ppt | Slide 1 | 1 | 121 | 1 | 253 | ## Slide 1  | Row 1 Col 1 | Row 1 Col 2 | Row 1 Col 3 | | --- | --- | --- | | Row 2 Col 1 | Row 2 Col 2 | Row 2 Col 3 |  Here is a text box  Footnote  ... |
| `rtf` | testRTFVarious.rtf |  |  | 124 | 1 | 269 | Footnote appears here\[1]  Here is a text box  **Bold** *italic* underline superscript subscript  Here is a list:  - Bullet 1 - Bullet 2 - Bullet 3   ... |
| `odt` | testODFwithOOo3.odt | Apache Tika | 2 | 61 | 0 | 405 | # Apache Tika Test Document  This is a rather\[1] difficult test document, with interesting features.  A rectangle  Another interesting project is So ... |
| `odp` | LibreOfficeImpress_odp_1.3.odp | Beehive | 2 | 10 | 0 | 429 | ## Slide 1: This is  An example Impress file  ## Slide 2 ... |

#### Status values

| Status | Meaning | Charged |
|---|---|---|
| `ok` | Downloaded and converted. | Yes |
| `not_found` | HTTP 404 or 410, unknown host, or no text in the file (for example a scan with OCR off). | No |
| `blocked` | The site refused the download (HTTP 401, 403, 429) or answered with a bot-protection page. | No |
| `invalid_input` | Bad URL, private address, file too large, unsupported or damaged format, password-protected file. | No |
| `timeout` | The run time limit was reached before this document. | No |
| `charge_limit_reached` | Your maximum charge per run was reached. | No |
| `error` | Server errors or network failures after retries, or an unexpected error. | No |

### Supported formats

| Format | `format` value | How it is read | `extraction` |
|---|---|---|---|
| PDF | `pdf` | Text layer with layout analysis; OCR for scanned pages | `text`, `ocr` or `mixed` |
| Word | `docx` | Native (headings, lists, tables, links, footnotes) | `text` |
| PowerPoint | `pptx` | Native (slides, tables, chart data, image alt text, speaker notes) | `text` |
| Excel, OpenDocument spreadsheet, CSV | `xlsx`, `xls`, `ods`, `csv`, `tsv` | Every sheet as a table | `text` |
| EPUB | `epub` | One page per chapter | `text` |
| HTML | `html` | Main content only (page menus and footers removed) | `text` |
| Markdown, text, JSON, XML | `markdown`, `text`, `json`, `xml` | As is (JSON and XML as code blocks) | `text` |
| Images | `png`, `jpeg`, `tiff`, `bmp`, `gif`, `webp` | OCR | `ocr` |
| Legacy Word | `doc` | LibreOffice, then the Word reader | `libreoffice` |
| Legacy PowerPoint | `ppt` | LibreOffice, then the PowerPoint reader (one page per slide) | `libreoffice` |
| RTF | `rtf` | LibreOffice, then the Word reader | `libreoffice` |
| OpenDocument text | `odt` | LibreOffice, then the Word reader | `libreoffice` |
| OpenDocument presentation | `odp` | LibreOffice, then the PowerPoint reader (one page per slide) | `libreoffice` |
| Apple Pages, Keynote, Numbers; ZIP | (not converted) | Reported as `invalid_input` with a hint to export as PDF, DOCX, PPTX or XLSX | |

### Pricing

Pay per event, only for rows with `status: "ok"`:

| Event | When | Price |
|---|---|---|
| `document` | Once per successfully converted document, any format and any length. | USD 0.004 |
| `ocr_page` | Once per page or image whose text came from OCR (the row's `ocr_pages`), on top of `document`. | USD 0.002 |

Pages that have a text layer are never OCRed with OCR set to Automatic, so ordinary PDFs, Office files and web pages cost one `document` event and nothing else. A 20-page scanned PDF costs one `document` plus up to 10 `ocr_page` events at the default `maxOcrPagesPerDocument` of 10. Rows with any other status are free, and OCR on a document that ends up failing is free too.

Set a maximum charge per run in the run options. Before every OCR page the Actor checks that the remaining budget can still pay for it; pages it cannot pay for are not OCRed (the row says so in `warnings`), and once the next document no longer fits the Actor stops starting new ones and lists the rest as `charge_limit_reached`. Use `maxPagesPerDocument` and `maxOcrPagesPerDocument` to bound what you get, and pay, per document.

### Limitations

- Measured on the Apify platform (2 GB memory): 29 documents from 15 sites, 348 pages including 7 OCR pages, converted in 66 seconds with 28 of 29 ok (96.6%). The only failure was a site that serves a bot-protection challenge.
- Native PDF text converts at well under a second per page; OCR takes several seconds per page (about 10 to 18 seconds per page at the default 2 GB memory). Give the run more memory (and therefore more CPU) for large scanned files.
- PDF table detection works on tables whose columns are separated by white space. Tables drawn as images, charts, and cells that sit at different heights in one row may come out as text or split rows. Formulas are kept as plain text.
- Legacy `.doc`, `.ppt`, `.rtf`, `.odt` and `.odp` files: 20 of 20 public test files from two open-source test corpora converted on the platform, about 0.2 to 0.5 seconds of LibreOffice time per file after the first (about 1 second while LibreOffice starts). One conversion runs at a time, so a run with many legacy files converts them one after the other while other formats continue in parallel. Page counts are not reported for `.doc` and `.rtf` (LibreOffice does not lay out pages in headless mode). Embedded images, drawings and OLE objects are dropped, as for DOCX.
- Text drawn in custom font encodings (some chart labels) can come out garbled; use OCR set to Always for such files.
- Documents behind a login, a paywall or a bot challenge cannot be read.
- One dataset item can hold about 8 MB. Larger outputs keep the first 1,000,000 characters in the row and store the full Markdown in the key-value store (`full_markdown_url`).

### FAQ

#### Can my agent call it directly?

Yes. It accepts a plain array of URLs, returns one flat row per document and is a normal pay-per-event Actor, so agents can run it through the Apify API, the Apify MCP server or any agent framework with Apify tools.

#### Are my documents stored?

The Markdown is stored only in your run's dataset and key-value store, under your account's data retention settings. The original files are processed in memory and in temporary files that are deleted right after conversion.

#### Which pages get OCR?

With OCR set to Automatic, only PDF pages without usable text that contain an image, plus image files. Set it to Always for PDFs whose text layer is broken.

#### What does OCR cost?

One `ocr_page` event per page that was actually OCRed, in addition to the `document` event. With OCR set to Automatic that is only scanned pages and images. Set OCR to Off to never pay for OCR, or lower `maxOcrPagesPerDocument`.

#### Can it read old .doc and .ppt files?

Yes. Legacy Word and PowerPoint files, RTF and OpenDocument text and presentations are converted with LibreOffice and come out in the same Markdown shape as DOCX and PPTX. Password-protected and damaged files are reported as `invalid_input` and not charged.

#### Does it crawl websites?

No. It converts exactly the URLs you give it. To convert every PDF on a site, collect the links with a crawler first and pass them in.

### Legal disclaimer

This Actor is not affiliated with, endorsed by or sponsored by any website or file host it downloads from. All trademarks belong to their owners. It reads only publicly available files at URLs that you supply; it uses no login, solves no CAPTCHA or bot challenge, and adds no personal data. You are responsible for having the right to process the documents you submit.

### Support

Open an issue on the Actor's Issues tab with the run ID and the input that did not work.
Built and maintained by Sapphire Studio.

# Changelog

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

# Actor input Schema

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

Public links to the documents to convert: PDF, DOCX, PPTX, legacy DOC and PPT, RTF, ODT, ODP, XLSX/XLS/ODS, CSV/TSV, HTML pages, EPUB, Markdown/text/JSON, or images (PNG, JPG, TIFF, BMP, GIF, WebP). Google Drive, Google Docs, Dropbox and GitHub share links are turned into direct downloads automatically. Files uploaded to an Apify key-value store work too (use the record URL). Up to 1000 URLs per run.

## `ocr` (type: `string`):

Automatic: OCR only PDF pages that have no text layer (scanned pages) and images. Always: OCR every PDF page, useful when the text layer is broken. Off: never OCR (faster; scanned pages come back empty and images fail). Every OCRed page is charged as one OCR page event.

## `ocrLanguages` (type: `array`):

Languages of the text in scanned pages and images. Pick every language that appears; more languages are a little slower.

## `outputPages` (type: `boolean`):

Add a pages list with the Markdown of every page (PDF pages, slides, sheets or EPUB chapters) next to the full document Markdown.

## `chunking` (type: `boolean`):

Add a chunks list: the Markdown split at headings and paragraphs into pieces of about the chosen size, each with its heading, character range and page range, ready for embedding.

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

Target size of each chunk in tokens (about 4 characters per token).

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

How much text from the end of one chunk is repeated at the start of the next (at most half the chunk size).

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

Only the first pages (or slides, sheets, chapters) up to this number are converted. The row says when a document was cut.

## `maxOcrPagesPerDocument` (type: `integer`):

OCR takes several seconds of compute per page, and each OCRed page is charged as one OCR page event on top of the document. Scanned pages beyond this number are skipped (the row lists a warning). Raise it for long scanned documents.

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

Larger files are not downloaded and are reported as invalid_input.

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

How many documents are downloaded and converted at the same time. Raise the run memory too when you raise this for large or scanned files.

## `debug` (type: `boolean`):

Save a short diagnostic record per document to the key-value store.

## Actor input object example

```json
{
  "urls": [
    "https://arxiv.org/pdf/1706.03762",
    "https://raw.githubusercontent.com/microsoft/markitdown/main/packages/markitdown/tests/test_files/test.docx"
  ],
  "ocr": "auto",
  "ocrLanguages": [
    "eng"
  ],
  "outputPages": false,
  "chunking": false,
  "chunkSize": 800,
  "chunkOverlap": 80,
  "maxPagesPerDocument": 300,
  "maxOcrPagesPerDocument": 10,
  "maxFileSizeMb": 50,
  "maxConcurrency": 3,
  "debug": false
}
```

# Actor output Schema

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

Dataset items: one row per document URL.

## `summary` (type: `string`):

Counts by status, formats, pages and OCR pages converted, charged events, LibreOffice conversions, download sizes and run duration.

# 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://arxiv.org/pdf/1706.03762",
        "https://raw.githubusercontent.com/microsoft/markitdown/main/packages/markitdown/tests/test_files/test.docx"
    ]
};

// Run the Actor and wait for it to finish
const run = await client.actor("sapphire_studio/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 = { "urls": [
        "https://arxiv.org/pdf/1706.03762",
        "https://raw.githubusercontent.com/microsoft/markitdown/main/packages/markitdown/tests/test_files/test.docx",
    ] }

# Run the Actor and wait for it to finish
run = client.actor("sapphire_studio/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 '{
  "urls": [
    "https://arxiv.org/pdf/1706.03762",
    "https://raw.githubusercontent.com/microsoft/markitdown/main/packages/markitdown/tests/test_files/test.docx"
  ]
}' |
apify call sapphire_studio/document-to-markdown --silent --output-dataset

```

## MCP server setup

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