Markdown to PDF
v1.0REST API

API Documentation

Convert Markdown to PDF programmatically. Our REST API lets you generate professional, styled PDFs from Markdown content with a single HTTP request.

Quick Start

Generate a PDF in 30 seconds with a simple curl command.

1

Get your API key

Generate a key from your dashboard under API Keys.

2

Write Markdown

Any valid Markdown is supported — headings, lists, code blocks, tables, images.

3

Make the request

Send a POST request with your key and Markdown. Get back a PDF.

cURL
curl -X POST https://markdowntopdfconverter.com/api/v1/convert \
  -H "Authorization: Bearer mp_live_your_api_key_here" \
  -H "Content-Type: application/json" \
  -d '{"markdown": "# Hello World\n\nThis is a **test**.", "templateId": "clean"}' \
  -o output.pdf

Authentication

Authenticate every request with your secret API key, sent as a Bearer token in the Authorization header.

Request Header

HeaderValueDescription
AuthorizationBearer mp_live_...Your API key prefixed with Bearer
Content-Typeapplication/jsonRequired for all requests

Keys use the format mp_live_ followed by 32 hexadecimal characters. Create and revoke keys from your API keys dashboard.


POST /api/v1/convert

Convert Markdown to a styled PDF document.

Request Body

markdownstringRequired

The Markdown content to convert. Max 200,000 characters.

templateIdstringOptional

Template to use. One of: clean, executive, resume, coverletter, academic, legal, creative. Default: clean.

filenamestringOptional

Name for the downloaded PDF file. Default: document.pdf.

localestringOptional

Locale for rendering. One of: en, es, fr, de, ja, zh-CN, ko, pt-BR, ar, ru, hi, it. Default: en.

customTemplateIdUUIDOptional

UUID of a saved custom template. The template must be owned by the API key's user.

optionsobjectOptional

Conversion options: pageNumbers (boolean), bodyTextColor (hex), headingTextColor (hex), creativeAccent (slate|purple|blue|emerald|rose|amber).

Example Requests

Python
import requests

api_key = "mp_live_your_api_key_here"
headers = {
    "Authorization": f"Bearer {api_key}",
    "Content-Type": "application/json"
}
payload = {
    "markdown": "# Quarterly Report\n\n## Revenue\n\nRevenue grew **15%** this quarter.",
    "templateId": "executive",
    "options": {"pageNumbers": True}
}

response = requests.post(
    "https://markdowntopdfconverter.com/api/v1/convert",
    json=payload,
    headers=headers
)

with open("report.pdf", "wb") as f:
    f.write(response.content)
JavaScript
const response = await fetch(
  "https://markdowntopdfconverter.com/api/v1/convert",
  {
    method: "POST",
    headers: {
      Authorization: `Bearer ${apiKey}`,
      "Content-Type": "application/json",
    },
    body: JSON.stringify({
      markdown: "# Invoice\n\n**Amount:** $1,200\n\n| Item | Qty | Price |\n| --- | --- | --- |\n| Widget | 5 | $240 |",
      templateId: "clean",
      filename: "invoice",
    }),
  }
);

const blob = await response.blob();
const url = URL.createObjectURL(blob);

// Trigger download
const a = document.createElement("a");
a.href = url;
a.download = "invoice.pdf";
a.click();

Templates

Choose from seven professionally designed templates. Each template has distinct typography, spacing, and color schemes.

clean

Clean

Minimal, modern sans-serif design with clean spacing.

executive

Executive

Serif headings with professional navy accents and page numbers.

resume

Resume

Compact single-column layout optimized for resumes.

coverletter

Cover Letter

Elegant one-page letterhead that pairs with the resume.

academic

Academic

Numbered headings, generous spacing, and EB Garamond body.

legal

Legal

Double-spaced serif body with formal citation formatting.

creative

Creative

Bold DM Sans headings with configurable accent colors.


Error Codes

Every response uses a standard HTTP status code. Use it to decide how to handle the result.

StatusMeaningAction
200Success — PDF returnedDownload the PDF from the response body.
400Invalid request bodyCheck your JSON payload matches the schema above.
401Invalid or missing API keyVerify your API key is active and correctly formatted.
402API credits exhaustedPurchase more credits from your dashboard.
404Custom template not foundVerify the customTemplateId is correct and belongs to you.
415Wrong Content-TypeSet Content-Type header to application/json.
422Invalid conversion optionsCheck your options object matches the spec.
429Rate limitedWait and retry. Check the Retry-After header.
500Server errorRetry with exponential backoff. Contact support if persistent.

API Pricing

API calls are tracked monthly. Each successful conversion counts toward your tier's monthly limit.

Free

$0

25 / month

For testing and evaluation.

Starter

$9 / month

500 / month

For individuals and small projects.

Pro

$59 / year

1,000 / month

Priority generation, custom template support via API.

Credits

$5 one-time

250 calls

Top-up API credits. 250 calls, no expiration.

Need more? Contact us for custom enterprise pricing.