Authentication

All API requests (except /api/get-api-key and /api/templates) require an API key. Pass it in the Authorization header:

Authorization: Bearer dk_your_api_key_here

Or use the x-api-key header:

x-api-key: dk_your_api_key_here

Get an API Key

Create a free API key with no signup required:

POST /api/get-api-key

Request body (optional):
{
  "email": "you@example.com"
}

Response:
{
  "apiKey": "dk_a1b2c3d4e5f6...",
  "plan": "free",
  "planName": "Free",
  "limit": 100,
  "message": "Your free API key has been created..."
}

Generate PDF

The core endpoint — send a template name and JSON data, receive a PDF.

POST /api/generate-pdf

Headers:
  Authorization: Bearer dk_your_api_key
  Content-Type: application/json

Body:
{
  "template": "invoice",
  "data": { ... }
}

Response: application/pdf (binary)
Headers:
  X-Usage-Used: 43

Error Responses

// 400 — Missing or invalid parameters
{ "error": "missing_template", "message": "Field \"template\" is required" }

// 401 — No API key
{ "error": "unauthorized", "message": "API key required..." }

// 429 — Quota exceeded
{
  "error": "quota_exceeded",
  "message": "Monthly quota exceeded...",
  "used": 100,
  "plan": "free",
  "upgrade_url": "/#pricing"
}

Check Usage

Check your current monthly usage and plan details.

GET /api/check-usage

Headers:
  Authorization: Bearer dk_your_api_key

Response:
{
  "valid": true,
  "apiKey": "dk_xxx",
  "plan": "free",
  "planName": "Free",
  "used": 42,
  "limit": 100,
  "remaining": 58
}

List Templates

Get all available templates and their JSON schemas. No API key required.

GET /api/templates

Response:
{
  "templates": [
    {
      "name": "invoice",
      "description": "Professional invoice...",
      "fields": { ... }
    }
  ],
  "count": 5
}

Upgrade Plan

Initiate a Paddle checkout session for upgrading to a paid plan.

POST /api/create-checkout

Headers:
  Authorization: Bearer dk_your_api_key

Body:
{ "plan": "pro" }  // or "business"

Response:
{
  "checkoutUrl": "https://checkout.paddle.com/...",
  "transactionId": "txn_xxx"
}

Template Schemas

Invoice

{
  "company": { "name": "Acme Inc", "address": "123 St", "email": "b@acme.com", "phone": "+1..." },
  "client": { "name": "John Doe", "address": "456 Ave", "email": "john@example.com" },
  "invoice": { "number": "INV-001", "date": "June 15, 2026", "due_date": "June 30, 2026" },
  "items": [
    { "description": "Web Design", "quantity": 10, "unit_price": 75 }
  ],
  "tax_rate": 10,
  "notes": "Thank you for your business.",
  "currency_symbol": "$"
}

Receipt

{
  "company": { "name": "Acme Inc", "address": "123 St", "email": "b@acme.com" },
  "recipient": { "name": "John Doe", "email": "john@example.com" },
  "receipt": { "number": "RC-001", "date": "June 15, 2026", "payment_method": "Credit Card", "transaction_id": "txn_123" },
  "items": [
    { "description": "Web Design", "amount": 750.00 }
  ],
  "total": 750.00,
  "currency_symbol": "$"
}

Certificate

{
  "title": "Certificate of Completion",
  "subtitle": "This is to certify that",
  "recipient_name": "John Doe",
  "description": "has successfully completed the course...",
  "issuer": "Acme Academy",
  "issue_date": "June 15, 2026",
  "certificate_id": "CERT-2026-001",
  "signatory_name": "Jane Smith",
  "signatory_title": "Director"
}

Report

{
  "title": "Q2 2026 Business Report",
  "subtitle": "Financial Performance",
  "author": "Finance Dept",
  "date": "June 2026",
  "company": { "name": "Acme Inc" },
  "summary": "Executive summary text...",
  "sections": [
    {
      "heading": "Revenue",
      "content": "Paragraph text...",
      "metrics": [ { "label": "Revenue", "value": "$1.2M" } ]
    }
  ],
  "table": {
    "headers": ["Q1", "Q2"],
    "rows": [["$300K", "$350K"]]
  }
}

Contract

{
  "title": "Service Agreement",
  "effective_date": "June 1, 2026",
  "party_a": { "name": "Acme Inc", "address": "123 St", "role": "Provider" },
  "party_b": { "name": "John Doe", "address": "456 Ave", "role": "Client" },
  "clauses": [
    { "heading": "Scope of Services", "body": "The Provider agrees to..." }
  ],
  "company": { "name": "Acme Inc" }
}

Rate Limits & Plans

100

Free / month

1,000

Pro / month

Business / month

Usage counts reset on the first day of each calendar month. All plans include access to all templates.

Try it in the Playground →