Product and API guide

Quick start

Five minutes to your first document

This page takes you from nothing to a PDF on disk. It uses the Invoice template that every workspace starts with, so there is nothing to design first.

1. Your key

Create a key under Account → API keys. The secret is shown once; keep it out of your source. Every call carries it in the X-PDFgine-Key header.

cURL
# The key lives in the environment, not in the code
export PDFGINE_KEY="pdfgine_live_..."

# Does it work? This lists your templates
curl https://api.pdfgine.com/api/v1/templates \
  -H "X-PDFgine-Key: $PDFGINE_KEY"

2. Produce a document

One call with the template code and your data. The answer is 202 with a documentId and a download URL.

cURL
curl -X POST https://api.pdfgine.com/api/v1/render \
  -H "X-PDFgine-Key: $PDFGINE_KEY" \
  -H "Content-Type: application/json" \
  -d '{
        "templateCode": "invoice",
        "format": "pdf",
        "locale": "en",
        "data": {
          "document": { "title": "Invoice Summary" },
          "referenceNo": "DOC-2026-0042",
          "issueDate": "2026-09-06",
          "currency": "USD",
          "customer": "Northwind Trading Ltd.",
          "lineItems": [
            { "name": "Fault diagnosis", "quantity": 2, "unitPrice": 850.00 }
          ]
        }
      }'

While you are trying a template out, send "purpose": "editor-test": that output never touches your quota and uses the unpublished draft.

3. Download it

The download URL from the response is relative to the API address and is fetched with the same key. Ask for docx instead of pdf and the same data comes back as a Word file.

cURL
curl https://api.pdfgine.com/api/v1/documents/doc_a96063f5dcd5400286ce9b3be9b0595b/download/pdf \
  -H "X-PDFgine-Key: $PDFGINE_KEY" \
  -o invoice.pdf

What usually goes wrong first

  • 402 means the monthly page quota is spent; the X-PDFgine-Quota-Remaining header tells you before you get there.
  • 422 means your data does not satisfy the template. The body names every missing field under errors, so you do not have to guess which one.
  • Render answers 202, not 200. A client that treats anything other than 200 as a failure will report success as an error.

Where to go next

Data formats is the page you will come back to most: it says exactly how a date, an amount and a currency have to arrive.

Data formats →