API Documentation

Integrate HTML to Markdown conversion into your applications with our fast, reliable REST API

Base URL

Production:https://api.htmltomarkdown.io
Staging:https://api-staging.htmltomarkdown.io

Fast & Reliable

Global edge network with <100ms response time

Secure

Optional API key authentication & rate limiting

No Signup Required

Public endpoints available for immediate use

Health Check

GET/api/v1/health

Check API status and availability

Example Request

curl https://api.htmltomarkdown.io/api/v1/health

Example Response

{
  "success": true,
  "status": "healthy",
  "version": "1.0.0",
  "timestamp": "2025-11-05T14:51:56.532Z"
}

HTML to Markdown

POST/api/v1/public/convert

Convert HTML content to Markdown format

Request Body

{
  "html": "<h1>Hello World</h1><p>This is a <strong>test</strong>.</p>",
  "options": {
    "headingStyle": "atx",
    "bulletListMarker": "-",
    "codeBlockStyle": "fenced",
    "useGFM": true,
    "preserveTables": true
  }
}

Example Request

curl -X POST https://api.htmltomarkdown.io/api/v1/public/convert \
  -H "Content-Type: application/json" \
  -d '{
    "html": "<h1>Hello World</h1><p>Test</p>",
    "options": {
      "headingStyle": "atx",
      "useGFM": true
    }
  }'

Example Response

{
  "success": true,
  "markdown": "# Hello World\n\nTest",
  "requestId": "uuid-here",
  "metadata": {
    "processingTimeMs": 5,
    "inputSizeBytes": 42,
    "outputSizeBytes": 18,
    "elementsProcessed": 3
  }
}

URL to Markdown

POST/api/v1/public/convert-url

Fetch and convert HTML from a URL to Markdown

Request Body

{
  "url": "https://example.com",
  "options": {
    "headingStyle": "atx",
    "useGFM": true
  }
}

Example Request

curl -X POST https://api.htmltomarkdown.io/api/v1/public/convert-url \
  -H "Content-Type: application/json" \
  -d '{"url": "https://example.com"}'

Markdown to HTML

POST/api/v1/public/markdown-to-html

Convert Markdown content to HTML

Example Request

curl -X POST https://api.htmltomarkdown.io/api/v1/public/markdown-to-html \
  -H "Content-Type: application/json" \
  -d '{"markdown": "# Hello World"}'

Table Extraction

POST/api/v1/public/convert-table

Extract and convert HTML tables to Markdown format

Example Request

curl -X POST https://api.htmltomarkdown.io/api/v1/public/convert-table \
  -H "Content-Type: application/json" \
  -d '{"html": "<table><tr><td>Cell 1</td></tr></table>"}'

Conversion Options

OptionTypeDefaultDescription
headingStylestring"atx"Heading style: "atx" (#) or "setext"
bulletListMarkerstring"-"List marker: "-", "*", or "+"
codeBlockStylestring"fenced"Code block style: "fenced" or "indented"
useGFMbooleantrueEnable GitHub Flavored Markdown
preserveTablesbooleantrueConvert HTML tables to Markdown tables

Error Responses

All errors return a JSON response with the following structure:

{
  "success": false,
  "error": {
    "code": "error_code",
    "message": "Human-readable error message"
  },
  "requestId": "uuid-here"
}

Common Error Codes

  • invalid_request - Invalid request parameters
  • rate_limit_exceeded - Too many requests
  • internal_error - Server error
  • not_found - Endpoint not found

Rate Limits

Public Endpoints

  • • 100 requests per minute per IP
  • • 5 MB max HTML size
  • • No authentication required

Rate Limit Headers

  • X-RateLimit-Limit
  • X-RateLimit-Remaining
  • X-RateLimit-Reset

Code Examples

JavaScript / Node.js

const response = await fetch('https://api.htmltomarkdown.io/api/v1/public/convert', {
  method: 'POST',
  headers: {
    'Content-Type': 'application/json',
  },
  body: JSON.stringify({
    html: '<h1>Hello</h1>',
    options: { useGFM: true }
  })
});

const result = await response.json();
console.log(result.markdown);

Python

import requests

response = requests.post(
    'https://api.htmltomarkdown.io/api/v1/public/convert',
    json={
        'html': '<h1>Hello</h1>',
        'options': {'useGFM': True}
    }
)

result = response.json()
print(result['markdown'])

cURL

curl -X POST https://api.htmltomarkdown.io/api/v1/public/convert \
  -H "Content-Type: application/json" \
  -d '{"html":"<h1>Hello</h1>","options":{"useGFM":true}}'

Need Help?

Questions about the API? Check out our resources or get in touch