Skip to navigation

Compose a document from a template and data

View as Markdown

Renders one of your saved compose templates with the data you pass, and gives you back a PDF.

template is the config id or slug from POST /v1/compose/configs. data is validated against that template’s JSON Schema BEFORE anything renders, so a missing field costs you a 422 with the exact instance paths, not a broken document.

{ "template": "invoice", "data": { "customer": "Acme", "total": 1240 } }

output decides what comes back:

  • file (the default) stores the PDF in your corpus and returns the file object, with the templateHash of the exact bundle that produced it.
  • raw streams the PDF bytes straight back and stores nothing.

Learn more: Compose

Authentication

AuthorizationBearer

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

Request

This endpoint expects an object.
templatestringRequired>=1 character
datamap from strings to anyRequired
outputenumOptional
Allowed values:

Response

The PDF bytes (output: "raw" only — nothing was stored).

Errors

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