D
Druckling
Docs

Authentication

Authenticate API requests with a secret API key, choose its mode and permission, and rotate or revoke it safely.

Every request to the Druckling API is authenticated with a secret API key. A key belongs to one workspace and decides three things: which workspace the request acts in, whether it runs in live or test mode, and what it's allowed to do.

Send your API key

Send the key in the Authorization header with the Bearer scheme:

curl https://druckling-nine.vercel.app/v1/documents \
  -H "Authorization: Bearer $DRUCKLING_API_KEY"

Both headers work the same way. If a request has both, the Authorization: Bearer header is used. The SDKs send Authorization: Bearer and read the key from the DRUCKLING_API_KEY environment variable unless you pass one explicitly. See SDKs.

The same keys authenticate the hosted MCP server, with the same permissions.

Key format

A key is a mode prefix followed by 64 random letters:

PrefixMode
dr_live_Live: production renders that count toward your plan's quota
dr_test_Test: free renders, kept apart from live data

The prefix is the only thing that decides the mode: there's no header or parameter to switch it. See Test mode for what's separated between the two.

Druckling stores a hash of the key, not the key itself, so the full key is shown only once, when you create it. The dashboard identifies keys by their name and their first characters, for example dr_live_xKpQ••••. Keys don't expire; they work until you revoke them.

Permissions

Each key has one of two permission levels. Pick Render only for services that only render documents, and Full access only where you need templates, webhooks or the embedded editor.

Render onlyFull access
Scopesdocuments:create, documents:readdocuments:create, documents:read, templates:read, templates:write, webhooks:manage
Documents: render, retrieve, listYesYes
Batches: start, retrieve, list, list documents, cancelYesYes
Share links: create, list, revokeYesYes
Templates: list, retrieve with JSON SchemaNoYes
Webhook endpoints: create, list, retrieve, deleteNoYes
Embedded editor sessions: create, revokeNoYes
MCP server: render and read documentsYesYes
MCP server: list, read, create, edit and publish templatesNoYes

A render-only key can render any published template, as long as you know its slug. It just can't list templates or read their schemas.

Keys and workspaces

A key works in the workspace it was created in. Everything it creates, such as documents, batches and webhook endpoints, belongs to that workspace, and it can't reach any other. If you belong to several workspaces, create a key in each.

A key isn't tied to the person who created it. It keeps working when that person leaves the workspace.

Manage keys

Keys are managed in the dashboard under Developers › API keys. Owners and admins can create and revoke keys. Members can see the list, with each key's name, mode, permission, when it was last used and when it was created, but can't change it.

Keys can't be renamed or edited. To change a key's mode or permission, create a new key and revoke the old one.

Create a key

  1. Go to Developers › API keys and click Create API key.
  2. Name the key after the service that uses it, for example billing-service. Keep the name to 32 characters or fewer.
  3. Choose the mode, Test or Live, and the permission, Render only or Full access.
  4. Click Create key, copy the key and store it in your server's environment or secret manager. You won't be able to see it again.

Rotate a key

There's no in-place rotation. Both keys work at the same time, so rotate without downtime:

  1. Create a new key with the same mode and permission.
  2. Deploy it everywhere the old key is used.
  3. Check that the old key's Last used time no longer changes.
  4. Revoke the old key.

Revoke a key

Open the key's actions menu in the list, choose Revoke key and confirm. Requests that use it fail with 401 right away. Revoking can't be undone.

Keep keys secret

API keys are server-side secrets:

  • Keep them in environment variables or a secret manager, never in source control.
  • Never ship a key to a browser or a mobile app. Anyone who has it can act in your workspace: render documents (on your quota, with a live key) and, with full access, read your templates and manage your webhooks and editor sessions.
  • To let your users edit templates in your product, create a short-lived embedded editor session on your server and give its URL to the browser. A session can only work on one template and expires after at most an hour.
  • To give someone a rendered document, send them a share link or the document's signed url. Neither needs a key.

If a key leaks, revoke it, create a replacement, and look through Developers › Logs for requests you don't recognize. The Logs page shows the dashboard's current mode, so switch to test mode to see a test key's requests.

Authentication errors

Authentication errors have the same shape as every other error:

{
  "defined": false,
  "code": "UNAUTHORIZED",
  "status": 401,
  "message": "Invalid or revoked API key",
  "data": { "code": "unauthorized", "field": null }
}
Statusdata.codeMessageCause
401unauthorizedMissing API key. Send it as x-api-key or Authorization: Bearer.No key in the request.
401unauthorizedInvalid or revoked API keyThe key is mistyped, incomplete or revoked.
403forbiddenThis API key does not have the templates:read permissionA render-only key called GET /v1/templates or GET /v1/templates/{slug}.
403forbiddenThis API key does not have the webhooks:manage permissionA render-only key listed or retrieved webhook endpoints.
403forbiddenOnly owners and admins can manage webhooksA render-only key created or deleted a webhook endpoint.
403forbiddenCreating editor sessions needs a full-access API key (templates:write)A render-only key created or revoked an embedded editor session.
429rate_limitedToo many requests for this API keyThe key sent too many requests in a short time. See Plans and limits.

Requests that fail with the 401 and 429 errors above aren't recorded under Developers › Logs. Requests rejected with 403 are.

On this page