API Documentation

Use our API to convert between Markdown and HTML programmatically

Markdown to HTML Conversion

Endpoint

POST /api/md-to-html

Request Format

Send a JSON object with the following structure:

{
  "markdown": "# Your Markdown content here"
}

Response Format

{
  "html": "<h1>Your Markdown content here</h1>"
}

Example Usage

cURL
curl -X POST \
  -H "Content-Type: application/json" \
  -d '{"markdown": "# Hello World"}' \
  https://markdownplease.com/api/md-to-html
JavaScript
fetch('https://markdownplease.com/api/md-to-html', {
  method: 'POST',
  headers: {
    'Content-Type': 'application/json'
  },
  body: JSON.stringify({
    markdown: '# Hello World'
  })
})
.then(response => response.json())
.then(data => {
  console.log(data.html); // "<h1>Hello World</h1>"
});
Python
import requests
import json

response = requests.post(
    'https://markdownplease.com/api/md-to-html',
    headers={'Content-Type': 'application/json'},
    data=json.dumps({'markdown': '# Hello World'})
)

data = response.json()
print(data['html'])  # "<h1>Hello World</h1>"

HTML to Markdown Conversion

Endpoint

POST /api/html-to-md

Request Format

Send a JSON object with the following structure:

{
  "html": "<h1>Your HTML content here</h1>"
}

Response Format

{
  "markdown": "# Your HTML content here"
}

Example Usage

cURL
curl -X POST \
  -H "Content-Type: application/json" \
  -d '{"html": "<h1>Hello World</h1>"}' \
  https://markdownplease.com/api/html-to-md
JavaScript
fetch('https://markdownplease.com/api/html-to-md', {
  method: 'POST',
  headers: {
    'Content-Type': 'application/json'
  },
  body: JSON.stringify({
    html: '<h1>Hello World</h1>'
  })
})
.then(response => response.json())
.then(data => {
  console.log(data.markdown); // "# Hello World"
});
Python
import requests
import json

response = requests.post(
    'https://markdownplease.com/api/html-to-md',
    headers={'Content-Type': 'application/json'},
    data=json.dumps({'html': '<h1>Hello World</h1>'})
)

data = response.json()
print(data['markdown'])  # "# Hello World"

Error Handling

All API endpoints return appropriate HTTP status codes:

  • 200 OK - The request was successful.
  • 400 Bad Request - The request was malformed or missing required parameters.
  • 500 Internal Server Error - An error occurred on the server.

Error responses will include an error message in the following format:

{
  "error": "Error message details"
}