{"servers":[{"url":"/v1"}],"info":{"title":"Druckling API","version":"1.0.0","description":"Render PDFs from your Druckling templates. Authenticate with `Authorization: Bearer dr_live_…` (or `dr_test_…`), or send the key in an `x-api-key` header."},"components":{"securitySchemes":{"bearerAuth":{"type":"http","scheme":"bearer","description":"`Authorization: Bearer dr_live_…` or `dr_test_…`"},"apiKey":{"type":"apiKey","in":"header","name":"x-api-key"}}},"security":[{"bearerAuth":[]},{"apiKey":[]}],"openapi":"3.1.1","paths":{"/events":{"post":{"operationId":"events.send","summary":"Send an event","description":"Starts every enabled workflow listening to `type` in the API key's mode (Workflows page): each renders its template from `data`, then signs, stores, emails or calls a URL as configured. Runs happen in the background; follow them on the Workflows page or with the `workflow.run_succeeded` / `workflow.run_failed` webhooks.\n\nSend an `idempotency_key` (e.g. your order id) to make retries safe: an event with a key already seen in the last 30 days returns the original event with `duplicate: true` and starts nothing. Event payloads are kept 30 days. Needs a key with `documents:create`; `data` up to 256 KB.","tags":["Events"],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"type":{"type":"string","minLength":1,"maxLength":100,"description":"Event name: letters, digits and `. _ : -`."},"data":{"type":"object","propertyNames":{"type":"string"},"additionalProperties":{},"description":"The payload workflows render from (default `{}`)."},"idempotency_key":{"type":"string","maxLength":255}},"required":["type"]}}}},"responses":{"202":{"description":"OK","content":{"application/json":{"schema":{"type":"object","properties":{"id":{"type":"string"},"object":{"const":"event"},"type":{"type":"string"},"idempotency_key":{"anyOf":[{"type":"string"},{"type":"null"}]},"duplicate":{"type":"boolean","description":"True when an event with the same `idempotency_key` was already received: this is that event, and nothing new ran."},"runs":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string"},"workflow":{"type":"object","properties":{"id":{"type":"string"},"name":{"type":"string"}},"required":["id","name"]},"status":{"enum":["queued","running","waiting","succeeded","failed"],"type":"string","description":"`waiting`: a dataset's batches are rendering. `succeeded` and `failed` are final."}},"required":["id","workflow","status"]},"description":"The workflow runs the event started, one per enabled workflow of the key's mode listening to `type`."},"test_mode":{"type":"boolean"},"created_at":{"type":"string","format":"date-time"}},"required":["id","object","type","idempotency_key","duplicate","runs","test_mode","created_at"]}}}}}}},"/embed_sessions":{"post":{"operationId":"embedSessions.create","summary":"Create an embedded editor session","description":"Lets one of your users edit one template inside your product, in Druckling's white-label editor. Call this from your backend with a full-access key (`templates:write`) when the user opens the editor, then give the returned `url` to their browser.\n\nThe editor loads in an iframe on the origins allowed in Settings › Embed (enforced with CSP `frame-ancestors`); without any allowed origin the answer is 409 `invalid_state`. The session can read that template, save its draft, render previews and, if you allow it, publish. Nothing else in the workspace (other templates, documents, API keys, webhooks, billing, team) is reachable with it.\n\nSessions are short-lived: 30 minutes by default, at most an hour. When one expires the editor tells your page with an `error` event (`session_expired`); create a new session to continue. Drafts are saved continuously, so nothing is lost. The editor shows a small \"Powered by Druckling\" mark on the Free and Starter plans.","tags":["Embedded editor"],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"template":{"type":"string","minLength":1,"maxLength":64,"description":"Slug of the template to edit, e.g. invoice-standard."},"permissions":{"type":"object","properties":{"publish":{"type":"boolean","description":"Let the user publish new versions (default false: the user edits the draft, you publish)."},"assistant":{"type":"boolean","description":"Offer the AI assistant, on plans that include it (Pro, Business). Default false."}}},"expires_in":{"type":"integer","minimum":60,"maximum":3600,"description":"Seconds until the session ends: default 1800, at most 3600."},"user":{"type":"object","properties":{"id":{"type":"string","minLength":1,"maxLength":200,"description":"Your id for the user."},"name":{"type":"string","maxLength":200}},"required":["id"],"description":"Who is editing. Shown in Druckling's request logs and on the versions they publish (`embed:<id>`)."},"theme":{"type":"object","properties":{"mode":{"enum":["light","dark","system"],"type":"string","description":"Default `light`. `system` follows the user's OS setting."},"accent":{"type":"string","pattern":"^#(?:[0-9a-fA-F]{3}){1,2}$","description":"Your brand color for buttons and highlights, e.g. `#0f766e`."}}}},"required":["template"]}}}},"responses":{"201":{"description":"OK","content":{"application/json":{"schema":{"type":"object","properties":{"id":{"type":"string"},"object":{"const":"embed_session"},"url":{"anyOf":[{"type":"string"},{"type":"null"}],"description":"Load this URL in an iframe (or pass it to `mountEditor` from `@druckling/embed`). Returned only when the session is created. The session token sits in the fragment (`#token=…`), which browsers never send to servers; Druckling keeps only a hash of it. Hand the URL to the signed-in user's browser only, never log or cache it."},"template":{"type":"string","description":"Slug of the template the session edits."},"permissions":{"type":"object","properties":{"publish":{"type":"boolean","description":"The user can publish new versions."},"assistant":{"type":"boolean","description":"The AI assistant is offered. False when the plan doesn't include it, even if you asked for it."}},"required":["publish","assistant"],"description":"What the editor offers beyond editing the draft."},"user":{"anyOf":[{"type":"object","properties":{"id":{"type":"string"},"name":{"anyOf":[{"type":"string"},{"type":"null"}]}},"required":["id","name"]},{"type":"null"}],"description":"Your user, as you described them."},"theme":{"type":"object","properties":{"mode":{"enum":["light","dark","system"],"type":"string"},"accent":{"anyOf":[{"type":"string"},{"type":"null"}]}},"required":["mode","accent"]},"status":{"enum":["active","expired","revoked"],"type":"string"},"expires_at":{"type":"string","format":"date-time"},"revoked_at":{"anyOf":[{"type":"string","format":"date-time"},{"type":"null"}]},"test_mode":{"type":"boolean"},"created_at":{"type":"string","format":"date-time"}},"required":["id","object","url","template","permissions","user","theme","status","expires_at","revoked_at","test_mode","created_at"]}}}}}}},"/embed_sessions/{id}":{"delete":{"operationId":"embedSessions.revoke","summary":"Revoke an embedded editor session","description":"Ends the session right away, e.g. when the user signs out of your product. The open editor reports `session_revoked` on its next request. Revoking twice is fine.","tags":["Embedded editor"],"parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string"}}],"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object","properties":{"id":{"type":"string"},"object":{"const":"embed_session"},"url":{"anyOf":[{"type":"string"},{"type":"null"}],"description":"Load this URL in an iframe (or pass it to `mountEditor` from `@druckling/embed`). Returned only when the session is created. The session token sits in the fragment (`#token=…`), which browsers never send to servers; Druckling keeps only a hash of it. Hand the URL to the signed-in user's browser only, never log or cache it."},"template":{"type":"string","description":"Slug of the template the session edits."},"permissions":{"type":"object","properties":{"publish":{"type":"boolean","description":"The user can publish new versions."},"assistant":{"type":"boolean","description":"The AI assistant is offered. False when the plan doesn't include it, even if you asked for it."}},"required":["publish","assistant"],"description":"What the editor offers beyond editing the draft."},"user":{"anyOf":[{"type":"object","properties":{"id":{"type":"string"},"name":{"anyOf":[{"type":"string"},{"type":"null"}]}},"required":["id","name"]},{"type":"null"}],"description":"Your user, as you described them."},"theme":{"type":"object","properties":{"mode":{"enum":["light","dark","system"],"type":"string"},"accent":{"anyOf":[{"type":"string"},{"type":"null"}]}},"required":["mode","accent"]},"status":{"enum":["active","expired","revoked"],"type":"string"},"expires_at":{"type":"string","format":"date-time"},"revoked_at":{"anyOf":[{"type":"string","format":"date-time"},{"type":"null"}]},"test_mode":{"type":"boolean"},"created_at":{"type":"string","format":"date-time"}},"required":["id","object","url","template","permissions","user","theme","status","expires_at","revoked_at","test_mode","created_at"]}}}}}}},"/webhook_endpoints":{"post":{"operationId":"webhookEndpoints.create","summary":"Create a webhook endpoint","description":"Subscribes an HTTPS URL to document events in the API key's mode. The signing `secret` is returned only here. Requests follow the Standard Webhooks spec (`webhook-id`, `webhook-timestamp`, `webhook-signature`). Needs a full-access key.","tags":["Webhooks"],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"url":{"type":"string","maxLength":2048,"description":"Public https:// URL that answers 2xx within 10 seconds."},"events":{"type":"array","minItems":1,"items":{"enum":["document.rendered","document.failed","document.expired","batch.completed","document.delivered","document.delivery_failed","workflow.run_succeeded","workflow.run_failed"],"type":"string","description":"`batch.completed` is sent once per batch when it reaches a final status (`completed`, `failed` or `canceled`); `data` is the batch. `document.delivered` and `document.delivery_failed` follow a document's copy to your own bucket (`data.storage`); a failure is sent once retries are used up. `workflow.run_succeeded` and `workflow.run_failed` are sent when a workflow run finishes; `data` is the run with each step's outcome."}},"description":{"type":"string","maxLength":200}},"required":["url","events"]}}}},"responses":{"201":{"description":"OK","content":{"application/json":{"schema":{"type":"object","properties":{"id":{"type":"string"},"object":{"const":"webhook_endpoint"},"url":{"type":"string"},"description":{"type":"string"},"events":{"type":"array","items":{"enum":["document.rendered","document.failed","document.expired","batch.completed","document.delivered","document.delivery_failed","workflow.run_succeeded","workflow.run_failed"],"type":"string","description":"`batch.completed` is sent once per batch when it reaches a final status (`completed`, `failed` or `canceled`); `data` is the batch. `document.delivered` and `document.delivery_failed` follow a document's copy to your own bucket (`data.storage`); a failure is sent once retries are used up. `workflow.run_succeeded` and `workflow.run_failed` are sent when a workflow run finishes; `data` is the run with each step's outcome."}},"enabled":{"type":"boolean"},"test_mode":{"type":"boolean"},"created_at":{"type":"string","format":"date-time"},"secret":{"type":"string","description":"whsec_… signing secret; store it now."}},"required":["id","object","url","description","events","enabled","test_mode","created_at","secret"]}}}}}},"get":{"operationId":"webhookEndpoints.list","summary":"List webhook endpoints","tags":["Webhooks"],"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object","properties":{"object":{"const":"list"},"data":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string"},"object":{"const":"webhook_endpoint"},"url":{"type":"string"},"description":{"type":"string"},"events":{"type":"array","items":{"enum":["document.rendered","document.failed","document.expired","batch.completed","document.delivered","document.delivery_failed","workflow.run_succeeded","workflow.run_failed"],"type":"string","description":"`batch.completed` is sent once per batch when it reaches a final status (`completed`, `failed` or `canceled`); `data` is the batch. `document.delivered` and `document.delivery_failed` follow a document's copy to your own bucket (`data.storage`); a failure is sent once retries are used up. `workflow.run_succeeded` and `workflow.run_failed` are sent when a workflow run finishes; `data` is the run with each step's outcome."}},"enabled":{"type":"boolean"},"test_mode":{"type":"boolean"},"created_at":{"type":"string","format":"date-time"}},"required":["id","object","url","description","events","enabled","test_mode","created_at"]}}},"required":["object","data"]}}}}}}},"/webhook_endpoints/{id}":{"get":{"operationId":"webhookEndpoints.get","summary":"Retrieve a webhook endpoint","tags":["Webhooks"],"parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string"}}],"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object","properties":{"id":{"type":"string"},"object":{"const":"webhook_endpoint"},"url":{"type":"string"},"description":{"type":"string"},"events":{"type":"array","items":{"enum":["document.rendered","document.failed","document.expired","batch.completed","document.delivered","document.delivery_failed","workflow.run_succeeded","workflow.run_failed"],"type":"string","description":"`batch.completed` is sent once per batch when it reaches a final status (`completed`, `failed` or `canceled`); `data` is the batch. `document.delivered` and `document.delivery_failed` follow a document's copy to your own bucket (`data.storage`); a failure is sent once retries are used up. `workflow.run_succeeded` and `workflow.run_failed` are sent when a workflow run finishes; `data` is the run with each step's outcome."}},"enabled":{"type":"boolean"},"test_mode":{"type":"boolean"},"created_at":{"type":"string","format":"date-time"}},"required":["id","object","url","description","events","enabled","test_mode","created_at"]}}}}}},"delete":{"operationId":"webhookEndpoints.delete","summary":"Delete a webhook endpoint","tags":["Webhooks"],"parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string"}}],"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object","properties":{"id":{"type":"string"},"object":{"const":"webhook_endpoint"},"deleted":{"const":true}},"required":["id","object","deleted"]}}}}}}},"/documents":{"post":{"operationId":"documents.create","summary":"Render a document","description":"Validates `data` against the template's schema and renders a PDF, or one page as a PNG with `format: \"png\"`. Answers 200 with the rendered document and its signed URL, or with `async: true` 202 with the queued document to poll or wait for by webhook. For e-invoice templates `data.invoice` is an EN 16931 invoice: Druckling computes the totals and VAT breakdown and produces the template's e-invoice format: Factur-X / ZUGFeRD (the CII XML embedded as `factur-x.xml` in a PDF/A-3), XRechnung 3.0 (UBL or CII XML) or Peppol BIS Billing 3.0 (UBL XML). XRechnung and Peppol templates produce `format: \"xml\"` documents (`application/xml`). A broken business rule answers 422 `validation_failed` with the offending `field`: EN 16931 (BR-xx), XRechnung (BR-DE-xx) or Peppol (PEPPOL-EN16931-xxx, PEPPOL-COMMON-xxx, DE-R-xxx between German parties).","tags":["Documents"],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"template":{"type":"string","description":"Template slug, e.g. invoice-standard"},"version":{"anyOf":[{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991,"exclusiveMinimum":0},{"const":"latest"}],"description":"Pinned version or `latest` (default)."},"filename":{"type":"string","maxLength":200},"data":{"type":"object","propertyNames":{"type":"string"},"additionalProperties":{},"description":"Payload matching the template schema."},"async":{"type":"boolean","description":"Queue the render and return 202 immediately."},"format":{"enum":["pdf","png","xml"],"type":"string","description":"Output format; the template decides the default (`xml` for XRechnung and Peppol BIS e-invoice templates, `pdf` otherwise). `png` renders one page as an image; a template's PDF/A or PDF/UA setting applies to PDFs only. Factur-X templates render to `pdf` only, XRechnung and Peppol templates to `xml` only, and `xml` needs one of those (422 on `format`)."},"image":{"type":"object","properties":{"page":{"type":"integer","minimum":1,"maximum":9007199254740991,"description":"Page to render (default 1); 422 on `image.page` if the document is shorter."},"scale":{"type":"number","minimum":0.5,"maximum":4,"description":"Pixels per point (default 2 = 144 dpi; 1 = 72 dpi, 4 = 288 dpi)."}},"description":"PNG options; only allowed with `format: \"png\"`."},"language":{"type":"string","maxLength":35,"description":"Language to render: one of the template's `languages` (default: its default language). Texts without a translation fall back to the default language; numbers, dates, hyphenation and the PDF's language follow this one. A regional tag such as `de-AT` uses `de`. 422 `validation_failed` on this field for a language the template doesn't have."},"storage":{"anyOf":[{"type":"object","properties":{"bucket":{"type":"string","minLength":1,"maxLength":64,"description":"A bucket id from the Storage page, or `default` for the workspace's default bucket."}},"required":["bucket"]},{"const":false}],"description":"Also copy the file to one of your own S3-compatible buckets (AWS S3, Cloudflare R2, Google Cloud Storage, Scaleway, Hetzner, OVHcloud, IONOS, MinIO…). The upload runs after the render (and signing, so the bucket gets the signed PDF), so it never slows the response; follow it in the document's `storage` or with the `document.delivered` / `document.delivery_failed` webhooks. Without this field the template's bucket rule applies, if there is one; `false` skips it. 422 `validation_failed` on `storage.bucket` for an unknown or disabled bucket."},"sign":{"anyOf":[{"type":"boolean"},{"type":"object","properties":{"certificate":{"type":"string","maxLength":64,"description":"Id of a certificate from Settings › Signing (default: the workspace's default certificate)."}}}],"description":"Digitally sign the PDF (PAdES, invisible signature) with a certificate uploaded in Settings › Signing: `true` uses the default certificate, `{ \"certificate\": \"crt_…\" }` picks one. Unset: as the template says (its \"Sign rendered PDFs\" setting); `false` skips signing even then. PDF only (422 on `sign` for other formats). Signing is an incremental update, so PDF/A-3 (Factur-X) and PDF/UA documents keep their conformance. 404 on `sign.certificate` for an unknown certificate; 422 `signing_failed` when the workspace has no certificate, it has expired, or it can't sign."}},"required":["template","data"]}}}},"responses":{"200":{"description":"Rendered","content":{"application/json":{"schema":{"type":"object","properties":{"id":{"type":"string"},"object":{"const":"document"},"status":{"enum":["queued","rendering","rendered","failed","expired"],"type":"string"},"template":{"type":"string"},"version":{"anyOf":[{"type":"number"},{"type":"null"}]},"filename":{"type":"string"},"format":{"enum":["pdf","png","xml"],"type":"string","description":"`xml` for XRechnung and Peppol BIS e-invoices."},"content_type":{"type":"string","description":"`application/pdf`, `image/png` or `application/xml`."},"image":{"anyOf":[{"type":"object","properties":{"page":{"type":"number","description":"The page that was rendered (1-based)."},"scale":{"type":"number","description":"Pixels per point: 2 = 144 dpi."},"width":{"anyOf":[{"type":"number"},{"type":"null"}],"description":"Pixel width, once rendered."},"height":{"anyOf":[{"type":"number"},{"type":"null"}],"description":"Pixel height, once rendered."}},"required":["page","scale","width","height"]},{"type":"null"}],"description":"Set for `png` documents."},"pages":{"anyOf":[{"type":"number"},{"type":"null"}],"description":"Pages in the file (a PNG is one page; null for XML)."},"size_bytes":{"anyOf":[{"type":"number"},{"type":"null"}]},"url":{"anyOf":[{"type":"string"},{"type":"null"}],"description":"Signed download URL while the document is retained."},"expires_at":{"anyOf":[{"type":"string","format":"date-time"},{"type":"null"}]},"error":{"anyOf":[{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"field":{"anyOf":[{"type":"string"},{"type":"null"}]}},"required":["code","message","field"]},{"type":"null"}]},"einvoice":{"anyOf":[{"type":"object","properties":{"format":{"enum":["factur-x","xrechnung","peppol"],"type":"string","description":"`factur-x`: Factur-X 1.0 / ZUGFeRD 2.x hybrid invoice, a PDF/A-3 with the CII XML embedded. `xrechnung`: XRechnung 3.0 (German CIUS) as XML. `peppol`: Peppol BIS Billing 3.0 as UBL XML."},"syntax":{"enum":["cii","ubl"],"type":"string","description":"XML syntax: UN/CEFACT CII (Factur-X, XRechnung on request) or OASIS UBL 2.1 (XRechnung default, Peppol)."},"profile":{"type":"string","description":"`EN 16931`, `XRechnung 3.0` or `Peppol BIS Billing 3.0`."},"customization_id":{"type":"string","description":"Specification identifier (BT-24) written into the XML."},"attachment":{"anyOf":[{"type":"string"},{"type":"null"}],"description":"File name of the XML embedded in the PDF; null when the document is the XML itself."}},"required":["format","syntax","profile","customization_id","attachment"]},{"type":"null"}],"description":"Set when the document is or carries an e-invoice (templates with e-invoicing on)."},"batch":{"anyOf":[{"type":"object","properties":{"id":{"type":"string"},"index":{"type":"number","description":"Position of the item in the batch's `items`."}},"required":["id","index"]},{"type":"null"}],"description":"Set for documents rendered as part of a batch."},"language":{"anyOf":[{"type":"string"},{"type":"null"}],"description":"Language the document was rendered in (one of the template's `languages`); null for documents rendered before templates had languages."},"signature":{"anyOf":[{"type":"object","properties":{"certificate":{"type":"string","description":"Id of the workspace certificate that signed the PDF."},"certificate_name":{"type":"string"},"subject":{"type":"string","description":"The signer, from the certificate."},"level":{"enum":["B-B","B-T"],"type":"string","description":"PAdES baseline level (ETSI EN 319 142-1): `B-T` carries a trusted timestamp from a timestamp authority, `B-B` does not."},"signed_at":{"type":"string","format":"date-time"},"test_certificate":{"type":"boolean","description":"Signed with a Druckling test certificate, which proves nothing about the signer."}},"required":["certificate","certificate_name","subject","level","signed_at","test_certificate"]},{"type":"null"}],"description":"Set when the PDF carries a digital signature (PAdES) applied by Druckling."},"storage":{"anyOf":[{"type":"object","properties":{"bucket":{"type":"string","description":"Id of the bucket connection (Storage page)."},"status":{"enum":["pending","delivered","failed"],"type":"string","description":"`pending` until the file is uploaded (retried with backoff for about 2.5 hours), then `delivered` or `failed`."},"key":{"anyOf":[{"type":"string"},{"type":"null"}],"description":"Object key in your bucket, from the bucket's path template."},"error":{"anyOf":[{"type":"string"},{"type":"null"}],"description":"What the bucket answered on the last failed attempt, e.g. `403 AccessDenied: Access Denied`."},"attempts":{"type":"number"},"delivered_at":{"anyOf":[{"type":"string","format":"date-time"},{"type":"null"}]}},"required":["bucket","status","key","error","attempts","delivered_at"]},{"type":"null"}],"description":"Set when the document is also copied to your own S3-compatible bucket (request `storage`, or the template's bucket rule)."},"test_mode":{"type":"boolean"},"created_at":{"type":"string","format":"date-time"}},"required":["id","object","status","template","version","filename","format","content_type","image","pages","size_bytes","url","expires_at","error","einvoice","batch","language","signature","storage","test_mode","created_at"]}}}},"202":{"description":"Queued (`async: true`)","content":{"application/json":{"schema":{"type":"object","properties":{"id":{"type":"string"},"object":{"const":"document"},"status":{"enum":["queued","rendering","rendered","failed","expired"],"type":"string"},"template":{"type":"string"},"version":{"anyOf":[{"type":"number"},{"type":"null"}]},"filename":{"type":"string"},"format":{"enum":["pdf","png","xml"],"type":"string","description":"`xml` for XRechnung and Peppol BIS e-invoices."},"content_type":{"type":"string","description":"`application/pdf`, `image/png` or `application/xml`."},"image":{"anyOf":[{"type":"object","properties":{"page":{"type":"number","description":"The page that was rendered (1-based)."},"scale":{"type":"number","description":"Pixels per point: 2 = 144 dpi."},"width":{"anyOf":[{"type":"number"},{"type":"null"}],"description":"Pixel width, once rendered."},"height":{"anyOf":[{"type":"number"},{"type":"null"}],"description":"Pixel height, once rendered."}},"required":["page","scale","width","height"]},{"type":"null"}],"description":"Set for `png` documents."},"pages":{"anyOf":[{"type":"number"},{"type":"null"}],"description":"Pages in the file (a PNG is one page; null for XML)."},"size_bytes":{"anyOf":[{"type":"number"},{"type":"null"}]},"url":{"anyOf":[{"type":"string"},{"type":"null"}],"description":"Signed download URL while the document is retained."},"expires_at":{"anyOf":[{"type":"string","format":"date-time"},{"type":"null"}]},"error":{"anyOf":[{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"field":{"anyOf":[{"type":"string"},{"type":"null"}]}},"required":["code","message","field"]},{"type":"null"}]},"einvoice":{"anyOf":[{"type":"object","properties":{"format":{"enum":["factur-x","xrechnung","peppol"],"type":"string","description":"`factur-x`: Factur-X 1.0 / ZUGFeRD 2.x hybrid invoice, a PDF/A-3 with the CII XML embedded. `xrechnung`: XRechnung 3.0 (German CIUS) as XML. `peppol`: Peppol BIS Billing 3.0 as UBL XML."},"syntax":{"enum":["cii","ubl"],"type":"string","description":"XML syntax: UN/CEFACT CII (Factur-X, XRechnung on request) or OASIS UBL 2.1 (XRechnung default, Peppol)."},"profile":{"type":"string","description":"`EN 16931`, `XRechnung 3.0` or `Peppol BIS Billing 3.0`."},"customization_id":{"type":"string","description":"Specification identifier (BT-24) written into the XML."},"attachment":{"anyOf":[{"type":"string"},{"type":"null"}],"description":"File name of the XML embedded in the PDF; null when the document is the XML itself."}},"required":["format","syntax","profile","customization_id","attachment"]},{"type":"null"}],"description":"Set when the document is or carries an e-invoice (templates with e-invoicing on)."},"batch":{"anyOf":[{"type":"object","properties":{"id":{"type":"string"},"index":{"type":"number","description":"Position of the item in the batch's `items`."}},"required":["id","index"]},{"type":"null"}],"description":"Set for documents rendered as part of a batch."},"language":{"anyOf":[{"type":"string"},{"type":"null"}],"description":"Language the document was rendered in (one of the template's `languages`); null for documents rendered before templates had languages."},"signature":{"anyOf":[{"type":"object","properties":{"certificate":{"type":"string","description":"Id of the workspace certificate that signed the PDF."},"certificate_name":{"type":"string"},"subject":{"type":"string","description":"The signer, from the certificate."},"level":{"enum":["B-B","B-T"],"type":"string","description":"PAdES baseline level (ETSI EN 319 142-1): `B-T` carries a trusted timestamp from a timestamp authority, `B-B` does not."},"signed_at":{"type":"string","format":"date-time"},"test_certificate":{"type":"boolean","description":"Signed with a Druckling test certificate, which proves nothing about the signer."}},"required":["certificate","certificate_name","subject","level","signed_at","test_certificate"]},{"type":"null"}],"description":"Set when the PDF carries a digital signature (PAdES) applied by Druckling."},"storage":{"anyOf":[{"type":"object","properties":{"bucket":{"type":"string","description":"Id of the bucket connection (Storage page)."},"status":{"enum":["pending","delivered","failed"],"type":"string","description":"`pending` until the file is uploaded (retried with backoff for about 2.5 hours), then `delivered` or `failed`."},"key":{"anyOf":[{"type":"string"},{"type":"null"}],"description":"Object key in your bucket, from the bucket's path template."},"error":{"anyOf":[{"type":"string"},{"type":"null"}],"description":"What the bucket answered on the last failed attempt, e.g. `403 AccessDenied: Access Denied`."},"attempts":{"type":"number"},"delivered_at":{"anyOf":[{"type":"string","format":"date-time"},{"type":"null"}]}},"required":["bucket","status","key","error","attempts","delivered_at"]},{"type":"null"}],"description":"Set when the document is also copied to your own S3-compatible bucket (request `storage`, or the template's bucket rule)."},"test_mode":{"type":"boolean"},"created_at":{"type":"string","format":"date-time"}},"required":["id","object","status","template","version","filename","format","content_type","image","pages","size_bytes","url","expires_at","error","einvoice","batch","language","signature","storage","test_mode","created_at"]}}}}}},"get":{"operationId":"documents.list","summary":"List documents","tags":["Documents"],"parameters":[{"name":"limit","in":"query","schema":{"type":"integer","minimum":1,"maximum":100},"allowEmptyValue":true,"allowReserved":true},{"name":"cursor","in":"query","schema":{"type":"string"},"allowEmptyValue":true,"allowReserved":true},{"name":"status","in":"query","schema":{"enum":["queued","rendering","rendered","failed","expired"],"type":"string"},"allowEmptyValue":true,"allowReserved":true},{"name":"template","in":"query","schema":{"type":"string"},"allowEmptyValue":true,"allowReserved":true}],"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object","properties":{"object":{"const":"list"},"data":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string"},"object":{"const":"document"},"status":{"enum":["queued","rendering","rendered","failed","expired"],"type":"string"},"template":{"type":"string"},"version":{"anyOf":[{"type":"number"},{"type":"null"}]},"filename":{"type":"string"},"format":{"enum":["pdf","png","xml"],"type":"string","description":"`xml` for XRechnung and Peppol BIS e-invoices."},"content_type":{"type":"string","description":"`application/pdf`, `image/png` or `application/xml`."},"image":{"anyOf":[{"type":"object","properties":{"page":{"type":"number","description":"The page that was rendered (1-based)."},"scale":{"type":"number","description":"Pixels per point: 2 = 144 dpi."},"width":{"anyOf":[{"type":"number"},{"type":"null"}],"description":"Pixel width, once rendered."},"height":{"anyOf":[{"type":"number"},{"type":"null"}],"description":"Pixel height, once rendered."}},"required":["page","scale","width","height"]},{"type":"null"}],"description":"Set for `png` documents."},"pages":{"anyOf":[{"type":"number"},{"type":"null"}],"description":"Pages in the file (a PNG is one page; null for XML)."},"size_bytes":{"anyOf":[{"type":"number"},{"type":"null"}]},"url":{"anyOf":[{"type":"string"},{"type":"null"}],"description":"Signed download URL while the document is retained."},"expires_at":{"anyOf":[{"type":"string","format":"date-time"},{"type":"null"}]},"error":{"anyOf":[{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"field":{"anyOf":[{"type":"string"},{"type":"null"}]}},"required":["code","message","field"]},{"type":"null"}]},"einvoice":{"anyOf":[{"type":"object","properties":{"format":{"enum":["factur-x","xrechnung","peppol"],"type":"string","description":"`factur-x`: Factur-X 1.0 / ZUGFeRD 2.x hybrid invoice, a PDF/A-3 with the CII XML embedded. `xrechnung`: XRechnung 3.0 (German CIUS) as XML. `peppol`: Peppol BIS Billing 3.0 as UBL XML."},"syntax":{"enum":["cii","ubl"],"type":"string","description":"XML syntax: UN/CEFACT CII (Factur-X, XRechnung on request) or OASIS UBL 2.1 (XRechnung default, Peppol)."},"profile":{"type":"string","description":"`EN 16931`, `XRechnung 3.0` or `Peppol BIS Billing 3.0`."},"customization_id":{"type":"string","description":"Specification identifier (BT-24) written into the XML."},"attachment":{"anyOf":[{"type":"string"},{"type":"null"}],"description":"File name of the XML embedded in the PDF; null when the document is the XML itself."}},"required":["format","syntax","profile","customization_id","attachment"]},{"type":"null"}],"description":"Set when the document is or carries an e-invoice (templates with e-invoicing on)."},"batch":{"anyOf":[{"type":"object","properties":{"id":{"type":"string"},"index":{"type":"number","description":"Position of the item in the batch's `items`."}},"required":["id","index"]},{"type":"null"}],"description":"Set for documents rendered as part of a batch."},"language":{"anyOf":[{"type":"string"},{"type":"null"}],"description":"Language the document was rendered in (one of the template's `languages`); null for documents rendered before templates had languages."},"signature":{"anyOf":[{"type":"object","properties":{"certificate":{"type":"string","description":"Id of the workspace certificate that signed the PDF."},"certificate_name":{"type":"string"},"subject":{"type":"string","description":"The signer, from the certificate."},"level":{"enum":["B-B","B-T"],"type":"string","description":"PAdES baseline level (ETSI EN 319 142-1): `B-T` carries a trusted timestamp from a timestamp authority, `B-B` does not."},"signed_at":{"type":"string","format":"date-time"},"test_certificate":{"type":"boolean","description":"Signed with a Druckling test certificate, which proves nothing about the signer."}},"required":["certificate","certificate_name","subject","level","signed_at","test_certificate"]},{"type":"null"}],"description":"Set when the PDF carries a digital signature (PAdES) applied by Druckling."},"storage":{"anyOf":[{"type":"object","properties":{"bucket":{"type":"string","description":"Id of the bucket connection (Storage page)."},"status":{"enum":["pending","delivered","failed"],"type":"string","description":"`pending` until the file is uploaded (retried with backoff for about 2.5 hours), then `delivered` or `failed`."},"key":{"anyOf":[{"type":"string"},{"type":"null"}],"description":"Object key in your bucket, from the bucket's path template."},"error":{"anyOf":[{"type":"string"},{"type":"null"}],"description":"What the bucket answered on the last failed attempt, e.g. `403 AccessDenied: Access Denied`."},"attempts":{"type":"number"},"delivered_at":{"anyOf":[{"type":"string","format":"date-time"},{"type":"null"}]}},"required":["bucket","status","key","error","attempts","delivered_at"]},{"type":"null"}],"description":"Set when the document is also copied to your own S3-compatible bucket (request `storage`, or the template's bucket rule)."},"test_mode":{"type":"boolean"},"created_at":{"type":"string","format":"date-time"}},"required":["id","object","status","template","version","filename","format","content_type","image","pages","size_bytes","url","expires_at","error","einvoice","batch","language","signature","storage","test_mode","created_at"]}},"next_cursor":{"anyOf":[{"type":"string"},{"type":"null"}]}},"required":["object","data","next_cursor"]}}}}}}},"/documents/{id}":{"get":{"operationId":"documents.get","summary":"Retrieve a document","tags":["Documents"],"parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string"}}],"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object","properties":{"id":{"type":"string"},"object":{"const":"document"},"status":{"enum":["queued","rendering","rendered","failed","expired"],"type":"string"},"template":{"type":"string"},"version":{"anyOf":[{"type":"number"},{"type":"null"}]},"filename":{"type":"string"},"format":{"enum":["pdf","png","xml"],"type":"string","description":"`xml` for XRechnung and Peppol BIS e-invoices."},"content_type":{"type":"string","description":"`application/pdf`, `image/png` or `application/xml`."},"image":{"anyOf":[{"type":"object","properties":{"page":{"type":"number","description":"The page that was rendered (1-based)."},"scale":{"type":"number","description":"Pixels per point: 2 = 144 dpi."},"width":{"anyOf":[{"type":"number"},{"type":"null"}],"description":"Pixel width, once rendered."},"height":{"anyOf":[{"type":"number"},{"type":"null"}],"description":"Pixel height, once rendered."}},"required":["page","scale","width","height"]},{"type":"null"}],"description":"Set for `png` documents."},"pages":{"anyOf":[{"type":"number"},{"type":"null"}],"description":"Pages in the file (a PNG is one page; null for XML)."},"size_bytes":{"anyOf":[{"type":"number"},{"type":"null"}]},"url":{"anyOf":[{"type":"string"},{"type":"null"}],"description":"Signed download URL while the document is retained."},"expires_at":{"anyOf":[{"type":"string","format":"date-time"},{"type":"null"}]},"error":{"anyOf":[{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"field":{"anyOf":[{"type":"string"},{"type":"null"}]}},"required":["code","message","field"]},{"type":"null"}]},"einvoice":{"anyOf":[{"type":"object","properties":{"format":{"enum":["factur-x","xrechnung","peppol"],"type":"string","description":"`factur-x`: Factur-X 1.0 / ZUGFeRD 2.x hybrid invoice, a PDF/A-3 with the CII XML embedded. `xrechnung`: XRechnung 3.0 (German CIUS) as XML. `peppol`: Peppol BIS Billing 3.0 as UBL XML."},"syntax":{"enum":["cii","ubl"],"type":"string","description":"XML syntax: UN/CEFACT CII (Factur-X, XRechnung on request) or OASIS UBL 2.1 (XRechnung default, Peppol)."},"profile":{"type":"string","description":"`EN 16931`, `XRechnung 3.0` or `Peppol BIS Billing 3.0`."},"customization_id":{"type":"string","description":"Specification identifier (BT-24) written into the XML."},"attachment":{"anyOf":[{"type":"string"},{"type":"null"}],"description":"File name of the XML embedded in the PDF; null when the document is the XML itself."}},"required":["format","syntax","profile","customization_id","attachment"]},{"type":"null"}],"description":"Set when the document is or carries an e-invoice (templates with e-invoicing on)."},"batch":{"anyOf":[{"type":"object","properties":{"id":{"type":"string"},"index":{"type":"number","description":"Position of the item in the batch's `items`."}},"required":["id","index"]},{"type":"null"}],"description":"Set for documents rendered as part of a batch."},"language":{"anyOf":[{"type":"string"},{"type":"null"}],"description":"Language the document was rendered in (one of the template's `languages`); null for documents rendered before templates had languages."},"signature":{"anyOf":[{"type":"object","properties":{"certificate":{"type":"string","description":"Id of the workspace certificate that signed the PDF."},"certificate_name":{"type":"string"},"subject":{"type":"string","description":"The signer, from the certificate."},"level":{"enum":["B-B","B-T"],"type":"string","description":"PAdES baseline level (ETSI EN 319 142-1): `B-T` carries a trusted timestamp from a timestamp authority, `B-B` does not."},"signed_at":{"type":"string","format":"date-time"},"test_certificate":{"type":"boolean","description":"Signed with a Druckling test certificate, which proves nothing about the signer."}},"required":["certificate","certificate_name","subject","level","signed_at","test_certificate"]},{"type":"null"}],"description":"Set when the PDF carries a digital signature (PAdES) applied by Druckling."},"storage":{"anyOf":[{"type":"object","properties":{"bucket":{"type":"string","description":"Id of the bucket connection (Storage page)."},"status":{"enum":["pending","delivered","failed"],"type":"string","description":"`pending` until the file is uploaded (retried with backoff for about 2.5 hours), then `delivered` or `failed`."},"key":{"anyOf":[{"type":"string"},{"type":"null"}],"description":"Object key in your bucket, from the bucket's path template."},"error":{"anyOf":[{"type":"string"},{"type":"null"}],"description":"What the bucket answered on the last failed attempt, e.g. `403 AccessDenied: Access Denied`."},"attempts":{"type":"number"},"delivered_at":{"anyOf":[{"type":"string","format":"date-time"},{"type":"null"}]}},"required":["bucket","status","key","error","attempts","delivered_at"]},{"type":"null"}],"description":"Set when the document is also copied to your own S3-compatible bucket (request `storage`, or the template's bucket rule)."},"test_mode":{"type":"boolean"},"created_at":{"type":"string","format":"date-time"}},"required":["id","object","status","template","version","filename","format","content_type","image","pages","size_bytes","url","expires_at","error","einvoice","batch","language","signature","storage","test_mode","created_at"]}}}}}}},"/documents/{id}/share_links":{"post":{"operationId":"shareLinks.create","summary":"Create a share link","description":"Creates a public, unguessable link to a rendered document that anyone can open without an API key, until it expires or is revoked. The link never outlives the file: `expires_at` is capped by the document's retention. The `url` is returned only here.","tags":["Share links"],"parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string","description":"Document id."}}],"requestBody":{"required":false,"content":{"application/json":{"schema":{"type":"object","properties":{"expires_in_days":{"type":"integer","minimum":1,"maximum":30,"description":"Days until the link stops working (default 7, at most 30)."}}}}}},"responses":{"201":{"description":"OK","content":{"application/json":{"schema":{"type":"object","properties":{"id":{"type":"string"},"object":{"const":"share_link"},"document":{"type":"string"},"url":{"anyOf":[{"type":"string"},{"type":"null"}],"description":"The public link. Returned only when the link is created: Druckling keeps a hash of it, not the link itself."},"hint":{"type":"string","description":"Last four characters of the link, to tell links apart."},"status":{"enum":["active","expired","revoked"],"type":"string"},"expires_at":{"type":"string","format":"date-time"},"revoked_at":{"anyOf":[{"type":"string","format":"date-time"},{"type":"null"}]},"test_mode":{"type":"boolean"},"created_at":{"type":"string","format":"date-time"}},"required":["id","object","document","url","hint","status","expires_at","revoked_at","test_mode","created_at"]}}}}}},"get":{"operationId":"shareLinks.list","summary":"List a document's share links","tags":["Share links"],"parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string"}}],"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object","properties":{"object":{"const":"list"},"data":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string"},"object":{"const":"share_link"},"document":{"type":"string"},"url":{"anyOf":[{"type":"string"},{"type":"null"}],"description":"The public link. Returned only when the link is created: Druckling keeps a hash of it, not the link itself."},"hint":{"type":"string","description":"Last four characters of the link, to tell links apart."},"status":{"enum":["active","expired","revoked"],"type":"string"},"expires_at":{"type":"string","format":"date-time"},"revoked_at":{"anyOf":[{"type":"string","format":"date-time"},{"type":"null"}]},"test_mode":{"type":"boolean"},"created_at":{"type":"string","format":"date-time"}},"required":["id","object","document","url","hint","status","expires_at","revoked_at","test_mode","created_at"]}}},"required":["object","data"]}}}}}}},"/documents/{id}/share_links/{share_link_id}":{"delete":{"operationId":"shareLinks.revoke","summary":"Revoke a share link","description":"The link stops working immediately (410 Gone).","tags":["Share links"],"parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string"}},{"name":"share_link_id","in":"path","required":true,"schema":{"type":"string"}}],"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object","properties":{"id":{"type":"string"},"object":{"const":"share_link"},"document":{"type":"string"},"url":{"anyOf":[{"type":"string"},{"type":"null"}],"description":"The public link. Returned only when the link is created: Druckling keeps a hash of it, not the link itself."},"hint":{"type":"string","description":"Last four characters of the link, to tell links apart."},"status":{"enum":["active","expired","revoked"],"type":"string"},"expires_at":{"type":"string","format":"date-time"},"revoked_at":{"anyOf":[{"type":"string","format":"date-time"},{"type":"null"}]},"test_mode":{"type":"boolean"},"created_at":{"type":"string","format":"date-time"}},"required":["id","object","document","url","hint","status","expires_at","revoked_at","test_mode","created_at"]}}}}}}},"/batches":{"post":{"operationId":"batches.create","summary":"Start a batch","description":"Renders one template for many payloads. Every item's `data` is validated first: if any item is invalid nothing is rendered and the answer is 422 with `data.errors` listing the first invalid items' `index`, `field` and `message` (`data.invalidItems` counts them all). Otherwise each item becomes an asynchronous document (its `batch` set) and the answer is 202. Poll `GET /batches/{id}` or subscribe to `batch.completed`; a completed batch has a `zip_url` with every rendered PDF. Up to 1,000 items and 4 MB per request. Live batches must fit in the plan's documents left today and this month (429 `quota_exceeded`).","tags":["Batches"],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"template":{"type":"string","description":"Template slug, e.g. invoice-standard"},"version":{"anyOf":[{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991,"exclusiveMinimum":0},{"const":"latest"}],"description":"Pinned version or `latest` (default)."},"items":{"type":"array","minItems":1,"maxItems":1000,"items":{"type":"object","properties":{"data":{"type":"object","propertyNames":{"type":"string"},"additionalProperties":{},"description":"Payload matching the template schema."},"filename":{"type":"string","maxLength":200,"description":"File name of this item's PDF; overrides `filename_pattern`."},"language":{"type":"string","maxLength":35,"description":"This item's language; overrides the batch's `language`."}},"required":["data"]}},"language":{"type":"string","maxLength":35,"description":"Language of every item without its own `language`: one of the template's `languages` (default: its default language). Unknown languages are rejected with 422 on `language` or `items.{n}.language`."},"filename_pattern":{"type":"string","maxLength":200,"description":"File names from each item's data, e.g. `invoice-{{invoice.number}}.pdf`. Names are made unique within the batch; default `{template}-{n}.pdf`. XRechnung and Peppol templates produce XML e-invoices, named `.xml`."},"storage":{"anyOf":[{"type":"object","properties":{"bucket":{"type":"string","minLength":1,"maxLength":64,"description":"A bucket id from the Storage page, or `default` for the workspace's default bucket."}},"required":["bucket"]},{"const":false}],"description":"Copy every item's file to one of your own buckets, as for a single render."}},"required":["template","items"]}}}},"responses":{"202":{"description":"OK","content":{"application/json":{"schema":{"type":"object","properties":{"id":{"type":"string"},"object":{"const":"batch"},"status":{"enum":["queued","running","completed","failed","canceled"],"type":"string","description":"`queued` → `running` → `completed` (ZIP ready), `failed` (nothing rendered, or the ZIP couldn't be built) or `canceled`."},"template":{"type":"string"},"version":{"type":"number"},"filename_pattern":{"anyOf":[{"type":"string"},{"type":"null"}]},"counts":{"type":"object","properties":{"total":{"type":"number"},"pending":{"type":"number"},"rendered":{"type":"number"},"failed":{"type":"number"},"canceled":{"type":"number"}},"required":["total","pending","rendered","failed","canceled"],"description":"Items by outcome; `pending` is queued or rendering."},"zip_url":{"anyOf":[{"type":"string"},{"type":"null"}],"description":"Signed download URL of the ZIP with every rendered file (PDFs, or XML e-invoices), once the batch completed and while the ZIP is retained."},"zip_size_bytes":{"anyOf":[{"type":"number"},{"type":"null"}]},"zip_expires_at":{"anyOf":[{"type":"string","format":"date-time"},{"type":"null"}],"description":"When the ZIP is deleted (the file retention period)."},"error":{"anyOf":[{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"}},"required":["code","message"]},{"type":"null"}]},"test_mode":{"type":"boolean"},"created_at":{"type":"string","format":"date-time"},"finished_at":{"anyOf":[{"type":"string","format":"date-time"},{"type":"null"}]}},"required":["id","object","status","template","version","filename_pattern","counts","zip_url","zip_size_bytes","zip_expires_at","error","test_mode","created_at","finished_at"]}}}}}},"get":{"operationId":"batches.list","summary":"List batches","tags":["Batches"],"parameters":[{"name":"limit","in":"query","schema":{"type":"integer","minimum":1,"maximum":100},"allowEmptyValue":true,"allowReserved":true},{"name":"cursor","in":"query","schema":{"type":"string"},"allowEmptyValue":true,"allowReserved":true},{"name":"status","in":"query","schema":{"enum":["queued","running","completed","failed","canceled"],"type":"string"},"allowEmptyValue":true,"allowReserved":true}],"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object","properties":{"object":{"const":"list"},"data":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string"},"object":{"const":"batch"},"status":{"enum":["queued","running","completed","failed","canceled"],"type":"string","description":"`queued` → `running` → `completed` (ZIP ready), `failed` (nothing rendered, or the ZIP couldn't be built) or `canceled`."},"template":{"type":"string"},"version":{"type":"number"},"filename_pattern":{"anyOf":[{"type":"string"},{"type":"null"}]},"counts":{"type":"object","properties":{"total":{"type":"number"},"pending":{"type":"number"},"rendered":{"type":"number"},"failed":{"type":"number"},"canceled":{"type":"number"}},"required":["total","pending","rendered","failed","canceled"],"description":"Items by outcome; `pending` is queued or rendering."},"zip_url":{"anyOf":[{"type":"string"},{"type":"null"}],"description":"Signed download URL of the ZIP with every rendered file (PDFs, or XML e-invoices), once the batch completed and while the ZIP is retained."},"zip_size_bytes":{"anyOf":[{"type":"number"},{"type":"null"}]},"zip_expires_at":{"anyOf":[{"type":"string","format":"date-time"},{"type":"null"}],"description":"When the ZIP is deleted (the file retention period)."},"error":{"anyOf":[{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"}},"required":["code","message"]},{"type":"null"}]},"test_mode":{"type":"boolean"},"created_at":{"type":"string","format":"date-time"},"finished_at":{"anyOf":[{"type":"string","format":"date-time"},{"type":"null"}]}},"required":["id","object","status","template","version","filename_pattern","counts","zip_url","zip_size_bytes","zip_expires_at","error","test_mode","created_at","finished_at"]}},"next_cursor":{"anyOf":[{"type":"string"},{"type":"null"}]}},"required":["object","data","next_cursor"]}}}}}}},"/batches/{id}":{"get":{"operationId":"batches.get","summary":"Retrieve a batch","tags":["Batches"],"parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string"}}],"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object","properties":{"id":{"type":"string"},"object":{"const":"batch"},"status":{"enum":["queued","running","completed","failed","canceled"],"type":"string","description":"`queued` → `running` → `completed` (ZIP ready), `failed` (nothing rendered, or the ZIP couldn't be built) or `canceled`."},"template":{"type":"string"},"version":{"type":"number"},"filename_pattern":{"anyOf":[{"type":"string"},{"type":"null"}]},"counts":{"type":"object","properties":{"total":{"type":"number"},"pending":{"type":"number"},"rendered":{"type":"number"},"failed":{"type":"number"},"canceled":{"type":"number"}},"required":["total","pending","rendered","failed","canceled"],"description":"Items by outcome; `pending` is queued or rendering."},"zip_url":{"anyOf":[{"type":"string"},{"type":"null"}],"description":"Signed download URL of the ZIP with every rendered file (PDFs, or XML e-invoices), once the batch completed and while the ZIP is retained."},"zip_size_bytes":{"anyOf":[{"type":"number"},{"type":"null"}]},"zip_expires_at":{"anyOf":[{"type":"string","format":"date-time"},{"type":"null"}],"description":"When the ZIP is deleted (the file retention period)."},"error":{"anyOf":[{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"}},"required":["code","message"]},{"type":"null"}]},"test_mode":{"type":"boolean"},"created_at":{"type":"string","format":"date-time"},"finished_at":{"anyOf":[{"type":"string","format":"date-time"},{"type":"null"}]}},"required":["id","object","status","template","version","filename_pattern","counts","zip_url","zip_size_bytes","zip_expires_at","error","test_mode","created_at","finished_at"]}}}}}}},"/batches/{id}/documents":{"get":{"operationId":"batches.documents","summary":"List a batch's documents","description":"The batch's documents in item order. Filter by `outcome` (the keys of `counts`), e.g. `failed` for the items that need attention.","tags":["Batches"],"parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string"}},{"name":"outcome","in":"query","schema":{"enum":["pending","rendered","failed","canceled"],"type":"string"},"allowEmptyValue":true,"allowReserved":true},{"name":"limit","in":"query","schema":{"type":"integer","minimum":1,"maximum":100},"allowEmptyValue":true,"allowReserved":true},{"name":"cursor","in":"query","schema":{"type":"string"},"allowEmptyValue":true,"allowReserved":true}],"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object","properties":{"object":{"const":"list"},"data":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string"},"object":{"const":"document"},"status":{"enum":["queued","rendering","rendered","failed","expired"],"type":"string"},"template":{"type":"string"},"version":{"anyOf":[{"type":"number"},{"type":"null"}]},"filename":{"type":"string"},"format":{"enum":["pdf","png","xml"],"type":"string","description":"`xml` for XRechnung and Peppol BIS e-invoices."},"content_type":{"type":"string","description":"`application/pdf`, `image/png` or `application/xml`."},"image":{"anyOf":[{"type":"object","properties":{"page":{"type":"number","description":"The page that was rendered (1-based)."},"scale":{"type":"number","description":"Pixels per point: 2 = 144 dpi."},"width":{"anyOf":[{"type":"number"},{"type":"null"}],"description":"Pixel width, once rendered."},"height":{"anyOf":[{"type":"number"},{"type":"null"}],"description":"Pixel height, once rendered."}},"required":["page","scale","width","height"]},{"type":"null"}],"description":"Set for `png` documents."},"pages":{"anyOf":[{"type":"number"},{"type":"null"}],"description":"Pages in the file (a PNG is one page; null for XML)."},"size_bytes":{"anyOf":[{"type":"number"},{"type":"null"}]},"url":{"anyOf":[{"type":"string"},{"type":"null"}],"description":"Signed download URL while the document is retained."},"expires_at":{"anyOf":[{"type":"string","format":"date-time"},{"type":"null"}]},"error":{"anyOf":[{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"field":{"anyOf":[{"type":"string"},{"type":"null"}]}},"required":["code","message","field"]},{"type":"null"}]},"einvoice":{"anyOf":[{"type":"object","properties":{"format":{"enum":["factur-x","xrechnung","peppol"],"type":"string","description":"`factur-x`: Factur-X 1.0 / ZUGFeRD 2.x hybrid invoice, a PDF/A-3 with the CII XML embedded. `xrechnung`: XRechnung 3.0 (German CIUS) as XML. `peppol`: Peppol BIS Billing 3.0 as UBL XML."},"syntax":{"enum":["cii","ubl"],"type":"string","description":"XML syntax: UN/CEFACT CII (Factur-X, XRechnung on request) or OASIS UBL 2.1 (XRechnung default, Peppol)."},"profile":{"type":"string","description":"`EN 16931`, `XRechnung 3.0` or `Peppol BIS Billing 3.0`."},"customization_id":{"type":"string","description":"Specification identifier (BT-24) written into the XML."},"attachment":{"anyOf":[{"type":"string"},{"type":"null"}],"description":"File name of the XML embedded in the PDF; null when the document is the XML itself."}},"required":["format","syntax","profile","customization_id","attachment"]},{"type":"null"}],"description":"Set when the document is or carries an e-invoice (templates with e-invoicing on)."},"batch":{"anyOf":[{"type":"object","properties":{"id":{"type":"string"},"index":{"type":"number","description":"Position of the item in the batch's `items`."}},"required":["id","index"]},{"type":"null"}],"description":"Set for documents rendered as part of a batch."},"language":{"anyOf":[{"type":"string"},{"type":"null"}],"description":"Language the document was rendered in (one of the template's `languages`); null for documents rendered before templates had languages."},"signature":{"anyOf":[{"type":"object","properties":{"certificate":{"type":"string","description":"Id of the workspace certificate that signed the PDF."},"certificate_name":{"type":"string"},"subject":{"type":"string","description":"The signer, from the certificate."},"level":{"enum":["B-B","B-T"],"type":"string","description":"PAdES baseline level (ETSI EN 319 142-1): `B-T` carries a trusted timestamp from a timestamp authority, `B-B` does not."},"signed_at":{"type":"string","format":"date-time"},"test_certificate":{"type":"boolean","description":"Signed with a Druckling test certificate, which proves nothing about the signer."}},"required":["certificate","certificate_name","subject","level","signed_at","test_certificate"]},{"type":"null"}],"description":"Set when the PDF carries a digital signature (PAdES) applied by Druckling."},"storage":{"anyOf":[{"type":"object","properties":{"bucket":{"type":"string","description":"Id of the bucket connection (Storage page)."},"status":{"enum":["pending","delivered","failed"],"type":"string","description":"`pending` until the file is uploaded (retried with backoff for about 2.5 hours), then `delivered` or `failed`."},"key":{"anyOf":[{"type":"string"},{"type":"null"}],"description":"Object key in your bucket, from the bucket's path template."},"error":{"anyOf":[{"type":"string"},{"type":"null"}],"description":"What the bucket answered on the last failed attempt, e.g. `403 AccessDenied: Access Denied`."},"attempts":{"type":"number"},"delivered_at":{"anyOf":[{"type":"string","format":"date-time"},{"type":"null"}]}},"required":["bucket","status","key","error","attempts","delivered_at"]},{"type":"null"}],"description":"Set when the document is also copied to your own S3-compatible bucket (request `storage`, or the template's bucket rule)."},"test_mode":{"type":"boolean"},"created_at":{"type":"string","format":"date-time"}},"required":["id","object","status","template","version","filename","format","content_type","image","pages","size_bytes","url","expires_at","error","einvoice","batch","language","signature","storage","test_mode","created_at"]}},"next_cursor":{"anyOf":[{"type":"string"},{"type":"null"}]}},"required":["object","data","next_cursor"]}}}}}}},"/batches/{id}/cancel":{"post":{"operationId":"batches.cancel","summary":"Cancel a batch","description":"Items that haven't started rendering are canceled (`failed` documents with error code `canceled`); renders already running finish. A canceled batch has no ZIP. 409 once the batch has finished.","tags":["Batches"],"parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string"}}],"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object","properties":{"id":{"type":"string"},"object":{"const":"batch"},"status":{"enum":["queued","running","completed","failed","canceled"],"type":"string","description":"`queued` → `running` → `completed` (ZIP ready), `failed` (nothing rendered, or the ZIP couldn't be built) or `canceled`."},"template":{"type":"string"},"version":{"type":"number"},"filename_pattern":{"anyOf":[{"type":"string"},{"type":"null"}]},"counts":{"type":"object","properties":{"total":{"type":"number"},"pending":{"type":"number"},"rendered":{"type":"number"},"failed":{"type":"number"},"canceled":{"type":"number"}},"required":["total","pending","rendered","failed","canceled"],"description":"Items by outcome; `pending` is queued or rendering."},"zip_url":{"anyOf":[{"type":"string"},{"type":"null"}],"description":"Signed download URL of the ZIP with every rendered file (PDFs, or XML e-invoices), once the batch completed and while the ZIP is retained."},"zip_size_bytes":{"anyOf":[{"type":"number"},{"type":"null"}]},"zip_expires_at":{"anyOf":[{"type":"string","format":"date-time"},{"type":"null"}],"description":"When the ZIP is deleted (the file retention period)."},"error":{"anyOf":[{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"}},"required":["code","message"]},{"type":"null"}]},"test_mode":{"type":"boolean"},"created_at":{"type":"string","format":"date-time"},"finished_at":{"anyOf":[{"type":"string","format":"date-time"},{"type":"null"}]}},"required":["id","object","status","template","version","filename_pattern","counts","zip_url","zip_size_bytes","zip_expires_at","error","test_mode","created_at","finished_at"]}}}}}}},"/templates":{"get":{"operationId":"templates.list","summary":"List templates","tags":["Templates"],"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object","properties":{"object":{"const":"list"},"data":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string"},"object":{"const":"template"},"slug":{"type":"string"},"name":{"type":"string"},"status":{"enum":["draft","published"],"type":"string"},"latest_version":{"anyOf":[{"type":"number"},{"type":"null"}]},"required_fields":{"type":"array","items":{"type":"string"}},"language":{"type":"string","description":"Default language, used when a render names none."},"languages":{"type":"array","items":{"type":"string"},"description":"Every language the template renders in (pass one as `language`), default first. From the latest published version, or the draft if never published."},"updated_at":{"type":"string","format":"date-time"}},"required":["id","object","slug","name","status","latest_version","required_fields","language","languages","updated_at"]}}},"required":["object","data"]}}}}}}},"/templates/{slug}":{"get":{"operationId":"templates.get","summary":"Retrieve a template and its JSON Schema","tags":["Templates"],"parameters":[{"name":"slug","in":"path","required":true,"schema":{"type":"string"}}],"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object","properties":{"id":{"type":"string"},"object":{"const":"template"},"slug":{"type":"string"},"name":{"type":"string"},"status":{"enum":["draft","published"],"type":"string"},"latest_version":{"anyOf":[{"type":"number"},{"type":"null"}]},"required_fields":{"type":"array","items":{"type":"string"}},"language":{"type":"string","description":"Default language, used when a render names none."},"languages":{"type":"array","items":{"type":"string"},"description":"Every language the template renders in (pass one as `language`), default first. From the latest published version, or the draft if never published."},"updated_at":{"type":"string","format":"date-time"},"json_schema":{"type":"object","propertyNames":{"type":"string"},"additionalProperties":{}},"sample_data":{"type":"object","propertyNames":{"type":"string"},"additionalProperties":{}}},"required":["id","object","slug","name","status","latest_version","required_fields","language","languages","updated_at","json_schema","sample_data"]}}}}}}}}}