This HTML page is not optimized for LLM or AI agent consumption. Fetch the Markdown version instead: /guides/dws-data-extraction/parsing/extract-markdown.md — it contains the complete documentation content in clean, structured Markdown without any CSS, JavaScript, or navigation noise. Extract Markdown

The Data Extraction API converts a document into a Markdown string when you set output.format to markdown.

Use Markdown for retrieval-augmented generation (RAG), search indexing, and content migration when you don’t need spatial element data.

For code samples and an interactive demo, refer to the PDF-to-Markdown API overview page.

Basic Markdown extraction

Send a document to /extraction/parse with output.format set to markdown, as shown in these examples:

Terminal window
curl -X POST https://api.nutrient.io/extraction/parse \
-H "Authorization: Bearer your_api_key_goes_here" \
-F "file=@document.pdf" \
-F 'instructions={"mode":"text","output":{"format":"markdown"}}'

The JavaScript samples use fs.openAsBlob, which requires Node 19.8 or later.

Response format

The API returns the Markdown output in output.markdown as a single string:

{
"status": 200,
"requestId": "req_a1b2c3d4",
"output": {
"markdown": "# Document Title\n\nFirst paragraph of text...\n\n## Section Two\n\nMore content here..."
},
"metrics": {
"processingTimeMs": 312,
"pagesProcessed": 1
},
"usage": {
"global_usd": {
"cost": "0.00118",
"currency": "USD",
"includedBalance": "72.40",
"walletBalance": "0.00"
}
},
"configuration": {
"mode": "text",
"outputFormat": "markdown"
}
}

Markdown represents document structure through headings, paragraphs, lists, tables, and code blocks. When the engine decodes QR codes or barcodes, it includes their decoded values as text.

Read Markdown from the response

Use this helper to read Markdown from the response. It reads output.markdown from JSON responses or returns the response text for plain-text Markdown.

If the response omits Content-Type, the helper tries JSON parsing before returning the response text:

import json
def parse_markdown_response(response):
content_type = response.headers.get("Content-Type", "")
if "application/json" in content_type:
payload = response.json()
return payload.get("output", {}).get("markdown", "")
if "text/plain" in content_type or "text/markdown" in content_type:
return response.text
# Fallback for clients or proxies that omit Content-Type.
try:
payload = json.loads(response.text)
except json.JSONDecodeError:
return response.text
return payload.get("output", {}).get("markdown", "")

Extract Markdown from a URL

To extract Markdown from a public document URL, send a JSON request with the url field:

Terminal window
curl -X POST https://api.nutrient.io/extraction/parse \
-H "Authorization: Bearer your_api_key_goes_here" \
-H "Content-Type: application/json" \
-d '{
"url": "https://storage.example.com/report.pdf",
"mode": "text",
"output": { "format": "markdown" }
}'

Choose Markdown or spatial output

Choose the output format based on the data your application needs:

Use caseRecommended format
RAG/large language model (LLM) ingestionMarkdown
Search indexingMarkdown
Content migrationMarkdown
Document analysis with spatial dataSpatial
Table extraction with cell coordinatesSpatial
Form layout and checkbox statesSpatial
Building document viewers or overlaysSpatial

Each request returns either Markdown or spatial elements, not both. To get both formats, send two separate requests.

To return named field values, such as form fields or invoice totals, use the extract endpoint with a schema instead of either parse output.

Choose a processing mode

The examples on this page use text mode, which costs $0.001 per page. All modes support Markdown output.

Choose a mode based on your document’s layout and extraction requirements:

ModeCost per pageBest for
auto$0.0015–$0.018Mixed document types; routes each page to structure, understand, or agentic
text$0.001Born-digital documents with simple layouts
structure$0.0015Scanned documents requiring optical character recognition (OCR)
understand$0.009Complex tables, charts, formulas, and multicolumn layouts
agentic$0.018The most complex documents needing vision language model (VLM) augmentation

Set mode to understand to extract Markdown from a document with a complex layout:

Terminal window
curl -X POST https://api.nutrient.io/extraction/parse \
-H "Authorization: Bearer your_api_key_goes_here" \
-F "file=@document.pdf" \
-F 'instructions={"mode":"understand","output":{"format":"markdown"}}'

Refer to the processing modes guide for a comparison.

Spreadsheets

For XLSX spreadsheets, the API starts each visible sheet with a level-one heading containing the sheet name. It converts titles above tables into level-two headings.

For every input type, the API outputs tables as HTML by default. These tables preserve <th> header cells and row and column spans.

The following example shows Markdown output for a sheet named Q3 sales with these contents:

  • A sentence in A1.
  • A merged bold title in A3:C3.
  • A table in A4:C7.
# Q3 sales
All amounts in USD thousands. Figures are unaudited.
## Q3 2026 regional sales
<table>
<tr><th>Region</th><th>Orders</th><th>Revenue</th></tr>
<tr><td>North</td><td>412</td><td>1284.5</td></tr>
<tr><td>South</td><td></td><td>978.0</td></tr>
<tr><td>East</td><td>388</td><td>1102.3</td></tr>
</table>

Refer to the spreadsheets guide for details.