Skip to main content

Document to Markdown

Parse PDFs, images, and Office documents into Markdown using the Azure Document Intelligence prebuilt-layout model, which recognizes heading hierarchy, paragraphs, lists, tables, and images.

Files are uploaded via multipart/form-data and the conversion result is returned inline as Markdown. This is ideal for "convert and use" scenarios such as RAG preprocessing, knowledge base ingestion, and document content extraction.

Supported Formats

CategoryExtensions
PDFpdf
Imagesjpeg / jpg, png, bmp, tiff / tif, heif
Officedocx, xlsx, pptx

Uploads with unsupported extensions (e.g., .txt, .md) will be rejected.

Image Extraction

Images in the document are extracted by Azure and returned base64-encoded inline in figures[]. Each image has a placeholder in the markdown body (e.g., ![figure 1.2](figure://1.2)) that corresponds 1:1 to an object in figures[]. When rendering, you can replace the placeholder with the actual image (using data_base64), or simply ignore the placeholder and keep only the text.

Authentication

Consistent with other platform endpoints, use Authorization: Bearer $TURING_API_KEY. When uploading via multipart/form-data, do not set Content-Type manually — let the HTTP client automatically generate the request header with the boundary.

Quick Start

curl $TURING_BASE_URL/documents/azure/document2md \
-H "Authorization: Bearer $TURING_API_KEY" \
-F "files=@report.pdf" \
-F "files=@slides.pptx"

Response Example

{
"trace_id": "trace-xxxxx",
"code": 0,
"at": "2026-06-08T08:00:00.000Z",
"message": "Success",
"data": {
"results": [
{
"file_name": "report.md",
"status": "succeeded",
"markdown": "# Quarterly Report\n\n## Overview\n\n...\n\n![figure 1.2](figure://1.2)\n",
"pages_processed": 8,
"figures": [
{
"id": "1.2",
"placeholder": "![figure 1.2](figure://1.2)",
"content_type": "image/png",
"data_base64": "iVBORw0KGgoAAAANSUhEUgAA..."
}
]
}
],
"total_pages_processed": 8
}
}

See also