About this endpoint
What it does
Converts Markdown to HTML or HTML to Markdown, or detects the direction when you send plain text. Returns the converted content with the document title, a table of contents and size statistics.
Request Body
| Parameter | Type | Description |
|---|---|---|
| markdown | String | Markdown text to convert to HTML. Supports GitHub-style tables, task lists, strikethrough and fenced code. Max 1,000,000 characters. Send one of markdown, html or text. |
| html | String | HTML to convert to Markdown, either a whole page or a fragment. Max 1,000,000 characters. Send one of markdown, html or text. |
| text | String | Any text, used instead of markdown or html. The direction is detected automatically unless you set to. |
| to | ENUM | Target format when you send text. Allowed values: html, markdown, auto. Default: auto. |
| toc | Boolean | Markdown to HTML: return the table of contents with the level, text and anchor id of every heading. |
| fullPage | Boolean | Markdown to HTML: return a complete HTML page with doctype, <title> and readable CSS instead of a fragment. Default: false. |
| title | String | Markdown to HTML with fullPage: the page <title>. Default: the first H1. |
| mainContent | Boolean | HTML to Markdown: keep only the main article text and drop navigation, footers, sidebars and cookie banners. Default: false. |
Response
Returns a JSON object with count and items. items always holds one conversion result.
| Parameter | Type | Description |
|---|---|---|
| count | Integer | Number of results in items. Always 1. |
| items | Object Array | The conversion result. |
| items[].from | ENUM | Input format. Allowed values: markdown, html. |
| items[].to | ENUM | Output format. Allowed values: html, markdown. |
| items[].html | String | The converted HTML. Only present for Markdown to HTML. With fullPage, a complete HTML page. |
| items[].markdown | String | The converted Markdown. Only present for HTML to Markdown. |
| items[].content | ENUM | Only present for HTML to Markdown. Allowed values: main (only the main article was kept, mainContent), full (the whole page was converted). |
| items[].title | String | Document title: the title you sent, otherwise the first H1 (Markdown) or the page <title> (HTML). Document if none is found. |
| items[].toc | Object Array | Every heading in document order. |
| items[].toc[].id | String | Anchor id of the heading, e.g. hello-world. Repeated headings get a suffix, e.g. a-1. |
| items[].toc[].level | Integer | Heading level. Range: 1 to 6. |
| items[].toc[].text | String | Heading text. |
| items[].stats | Object | Size and content statistics. |
| items[].stats.inputChars | Integer | Characters in the input. |
| items[].stats.outputChars | Integer | Characters in the output. |
| items[].stats.words | Integer | Number of words. |
| items[].stats.headings | Integer | Number of headings. |
| items[].stats.links | Integer | Number of links. |
| items[].stats.images | Integer | Number of images. |
| items[].stats.tables | Integer | Number of tables. |
| items[].stats.codeBlocks | Integer | Number of code blocks. Only present for Markdown to HTML. |
| items[].stats.estTokensIn | Integer | Estimated LLM tokens in the input. |
| items[].stats.estTokensOut | Integer | Estimated LLM tokens in the output. |
| items[].warnings | String Array | Notes about the conversion, e.g. raw HTML tags in the Markdown that were kept as visible text. Only present when there is something to report. |
| items[].ms | Number | Conversion time in milliseconds. |
Notes
- Raw HTML inside Markdown is shown as text, and
javascript:anddata:links become#, so the HTML output is safe to embed. - Wrong types, values outside an enum, input over 1,000,000 characters, or a request with no
markdown,htmlortextreturn400withcodeinvalid_input,errorandmessage. These requests are not billed. - Input and output are not stored.



