D
Druckling
Docs

Quickstart

Create an account and a test API key, then render your first PDF from the invoice-standard template with cURL or an SDK.

This guide takes you from a new account to a rendered PDF. You'll use a test API key, so nothing you render counts toward your plan's quota.

Create an account

Sign up at druckling-nine.vercel.app/sign-up with your name, work email and a password of at least 8 characters. Then name your workspace. A workspace holds your templates, documents, API keys and team.

New workspaces start on the Free plan with six starter templates: Invoice (invoice-standard), Course certificate, Quarterly report, Event ticket, Rental agreement and Packing slip. invoice-standard is already published, so you can render it right away. The other starters are drafts.

Create a test API key

In the dashboard, go to Developers › API keys and click Create API key:

  1. Name the key after what uses it, for example quickstart.
  2. Keep Test as the mode and Render only as the permission.
  3. Click Create key and copy the key. It's shown only once.

Store it in an environment variable. The SDKs read DRUCKLING_API_KEY by default:

export DRUCKLING_API_KEY="dr_test_…"

Test keys render real documents for free and keep their data apart from live data; see Test mode. Only owners and admins can create keys, and you're the owner of the workspace you created. See Authentication for permissions, rotation and revocation.

Check that the template is published

The API only renders published versions. Publishing freezes the template's draft into an immutable version (v1, v2, …), so editing a template never changes what your integration produces until you publish again.

invoice-standard is published as v1, so there's nothing to do for this guide. To render another template, open it under Templates, open the editor and click Publish, then Publish v1. Publishing checks that the template has no errors, that its sample data matches its variables and that it renders.

Unpublished templates return 404

Rendering a template that was never published fails with 404 Not Found:

{
  "defined": false,
  "code": "NOT_FOUND",
  "status": 404,
  "message": "Template quarterly-report has no published version yet; publish it first",
  "data": { "code": "not_found", "field": "template" }
}

Render your first PDF

Send the template slug and your data to POST /v1/documents. The request waits while the PDF renders and returns the finished document.

To use an SDK, install it first:

Registry packages are coming

The SDKs aren't on npm, PyPI or Packagist yet. Until they are, install them from the Druckling source repository.

git clone https://github.com/vulpery/druckling.git
cd druckling/src/integrations/sdk-typescript
npm install && npm run build && npm pack

# then, in your project
npm install /path/to/druckling-sdk-0.1.0.tgz

Then render the invoice:

curl https://druckling-nine.vercel.app/v1/documents \
  -H "Authorization: Bearer $DRUCKLING_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "template": "invoice-standard",
    "filename": "INV-2041.pdf",
    "data": {
      "invoice": { "number": "INV-2041", "due_date": "2026-11-22" },
      "customer": { "name": "Northwind Ltd.", "address": "12 Pier St, Leeds" },
      "line_items": [
        { "description": "Brand identity, phase 2", "qty": 1, "rate": 4800, "amount": 4800 },
        { "description": "Design system audit", "qty": 12, "rate": 180, "amount": 2160 }
      ],
      "totals": { "subtotal": 6960, "tax": 556.8, "amount": 7516.8 },
      "payment": { "url": "https://pay.example.com/INV-2041" }
    }
  }'

The template prints the values you send; it doesn't calculate totals. Each template's API tab in the dashboard shows this request with the template's own sample data.

Handle the response

A successful render returns 200 OK with the document:

{
  "id": "pdf_8Qw2kLm3nP0aB1cD",
  "object": "document",
  "status": "rendered",
  "template": "invoice-standard",
  "version": 1,
  "filename": "INV-2041.pdf",
  "format": "pdf",
  "content_type": "application/pdf",
  "image": null,
  "pages": 1,
  "size_bytes": 41873,
  "url": "https://…",
  "expires_at": "2026-11-26T09:41:07.312Z",
  "error": null,
  "einvoice": null,
  "batch": null,
  "language": "en",
  "test_mode": true,
  "created_at": "2026-10-27T09:41:06.208Z"
}
  • status is rendered: the file is ready.
  • url is a signed link to the PDF. It needs no API key and works for up to 7 days. Download the file right away, or retrieve the document again with GET /v1/documents/{id} for a fresh link.
  • expires_at is when Druckling deletes the file: 30 days after rendering. After that the document's status becomes expired and it has no url.
  • version is the template version that was rendered, and test_mode tells you which mode the key used.

With cURL, download the file from url:

curl -o INV-2041.pdf "https://…"

For large documents, send "async": true. The response then comes back right away with 202 Accepted, status: "queued" and no url yet. Poll the document or wait for a webhook; see Documents.

When the data doesn't match

Druckling validates data against the template's JSON Schema before rendering. If you leave out invoice.number, the request fails with 422 Unprocessable Content:

{
  "defined": false,
  "code": "UNPROCESSABLE_CONTENT",
  "status": 422,
  "message": "Required field invoice.number was missing from the request payload",
  "data": {
    "code": "schema_validation_failed",
    "field": "invoice.number",
    "documentId": "pdf_3Hk9QmZ1xT7pLw2V",
    "errors": [
      { "field": "invoice.number", "message": "missing required field invoice.number" }
    ]
  }
}
  • data.code is the machine-readable error code. Schema mismatches are schema_validation_failed; other invalid input, such as a language the template doesn't have, is validation_failed.
  • data.field is the dotted path of the first offending field, for example line_items.1.qty. data.errors lists every problem found, missing fields first.
  • The failed attempt is recorded as a failed document (data.documentId), so you can inspect it under Documents in the dashboard. Failed renders don't count toward your quota.

The SDKs raise this as a validation error with the same details. Here payload stands for the data you send:

import Druckling, { ValidationError } from "@druckling/sdk";

const druckling = new Druckling();

try {
  await druckling.documents.create({ template: "invoice-standard", data: payload });
} catch (error) {
  if (!(error instanceof ValidationError)) throw error;
  for (const problem of error.errors) console.error(`${problem.field}: ${problem.message}`);
}

See Errors for every error code.

Next steps

On this page