Skip to main content

Choose the target build

These additions belong to the 1.1 review build. Use a matching development or staging instance for the examples. The production rollout is separate. Existing async clients can continue to submit to POST /v1/documents and poll the job location. On a review instance, create an API key in Settings. Set DOCKILN_ORIGIN to that instance and DOCKILN_API_KEY to your key in the local environment. Save the following as print-order.mjs and run node print-order.mjs with Node.js 24. The output, order.pdf, measures four by six inches and includes a sandbox watermark.
print-order.mjs

Reuse HTML with JSON data

Create a template with kind: "html", a title, an optional lowercase slug, html and a sample JSON object. Use a double-braced field in a text node. A template element with data-each repeats its children using each row as the current object. A template with data-if includes its children when the value is truthy.
DocKiln escapes substituted text. Dynamic attributes, raw HTML slots and script substitutions are unsupported. Publish with POST /v1/templates/{id}/publish. Use the slug or ID and optional version when creating a document. Download published source from GET /v1/templates/{id}/raw, or send a data object to POST /v1/templates/{id}/html for a populated HTML attachment.

Decide what the renderer can load

Static conversions work with the default configuration. Dynamic execution needs the operator-enabled isolated renderer. Use controls.javascript to execute scripts and externalAssets for a bounded resource catalogue. Give exact HTTPS URLs in assetUrls for JSON data or other assets chosen at runtime. Iframes, live connections and arbitrary navigation are blocked. For readiness, use a selector or an expression such as window.chartReady === true. The expression runs inside the isolated page. Native lazy images can be made eager with controls.lazyImages. For a protected HTTPS source, sourceAuth accepts Basic credentials, custom headers or a cookie map scoped to the source origin. Credentials are stripped across origins. The page receives no authentication cookie jar. Keep secrets in server-side environment variables.

Protect and deliver output

Set processing.protection.ownerPassword and optionally userPassword. Set copy, modify and print to false to request reader restrictions. PDF readers decide how to enforce permissions. Set sensitive: true to encrypt queued input, suppress the submission log and default to one-hour output expiry. Other job history remains available. S3, R2 and Google Cloud Storage destinations use a private customer bucket with workspace-scoped credentials. The customer Google bucket is independent of the service’s internal storage. Supply a storage prefix and restrict access to that prefix. Include delete permission when using output expiry. On completed customer deliveries, GET /v1/documents/{id}/link returns a five-minute signed download when the remaining retention permits it. A per-job callback accepts a public HTTPS url without query parameters and a signing secret of 32–128 characters. Verify the timestamp and HMAC against the exact received bytes; store the event ID before performing non-repeatable actions. Failures retry on a bounded schedule. For troubleshooting, use the X-Request-Id response header and the session-only request log. Logs contain route metadata and omit bodies, query strings, cookies and key values.