Markdown Convert API
Sanitized HTML
GFM
Outlines

Markdown in. Safe HTML out.

Convert Markdown, HTML, and plaintext with sanitization, heading slugs, YAML front matter, and document outlines for content and RAG pipelines.

to-html · sanitizedoutline · headings + linksbatch · up to 251 MB · per field

Render Markdown to HTML, instantly.

This calls POST /to-html on the live Markdown Convert API. Preview the HTML source. It is not executed in the page.

Request builder
Markdown in, sanitized HTML source out.
POST /to-html

Live demo capped at 2,000 characters. HTML is shown as source, not injected.

Output preview
Live response from the API, plus the exact request to reproduce it.

Rendering HTML...

Why Markdown Convert API

Safe conversion for content pipelines.

Sanitized HTML by default

Markdown to HTML runs through an explicit allowlist. Raw HTML in Markdown is escaped unless you opt in.

Stable heading slugs

The same heading id appears in rendered HTML and in the outline, so anchors stay consistent.

Document outlines

Headings, classified links and images, code-block languages, word count, and reading time.

Plaintext for embeddings

Block structure as blank lines, optional wrap width, and stats ready for chunking pipelines.

Batch up to 25 documents

One POST /batch call with per-document targets of html, markdown, text, or outline.

No remote fetches

Input arrives in the body only. There is no URL fetch path and no SSRF surface.

/api/v1/markdown-convert

Endpoints, at a glance.

POST conversion targets plus a GET capabilities catalog. HTML is sanitized on every path.
POST/api/v1/markdown-convert/to-html

Markdown to HTML

Sanitized HTML with heading slug ids, front matter, footnotes, and stats.

PRIMARY
POST/api/v1/markdown-convert/to-markdown

HTML to Markdown

Turn HTML into GFM Markdown with configurable heading and list style.

POST/api/v1/markdown-convert/to-text

Plaintext

Markdown or HTML to plaintext with word count and reading time.

POST/api/v1/markdown-convert/outline

Outline

Headings, TOC, links, images, and code-block languages.

POST/api/v1/markdown-convert/batch

Batch

Up to 25 documents, each with its own target.

GET/api/v1/markdown-convert/capabilities

Capabilities

Targets, input limits, and GFM flavor.

ParameterTypeRequiredDescription
markdownstringyes*Required for to-html. One of markdown or html for to-text and outline.
htmlstringyes*Required for to-markdown. One of markdown or html for to-text and outline.
allowRawHtmlbooleannoSend embedded raw HTML through the sanitizer. Defaults to false.
headingIdsbooleannoAssign slug ids to headings. Defaults to true.
documentsarrayyes*1-25 documents for POST /batch, each with a target.

Error reference

Failures you can plan for.

Conversion errors include a correlationId and a structured error object.
400Validation Error

Missing, unknown, or invalid body field, or invalid JSON.

401Authentication Error

Missing or invalid gateway API key. Send x-api-key or api_key with every request.

413Payload Too Large

A field exceeds the 1 MB input limit.

422Unprocessable Entity

Malformed YAML front matter.

429Rate Limit Error

More than 120 requests in a 15-minute window.

Example error response

{
  "success": false,
  "error": "Invalid request body",
  "code": "invalid_json",
  "correlationId": "1784849006651-md01"
}

FAQ

API questions developers ask first.

Is the HTML output sanitized?

Yes. Every HTML path runs through an explicit allowlist. Raw HTML embedded in Markdown is escaped by default; set allowRawHtml=true to send it through the sanitizer instead.

Can I convert a batch of documents?

POST /batch accepts 1-25 documents, each with a target of html, markdown, text, or outline, and returns per-document results plus a summary.

Does outline include links and code blocks?

Yes. outline returns nested headings, a filtered TOC, classified links and images, code-block languages, word count, and reading time.

What is the input size limit?

Each field is capped at 1 MB. Oversized documents return 413. There is no remote URL fetch, so there is no SSRF surface.

How do I authenticate requests?

Send your Datpaq API key as an x-api-key header or an api_key query parameter. Keys are created in the Datpaq dashboard and a free tier is included.

Turn Markdown into HTML in one request.

CommonMark plus GFM tables, with YAML front matter parsed into a metadata object.