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
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/v1/html-to-pdf
Convert raw HTML/CSS to a PDF documentCore
POST/v1/url-to-pdf
Convert a public URL to a PDF documentCore
POST/v1/templates/{id}/generate
Generate a PDF from a saved template with dataTemplates
GET/v1/templates
List all saved templatesTemplates
POST/v1/templates
Create a new reusable templateTemplates
POST/v1/merge
Merge multiple PDFs into one documentTools
POST/v1/compress
Compress a PDF to reduce file sizeTools
POST/v1/split
Split a PDF into multiple documentsTools
GET/v1/usage
Get current billing period usage statsAccount

Options Reference

ParameterTypeDescription
htmlstringHTML content to render
urlstringPublic URL to render
options.formatstringPage format: A4, Letter, Legal
options.landscapebooleanLandscape orientation
options.marginobjectPage margins in mm/in/px
options.printBackgroundbooleanPrint backgrounds
options.scalenumberScale factor (0.1–2)
options.headerTemplatestringHTML header template
options.footerTemplatestringHTML footer template
options.waitForstring|numberCSS selector or ms to wait
webhook_urlstringWebhook URL for async mode

Rate Limits

Developer

100 req/min
1,000/mo

Business

500 req/min
10,000/mo

Enterprise

Custom
Unlimited

Ready to generate PDFs?

Get your API key in seconds.