API Reference

Generate PDFs, manage documents and templates, and configure webhooks via REST API. Available on Business plan and above.

Base URL: https://quaterio.com/api/v1

Authentication

All API requests require a Bearer token in the Authorization header. Tokens use the q_ prefix and are verified via SHA-256 hash lookup.

# Include your API token in every request
curl https://quaterio.com/api/v1/documents \
-H "Authorization: Bearer q_your_api_token"

Generate API tokens in your Dashboard → Settings → API Tokens. API access requires a Business or Enterprise subscription.

PDF Generation

Generate PDFs from templates with variable replacement, raw HTML or Markdown. All endpoints accept page settings (margins, font family, columns, headers, footers) and support returnBlob: true for binary response.

POST/api/v1/generate/template

Generate a PDF from a template with variable replacement. Supports caching, print-ready output (CMYK, trim marks) and debug mode.

curl -X POST https://quaterio.com/api/v1/generate/template \ -H "Authorization: Bearer q_..." \ -H "Content-Type: application/json" \ -d '{ "templateId": "tmpl_invoice", "variables": { "company": "Acme Inc", "total": "$4,250.00" } }' # → { "ok": true, "data": { "downloadUrl": ".../invoice_en_a7f3b2c1.pdf" } }
POST/api/v1/generate/html

Generate a PDF from raw HTML. Accepts page settings for margins, font family, columns, headers and footers.

curl -X POST https://quaterio.com/api/v1/generate/html \ -H "Authorization: Bearer q_..." \ -H "Content-Type: application/json" \ -d '{ "html": "<h1>Hello World</h1><p>Your content here.</p>", "pageSize": "a4", "margins": { "top": 20, "right": 15, "bottom": 20, "left": 15 }, "fontFamily": "Inter", "columns": 1 }'
POST/api/v1/generate/markdown

Generate a PDF from Markdown. Converted to HTML internally, then rendered with the same engine.

curl -X POST https://quaterio.com/api/v1/generate/markdown \ -H "Authorization: Bearer q_..." \ -H "Content-Type: application/json" \ -d '{ "markdown": "# Report\n\nQuarterly summary...", "pageSize": "letter", "margins": { "top": 25, "right": 20, "bottom": 25, "left": 20 }, "header": { "content": "Quarterly Report", "isVisible": true } }'
POST/api/v1/generate/batch

Generate multiple PDFs from one template. Each row provides its own set of variables. Returns per-row success/failure status.

ParameterTypeDescription
templateIdrequiredstringID of the template to use
rowsrequiredarrayArray of variable objects. Each entry generates one PDF with its own variables. Business: max 100 rows. Enterprise: max 1,000
concurrencynumberParallel generation limit (default 5, max 20)
curl -X POST https://quaterio.com/api/v1/generate/batch \ -H "Authorization: Bearer q_..." \ -d '{ "templateId": "tmpl_invoice", "rows": [ { "company": "Acme Inc", "total": "$1,000" }, { "company": "Globex Corp", "total": "$2,500" } ], "concurrency": 5 }'

Resources

Create, list, read and delete documents and templates. All list endpoints support pagination and language filtering.

GET/api/v1/documents

List all documents in your organization. Supports pagination and language filtering.

POST/api/v1/documents

Create a new document.

ParameterTypeDescription
titlerequiredstringDocument title
languagestringLanguage code (defaults to organization default)
GET/api/v1/documents/:id

Get a single document by ID.

DELETE/api/v1/documents/:id

Delete a document.

POST/api/v1/documents/:id/duplicate

Duplicate a document with optional title and language override.

ParameterTypeDescription
titlestringTitle for the duplicate
languagestringLanguage for the duplicate
GET/api/v1/templates

List all templates in your organization. Supports pagination and language filtering.

POST/api/v1/templates

Create a new template.

ParameterTypeDescription
namerequiredstringTemplate name
languagestringLanguage code
GET/api/v1/templates/:id

Get a single template by ID.

DELETE/api/v1/templates/:id

Delete a template.

POST/api/v1/templates/:id/duplicate

Duplicate a template with optional name and language override.

ParameterTypeDescription
namestringName for the duplicate
languagestringLanguage for the duplicate

Webhooks

Get notified when events happen. Register a URL and select which events to subscribe to. Every payload is HMAC-SHA256 signed so you can verify authenticity.

GET/api/v1/webhooks

List all webhooks in your organization.

POST/api/v1/webhooks

Create a new webhook. Returns the signing secret once. Payloads include X-Quaterio-Signature (HMAC-SHA256) and X-Quaterio-Event headers.

ParameterTypeDescription
urlrequiredstringHTTPS URL to receive webhook events
eventsrequiredstring[]Events to subscribe to: document.created, document.deleted, document.exported, template.created, template.deleted, content.created, content.deleted
descriptionstringOptional label for this webhook (max 500 chars)
curl -X POST https://quaterio.com/api/v1/webhooks \ -H "Authorization: Bearer q_..." \ -H "Content-Type: application/json" \ -d '{ "url": "https://example.com/webhook", "events": ["document.exported", "template.created"], "description": "Production notifications" }' # → { "ok": true, "data": { "id": "...", "secret": "shown-only-once" } }
GET/api/v1/webhooks/:id

Get a single webhook by ID.

DELETE/api/v1/webhooks/:id

Delete a webhook.

Verifying webhook signatures

Each delivery includes two headers for verification:

HeaderDescription
X-Quaterio-SignatureHMAC-SHA256 of the raw body, prefixed with sha256=
X-Quaterio-EventThe event type, e.g. document.exported
const crypto = require('crypto'); const signature = req.headers['x-quaterio-signature']; const expected = 'sha256=' + crypto .createHmac('sha256', webhookSecret) .update(rawBody) .digest('hex'); const valid = crypto.timingSafeEqual( Buffer.from(signature), Buffer.from(expected), );

Errors

All errors return a consistent JSON structure with an error code and human-readable message.

{ "ok": false, "error": { "code": "VALIDATION_ERROR", "message": "templateId is required" } }
HTTP StatusDescription
400Validation error (missing or invalid parameters)
401Missing or invalid API token
403Insufficient tier (API requires Business or Enterprise)
404Resource not found
500Internal server error

Ready to integrate?

Sign up, create a template in the visual editor, generate your first PDF via API in about five minutes.