---
title: "Convert to Markdown"
method: POST
path: "/api/v1/markdown/convert"
tags: ["markdown"]
---

# Convert to Markdown

`POST /api/v1/markdown/convert`

## Request

- Base URL: `https://docs.thedrive.ai` (the document declares no server; this is the origin it was published from)
- URL: `https://docs.thedrive.ai/api/v1/markdown/convert`
- Auth: none declared

Convert a file or URL to markdown.

**File Upload**: Use multipart/form-data with a `file` field.

**URL Fetch**: Provide a `url` field. For websites (HTML), uses a headless browser
to render the page before converting — handles JS-heavy sites.

**Supported formats**: PDF, DOCX, PPTX, XLSX, CSV, HTML, images, audio,
code files, and any URL via headless browser rendering.

## Headers

- `X-API-Key` string

## Response `200`

Successful Response

- MarkdownResponse: Response for markdown conversion.
  - `success` boolean
  - `markdown` string, required: Converted markdown content
  - `filename` string, required: Original filename or URL
  - `content_type` string, nullable: Detected MIME type
  - `content_length` integer, required: Length of the markdown output in characters
  - `pages` PageText[], nullable: With structure=true: a PDF's pages or a deck's slides
    - `number` integer, required: 1-based page or slide number
    - `markdown` string, required: The page's text (a scanned page's transcription)
  - `sheets` SheetText[], nullable: With structure=true: a workbook's sheets
    - `name` string, required
    - `index` integer, required: 0-based position in the workbook
    - `markdown` string, required: The sheet's values as a markdown table
  - `scanned_pages` integer[], nullable: With structure=true, for a PDF: the pages that are images of text (reported even with ocr=false)
  - `transcribed_pages` integer[], nullable: With structure=true, for a PDF: the pages whose text is a transcription of the image

## Other responses

- `400`: Invalid request
- `413`: File too large
- `422`: Validation Error

---

[API](https://skmtc.dev/thedrive/apis/the-drive-ai-api.md) · [All operations](https://skmtc.dev/thedrive/apis/the-drive-ai-api/llms.txt) · [OpenAPI document](https://skmtc.dev/thedrive/apis/the-drive-ai-api/revisions/ee4e32647ebf?raw)
