PDF Generation API v1 — Stateless

PDF Generation API
from business templates

Generate PDFs from your HTML, DOCX, Markdown or JSON templates. Zero data retention — no documents or data stored.

4 input formats
Variable substitution
Zero data storage
99.9% uptime SLA

Quick Start

Get your first PDF in under 2 minutes. Create an API key, send a request, and download the result.

1

Get your API key

Create an API key from the console below or from your dashboard.

Your API key is a secret. Never expose it in frontend code.
2

Send your first request

Use the following cURL command to generate a PDF:

Terminal
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.pdf
3

Download your PDF

The API returns the PDF binary directly in the response body.

The generated PDF is saved to the file specified in the --output flag.

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.

Sign in required

Please sign in to create and manage your API keys.

Authentication

All API requests require an API key sent via the X-API-Key header.

How it works

  1. Create an API key from the console or dashboard.
  2. Include it in every request as X-API-Key header.
  3. The API validates your key and checks your quota.
  4. Invalid or revoked keys return a 401 error.
Keep your API key secure. Use environment variables, never hardcode in source code.
Example request
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
Invalid key response (401)
{
  "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 Popular

Send 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
Request body
{
  "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

POST/generate/pdfAPI Key

Generate a PDF from HTML, Markdown, or Template JSON content.

Request Body (JSON)
ParameterTypeRequiredDescription
formatstringNo"html" (default), "markdown", "template"
contentstringYes*HTML or Markdown content string (required for html/markdown)
template_dataobjectYes*Template JSON object (required for template format)
variablesobjectNoKey-value pairs for variable substitution
optionsobjectNoPDF generation options (page format, margins, etc.)
Response
200Content-Type: application/pdf
4xx/5xxContent-Type: application/json
POST/generate/pdf/uploadAPI Key

Upload a DOCX file for conversion to PDF with optional variable replacement.

Form Fields
FieldTypeRequiredDescription
fileFileYesThe .docx file to convert
variablesstring (JSON)NoKey-value pairs for variable substitution
optionsstring (JSON)NoPDF options as JSON string
POST/generate/previewAPI Key

Generate a PNG preview of the first page instead of a full PDF.

200Content-Type: image/png
GET/usageAPI Key

Check your current monthly usage and remaining quota.

Response (200)
{
  "month": "2026-03",
  "used": 142,
  "limit": 500,
  "remaining": 358,
  "plan": "starter"
}
POST/keysJWT Bearer

Create a new API key (requires JWT authentication).

GET/keysJWT Bearer

List all your API keys with usage statistics.

DELETE/keys/:key_idJWT Bearer

Revoke (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 — HTML
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.pdf

Use 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 / DOCX

Contracts & Agreements

Fill Word templates with client data and convert to PDF for signing.

DOCX

Certificates & Diplomas

Create personalized certificates with precise layout and positioning.

Template JSON

Reports & Dashboards

Turn Markdown or HTML data into polished PDF reports.

Markdown / HTML

Letters & Mailings

Generate personalized letters from DOCX templates for bulk mailings.

DOCX

Compliance Documents

Produce audit-ready, tamper-proof compliance documents.

HTML

PDF Options

Customize the output with these optional parameters in the options object.

OptionTypeDefaultDescription
page_formatstring"A4"Page size: A4, Letter, Legal, Tabloid, or custom
landscapebooleanfalseEnable landscape orientation
margin_topstring"20mm"Top margin (CSS units: mm, cm, in, px)
margin_bottomstring"20mm"Bottom margin
margin_leftstring"15mm"Left margin
margin_rightstring"15mm"Right margin
header_htmlstringnullHTML content for page header
footer_htmlstringnullHTML content for page footer (supports pageNumber, totalPages)
themestring"modern"Markdown theme: modern, classic, minimal, github, academic

Full options example

JSON
{
  "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 response format
{
  "error": "missing_content",
  "message": "The 'content' field is required for html format."
}
HTTPErrorWhenWhat to do
400missing_contentRequired field missingCheck request body fields
400invalid_jsonJSON parsing failedValidate your JSON payload
400unsupported_formatUnknown format valueUse html, markdown, or template
401invalid_api_keyAPI key not foundVerify your X-API-Key header
402quota_exceededMonthly quota exceededUpgrade your plan or wait for reset
403api_key_revokedKey has been revokedCreate a new API key
429rate_limit_exceededRate limit hitWait and retry with exponential backoff
500generation_failedInternal processing errorCheck 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.

Rate-limited response
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.

PlanPDFs/monthRate limitPriceOverage
Starter50010/min9€/month0,02€/PDF
Business5 00030/min79€/month0,01€/PDF
EnterpriseCustomCustomOn quoteNegotiable

Best Practices

Follow these recommendations to get the most out of the API.

01

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.

02

Handle errors gracefully

Always check the HTTP status code. Implement retries with exponential backoff for 429 and 5xx errors.

03

Optimize your templates

Minimize CSS, avoid external assets (inline them), and test templates before deploying to production.

04

Monitor your usage

Use the /usage endpoint or the console above to track consumption and avoid unexpected quota limits.

05

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

9€/month
~0,018€ / PDF
  • 500 PDFs / month
  • 10 requests/min
  • All 4 input formats
  • PNG preview generation
  • Email support
  • Overage : 0,02€/PDF
Get Started

Enterprise

On quote
Negotiable
  • Custom volume
  • Custom rate limit
  • All Business features
  • Dedicated account manager
  • 99.9% uptime SLA
  • Setup & template onboarding
Contact Sales
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.