# Convert To Markdown (`datavault/convert-to-markdown`) Actor

Convert to Markdown, converts documents, spreadsheets, images (OCR), audio (transcription), and web/data files into clean Markdown. It runs fully locally, requires no API keys, and is ideal for LLMs, docs, and archiving.

- **URL**: https://apify.com/datavault/convert-to-markdown.md
- **Developed by:** [Datavault](https://apify.com/datavault) (community)
- **Categories:** Automation, Other
- **Features:** Limited permissions
- **Stats:** 9 total users, 0 monthly users, 100.0% runs succeeded, 0 bookmarks
- **User rating**: No ratings yet

## Pricing

from $15.00 / 1,000 file conversions

This Actor is paid per event. You are not charged for the Apify platform usage, but only a fixed price for specific events.
Since this Actor supports Apify Store discounts, the price gets lower the higher subscription plan you have.

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

## Convert to Markdown - Versatile File Converter

The **Convert to Markdown** Actor is a high-performance, all-in-one utility designed to transform a wide variety of file formats into clean, structured Markdown. It is ideal for preparing data for LLMs (Large Language Models), documentation workflows, or archiving.

### Features

- **Documents**: Converts **PDF** (preserving layout and structure), **Word (.docx)**, and **PowerPoint (.pptx)** into clean Markdown.
- **Spreadsheets**: Transforms **Excel (.xlsx)** and **CSV** files into readable Markdown tables.
- **Images (OCR)**: Extracts text from images (JPG, PNG, WebP, etc.) using automated OCR.
- **Audio (Transcription)**: Transcribes speech from audio files (MP3, WAV, etc.) into text using local AI models.
- **Web & Data**: Converts **HTML**, **JSON**, and **XML** into formatted Markdown blocks or tables.
- **Metadata Extraction**: Automatically extracts technical metadata for images and audio files.
- **No External API Keys**: Everything runs locally inside the container (including OCR and Transcription).

### Supported Formats

| Category | Formats |
| --- | --- |
| **Documents** | PDF, DOCX, PPTX, TXT |
| **Data** | JSON, XML, CSV, HTML |
| **Spreadsheets** | XLSX |
| **Images** | PNG, JPG, JPEG, WEBP, BMP, TIFF |
| **Audio** | MP3, WAV, OGG, M4A, FLAC |

### Input Parameters

- `urls`: A list of URLs pointing to the files you want to convert.
- `performOcr`: (Default: `true`) Enable/disable OCR for images and scanned PDFs.
- `extractMetadata`: (Default: `true`) Enable/disable technical metadata extraction.
- `proxyConfiguration`: Use Apify Proxy if your target files are protected or geo-blocked.

### Output

The Actor outputs a dataset where each item represents a converted file:

- `url`: The original source URL.
- `title`: The filename or detected title.
- `markdown`: The full converted content in Markdown format.
- `mimeType`: The detected MIME type of the file.
- `metadata`: A JSON object containing technical metadata (e.g., Image dimensions, Audio duration, GPS data).

#### Sample Input

```json
{
    "urls": [
        "https://example.com/document.pdf",
        "https://example.com/photo.jpg"
    ],
    "performOcr": true,
    "extractMetadata": true
}
```

### How it works

1. **Download**: The Actor downloads the file from the provided URL.
2. **Identification**: It detects the file type based on headers and extensions.
3. **Conversion**:
   - **PDFs** use specialized tools to preserve layout and then convert to Markdown.
   - **Word/PowerPoint** are transformed using robust document processors.
   - **Images** use advanced OCR for text and technical metadata extraction.
   - **Audio** uses local AI models for speech-to-text transcription.
   - **Web/Data** use specialized HTML and data parsers to build tables and lists.
4. **Formatting**: All outputs are normalized into valid Markdown.
5. **Storage**: Results are saved to the Apify Dataset and a `conversion` event is billed.

### Performance Note

- **Transcription/OCR**: Processing large audio files or complex images can be CPU-intensive. The Actor uses optimized models for a balance between speed and accuracy.
- **Memory**: For very large Excel files or PDFs, ensure the Actor has at least 2GB of memory allocated.

***

**Feedback & Improvements**
If you encounter a file format that isn't supported or have ideas for improvements, please leave us a message in the Issues tab!

# Actor input Schema

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

List of URLs of files to convert to Markdown.

## `performOcr` (type: `boolean`):

If enabled, images and scanned PDFs will be processed with automated OCR.

## `extractMetadata` (type: `boolean`):

If enabled, technical metadata will be extracted for images and audio files.

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

Use Apify Proxy if files are behind blocks.

## `concurrency` (type: `integer`):

Number of URLs to process in parallel. (Default: 2)

## Actor input object example

```json
{
  "urls": [
    {
      "url": "https://www.w3.org/WAI/ER/tests/xhtml/testfiles/resources/pdf/dummy.pdf"
    }
  ],
  "performOcr": true,
  "extractMetadata": true,
  "concurrency": 2
}
```

# Actor output Schema

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

The converted Markdown results.

# 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://www.w3.org/WAI/ER/tests/xhtml/testfiles/resources/pdf/dummy.pdf"
        }
    ]
};

// Run the Actor and wait for it to finish
const run = await client.actor("datavault/convert-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://www.w3.org/WAI/ER/tests/xhtml/testfiles/resources/pdf/dummy.pdf" }] }

# Run the Actor and wait for it to finish
run = client.actor("datavault/convert-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://www.w3.org/WAI/ER/tests/xhtml/testfiles/resources/pdf/dummy.pdf"
    }
  ]
}' |
apify call datavault/convert-to-markdown --silent --output-dataset

```

## MCP server setup

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