D
Druckling
Docs

Start a batch

POST
/batches

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).

Authorization

headerAuthorizationBearer <token>

Authorization: Bearer dr_live_… or dr_test_…

Request Body

application/json
  1. body
template*string

Template slug, e.g. invoice-standard

version?|

Pinned version or latest (default).

items*array<>
Items1 <= items <= 1000
language?string

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.

Lengthlength <= 35
filename_pattern?string

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.

Lengthlength <= 200
storage?|

Copy every item's file to one of your own buckets, as for a single render.

Response Body

OK

application/json
  1. response
id*string
object*unknown
status*string

queued → running → completed (ZIP ready), failed (nothing rendered, or the ZIP couldn't be built) or canceled.

Value in"queued""running""completed""failed""canceled"
template*string
version*number
filename_pattern*string|null
counts*

Items by outcome; pending is queued or rendering.

zip_url*|

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*number|null
zip_expires_at*|

When the ZIP is deleted (the file retention period).

error*|null
test_mode*boolean
created_at*string
Formatdate-time
finished_at*|null
Example Request
curl -X POST 'https://druckling-nine.vercel.app/v1/batches' \  -H 'Content-Type: application/json' \  -d '{  "template": "string",  "items": [    {      "data": {        "property1": null,        "property2": null      }    }  ]}'
Example Response202
{  "id": "string",  "object": "batch",  "status": "queued",  "template": "string",  "version": 0,  "filename_pattern": "string",  "counts": {    "total": 0,    "pending": 0,    "rendered": 0,    "failed": 0,    "canceled": 0  },  "zip_url": "string",  "zip_size_bytes": 0,  "zip_expires_at": "2019-08-24T14:15:22Z",  "error": {    "code": "string",    "message": "string"  },  "test_mode": true,  "created_at": "2019-08-24T14:15:22Z",  "finished_at": "2019-08-24T14:15:22Z"}