Developer API
API Documentation
Generate pixel-perfect PDFs from HTML, CSS, and templates. RESTful API with full CSS3 support and real browser rendering.
Quick Start
1
Get your API key
Sign up for a free account and generate your API key from the dashboard.
# Your API key
sk_live_aBcDeFgHiJkLmNoPqRsTuVwXyZ123456
sk_live_aBcDeFgHiJkLmNoPqRsTuVwXyZ123456
2
Make your first request
curl -X POST https://api.sublimepdf.com/v1/html-to-pdf \
-H "Authorization: Bearer YOUR_API_KEY" \
-H "Content-Type: application/json" \
-o output.pdf \
-d '{
"html": "<h1>Hello, World!</h1>",
"options": {
"format": "A4",
"printBackground": true,
"margin": { "top": "20mm", "bottom": "20mm" }
}
}'3
Use with Node.js
const response = await fetch(
'https://api.sublimepdf.com/v1/html-to-pdf',
{
method: 'POST',
headers: {
'Authorization': `Bearer ${process.env.SUBLIMEPDF_API_KEY}`,
'Content-Type': 'application/json',
},
body: JSON.stringify({
html: invoiceTemplate,
data: { company: 'Acme Corp', total: '$10,000.00' },
options: { format: 'A4', printBackground: true }
})
}
);
const pdf = await response.blob();API Endpoints
POST
Convert raw HTML/CSS to a PDF documentCore/v1/html-to-pdfPOST
Convert a public URL to a PDF documentCore/v1/url-to-pdfPOST
Generate a PDF from a saved template with dataTemplates/v1/templates/{id}/generateGET
List all saved templatesTemplates/v1/templatesPOST
Create a new reusable templateTemplates/v1/templatesPOST
Merge multiple PDFs into one documentTools/v1/mergePOST
Compress a PDF to reduce file sizeTools/v1/compressPOST
Split a PDF into multiple documentsTools/v1/splitGET
Get current billing period usage statsAccount/v1/usageOptions Reference
| Parameter | Type | Description |
|---|---|---|
html | string | HTML content to render |
url | string | Public URL to render |
options.format | string | Page format: A4, Letter, Legal |
options.landscape | boolean | Landscape orientation |
options.margin | object | Page margins in mm/in/px |
options.printBackground | boolean | Print backgrounds |
options.scale | number | Scale factor (0.1–2) |
options.headerTemplate | string | HTML header template |
options.footerTemplate | string | HTML footer template |
options.waitFor | string|number | CSS selector or ms to wait |
webhook_url | string | Webhook URL for async mode |
Rate Limits
Developer
100 req/min
1,000/mo
Business
500 req/min
10,000/mo
Enterprise
Custom
Unlimited