Skip to navigation

Compose many documents from one template

View as Markdown

Renders the same template once per item — a run of invoices, contracts or letters from one call.

Every item’s data is validated first. If ANY item fails, nothing renders and the call answers 422 with an errors[] naming the failing item indexes and instance paths: a half-finished batch is worse than none.

{
"template": "invoice",
"items": [
{ "name": "acme-0042", "data": { "customer": "Acme", "total": 1240 } },
{ "name": "globex-0043", "data": { "customer": "Globex", "total": 990 } }
]
}

output decides what comes back:

  • files (the default) stores each PDF and returns the list. An item’s name names its file (<name>.pdf); without one the files are numbered from the template slug.
  • zip stores ONE archive holding every PDF and returns that single file.

A name must be a bare file name — no /, no \, no .., no leading dot — and two items may not end up with the same file name.

Learn more: Compose

Authentication

AuthorizationBearer

Bearer authentication of the form Bearer <token>, where token is your auth token.

Path parameters

spaceIdstringRequired

Request

This endpoint expects an object.
templatestringRequired>=1 character
itemslist of objectsRequired
outputenumOptional
Allowed values:

Response

The composed files, or the single zip file.
object"list"
datalist of objects

Errors

400
Bad Request Error
404
Not Found Error
413
Content Too Large Error
422
Unprocessable Entity Error
429
Too Many Requests Error