PDF Generation API
from business templates
Generate PDFs from your HTML, DOCX, Markdown or JSON templates. Zero data retention — no documents or data stored.
Quick Start
Get your first PDF in under 2 minutes. Create an API key, send a request, and download the result.
Get your API key
Create an API key from the console below or from your dashboard.
Send your first request
Use the following cURL command to generate a PDF:
curl -X POST ${API_URL}/api/v1/generate/pdf \
-H "X-API-Key: sk_live_YOUR_KEY_HERE" \
-H "Content-Type: application/json" \
-d '{
"format": "html",
"content": "<h1>Invoice #{{invoice_number}}</h1><p>Client: {{client_name}}</p><p>Amount: {{amount}}</p>",
"variables": {
"invoice_number": "2026-001",
"client_name": "Acme Corp",
"amount": "$1,250.00"
}
}' \
--output invoice.pdfDownload your PDF
The API returns the PDF binary directly in the response body.
Live Demo
Try the API right here — edit the content and variables, then hit Generate to see your PDF instantly.
Sign in to try the demo
Create a free account to access the live playground and generate up to 5 demo PDFs.
API Console
Manage your API keys and monitor usage directly from this page.
Authentication
All API requests require an API key sent via the X-API-Key header.
How it works
- Create an API key from the console or dashboard.
- Include it in every request as X-API-Key header.
- The API validates your key and checks your quota.
- Invalid or revoked keys return a 401 error.
curl -X POST ${API_URL}/api/v1/generate/pdf \
-H "X-API-Key: sk_live_abc123def456..." \
-H "Content-Type: application/json" \
-d '{"format":"html","content":"<h1>Hello</h1>"}' \
--output output.pdf{
"error": "invalid_api_key",
"message": "The provided API key is invalid."
}Input Formats
EasyPDF supports 4 input formats. Choose the one that best fits your workflow.
HTML
Full CSS support, pixel-perfect via Chromium
DOCX
Upload Word templates with variable placeholders
Markdown
5 built-in themes for beautiful documents
Template JSON
Canvas engine for precise layout control
HTML → PDF
Most PopularSend any HTML with inline CSS. The Chromium rendering engine ensures pixel-perfect output matching browser display.
Key Features
- Full CSS3 support (Flexbox, Grid, media queries)
- Custom headers & footers with page numbers
- Variable substitution with {{variable}} syntax
- Responsive layouts with A4/Letter/Legal page sizes
{
"format": "html",
"content": "<html><head><style>body{font-family:Arial;padding:40px}h1{color:#333}.total{font-size:24px;font-weight:bold;color:#8b5cf6}</style></head><body><h1>Invoice #{{invoice_number}}</h1><p>Date: {{date}}</p><p>Client: {{client_name}}</p><table><tr><th>Item</th><th>Price</th></tr><tr><td>{{item_1}}</td><td>{{price_1}}</td></tr></table><p class='total'>Total: {{total}}</p></body></html>",
"variables": {
"invoice_number": "2026-042",
"date": "2026-03-16",
"client_name": "Acme Corp",
"item_1": "Web Development",
"price_1": "$3,500",
"total": "$4,700"
},
"options": { "page_format": "A4", "margin_top": "25mm" }
}API Endpoints
Base URL: ${API_URL}/api/v1
/generate/pdfAPI KeyGenerate a PDF from HTML, Markdown, or Template JSON content.
Request Body (JSON)
| Parameter | Type | Required | Description |
|---|---|---|---|
format | string | No | "html" (default), "markdown", "template" |
content | string | Yes* | HTML or Markdown content string (required for html/markdown) |
template_data | object | Yes* | Template JSON object (required for template format) |
variables | object | No | Key-value pairs for variable substitution |
options | object | No | PDF generation options (page format, margins, etc.) |
Response
Content-Type: application/pdfContent-Type: application/json/generate/pdf/uploadAPI KeyUpload a DOCX file for conversion to PDF with optional variable replacement.
Form Fields
| Field | Type | Required | Description |
|---|---|---|---|
file | File | Yes | The .docx file to convert |
variables | string (JSON) | No | Key-value pairs for variable substitution |
options | string (JSON) | No | PDF options as JSON string |
/generate/previewAPI KeyGenerate a PNG preview of the first page instead of a full PDF.
Content-Type: image/png/usageAPI KeyCheck your current monthly usage and remaining quota.
{
"month": "2026-03",
"used": 142,
"limit": 500,
"remaining": 358,
"plan": "starter"
}/keysJWT BearerCreate a new API key (requires JWT authentication).
/keysJWT BearerList all your API keys with usage statistics.
/keys/:key_idJWT BearerRevoke (deactivate) an API key permanently.
Code Examples
Complete, ready-to-use examples in your preferred language and format. Select a language and input format below.
curl -X POST ${API_URL}/api/v1/generate/pdf \
-H "X-API-Key: $API_KEY" \
-H "Content-Type: application/json" \
-d '{
"format": "html",
"content": "<html><head><style>body{font-family:sans-serif;padding:40px}h1{color:#8b5cf6}table{width:100%;border-collapse:collapse}th,td{padding:8px 12px;border-bottom:1px solid #eee}</style></head><body><h1>Invoice #{{invoice_number}}</h1><p>Client: <strong>{{client_name}}</strong></p><table><tr><th>Item</th><th>Amount</th></tr><tr><td>{{line_1}}</td><td>{{amount_1}}</td></tr></table><h2>Total: {{total}}</h2></body></html>",
"variables": {
"invoice_number": "INV-2026-042",
"client_name": "Acme Corp",
"line_1": "Web Development",
"amount_1": "$3,500.00",
"total": "$4,700.00"
},
"options": { "page_format": "A4", "margin_top": "20mm" }
}' --output invoice.pdfUse Cases
See how teams use the EasyPDF API to automate document generation at scale.
Invoices & Receipts
Generate branded invoices with dynamic line items, totals, and client details.
HTML / DOCXContracts & Agreements
Fill Word templates with client data and convert to PDF for signing.
DOCXCertificates & Diplomas
Create personalized certificates with precise layout and positioning.
Template JSONReports & Dashboards
Turn Markdown or HTML data into polished PDF reports.
Markdown / HTMLLetters & Mailings
Generate personalized letters from DOCX templates for bulk mailings.
DOCXCompliance Documents
Produce audit-ready, tamper-proof compliance documents.
HTMLPDF Options
Customize the output with these optional parameters in the options object.
| Option | Type | Default | Description |
|---|---|---|---|
page_format | string | "A4" | Page size: A4, Letter, Legal, Tabloid, or custom |
landscape | boolean | false | Enable landscape orientation |
margin_top | string | "20mm" | Top margin (CSS units: mm, cm, in, px) |
margin_bottom | string | "20mm" | Bottom margin |
margin_left | string | "15mm" | Left margin |
margin_right | string | "15mm" | Right margin |
header_html | string | null | HTML content for page header |
footer_html | string | null | HTML content for page footer (supports pageNumber, totalPages) |
theme | string | "modern" | Markdown theme: modern, classic, minimal, github, academic |
Full options example
{
"format": "html",
"content": "<h1>Report</h1><p>Content here...</p>",
"variables": {},
"options": {
"page_format": "A4",
"landscape": false,
"margin_top": "25mm",
"margin_bottom": "25mm",
"margin_left": "20mm",
"margin_right": "20mm",
"header_html": "<div style='text-align:right;font-size:9px'>Acme Corp — Confidential</div>",
"footer_html": "<div style='text-align:center;font-size:9px'>Page <span class='pageNumber'></span> / <span class='totalPages'></span></div>",
"theme": "modern"
}
}Error Handling
The API returns structured JSON errors with consistent error codes.
{
"error": "missing_content",
"message": "The 'content' field is required for html format."
}| HTTP | Error | When | What to do |
|---|---|---|---|
400 | missing_content | Required field missing | Check request body fields |
400 | invalid_json | JSON parsing failed | Validate your JSON payload |
400 | unsupported_format | Unknown format value | Use html, markdown, or template |
401 | invalid_api_key | API key not found | Verify your X-API-Key header |
402 | quota_exceeded | Monthly quota exceeded | Upgrade your plan or wait for reset |
403 | api_key_revoked | Key has been revoked | Create a new API key |
429 | rate_limit_exceeded | Rate limit hit | Wait and retry with exponential backoff |
500 | generation_failed | Internal processing error | Check your content for errors and retry |
Rate Limits & Quotas
Each plan has a monthly PDF quota and a per-minute rate limit.
Rate Limiting
Requests exceeding your rate limit receive a 429 response with a Retry-After header.
HTTP/1.1 429 Too Many Requests Retry-After: 12 Content-Type: application/json
Monthly Quotas
Usage resets on the 1st of each month at midnight UTC.
| Plan | PDFs/month | Rate limit | Price | Overage |
|---|---|---|---|---|
| Starter | 500 | 10/min | 9€/month | 0,02€/PDF |
| Business | 5 000 | 30/min | 79€/month | 0,01€/PDF |
| Enterprise | Custom | Custom | On quote | Negotiable |
Best Practices
Follow these recommendations to get the most out of the API.
Use variables for dynamic content
Keep your templates static and inject data through the variables object. This is more efficient than rebuilding HTML on every call.
Handle errors gracefully
Always check the HTTP status code. Implement retries with exponential backoff for 429 and 5xx errors.
Optimize your templates
Minimize CSS, avoid external assets (inline them), and test templates before deploying to production.
Monitor your usage
Use the /usage endpoint or the console above to track consumption and avoid unexpected quota limits.
Secure your API keys
Store keys in environment variables or secret managers. Rotate keys periodically and revoke unused ones.
Pricing
Simple, transparent pricing. Pay only for what you use.
Starter
- 500 PDFs / month
- 10 requests/min
- All 4 input formats
- PNG preview generation
- Email support
- Overage : 0,02€/PDF
Business
- 5 000 PDFs / month
- 30 requests/min
- All Starter features
- Priority support
- Usage analytics dashboard
- Overage : 0,01€/PDF
Enterprise
- Custom volume
- Custom rate limit
- All Business features
- Dedicated account manager
- 99.9% uptime SLA
- Setup & template onboarding
Setup & Onboarding
Need help setting up your templates? We offer paid onboarding sessions to help you design, test and optimize your templates for production.
Up to 65% cheaper than comparable document generation APIs.
Ready to start generating PDFs?
Create your API key and send your first request in under 2 minutes.