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.
Get your API key
Generate a key from your dashboard under API Keys.
Write Markdown
Any valid Markdown is supported — headings, lists, code blocks, tables, images.
Make the request
Send a POST request with your key and Markdown. Get back a PDF.
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.pdfAuthentication
Authenticate every request with your secret API key, sent as a Bearer token in the Authorization header.
Request Header
| Header | Value | Description |
|---|---|---|
| Authorization | Bearer mp_live_... | Your API key prefixed with Bearer |
| Content-Type | application/json | Required 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
markdownstringRequiredThe Markdown content to convert. Max 200,000 characters.
templateIdstringOptionalTemplate to use. One of: clean, executive, resume, coverletter, academic, legal, creative. Default: clean.
filenamestringOptionalName for the downloaded PDF file. Default: document.pdf.
localestringOptionalLocale for rendering. One of: en, es, fr, de, ja, zh-CN, ko, pt-BR, ar, ru, hi, it. Default: en.
customTemplateIdUUIDOptionalUUID of a saved custom template. The template must be owned by the API key's user.
optionsobjectOptionalConversion options: pageNumbers (boolean), bodyTextColor (hex), headingTextColor (hex), creativeAccent (slate|purple|blue|emerald|rose|amber).
Example Requests
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)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
Minimal, modern sans-serif design with clean spacing.
Executive
Serif headings with professional navy accents and page numbers.
Resume
Compact single-column layout optimized for resumes.
Cover Letter
Elegant one-page letterhead that pairs with the resume.
Academic
Numbered headings, generous spacing, and EB Garamond body.
Legal
Double-spaced serif body with formal citation formatting.
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.
| Status | Meaning | Action |
|---|---|---|
| 200 | Success — PDF returned | Download the PDF from the response body. |
| 400 | Invalid request body | Check your JSON payload matches the schema above. |
| 401 | Invalid or missing API key | Verify your API key is active and correctly formatted. |
| 402 | API credits exhausted | Purchase more credits from your dashboard. |
| 404 | Custom template not found | Verify the customTemplateId is correct and belongs to you. |
| 415 | Wrong Content-Type | Set Content-Type header to application/json. |
| 422 | Invalid conversion options | Check your options object matches the spec. |
| 429 | Rate limited | Wait and retry. Check the Retry-After header. |
| 500 | Server error | Retry with exponential backoff. Contact support if persistent. |
API Pricing
API calls are tracked monthly. Each successful conversion counts toward your tier's monthly limit.
$0
25 / month
For testing and evaluation.
$9 / month
500 / month
For individuals and small projects.
$59 / year
1,000 / month
Priority generation, custom template support via API.
$5 one-time
250 calls
Top-up API credits. 250 calls, no expiration.
Need more? Contact us for custom enterprise pricing.