Skip to content

Render a template to PDF

POST
/render/template
curl --request POST \
--url http://localhost:8080/render/template \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '{ "data": {}, "template": { "version": 2, "config": { "title": "example", "page": { "size": { "format": "A3", "orientation": "portrait" }, "locale": "example", "margins": { "top": 1, "right": 1, "bottom": 1, "left": 1 }, "pageNumbers": { "enabled": true, "position": "left" }, "background": { "src": "example", "type": "auto" }, "footer": { "repeat": true, "rows": [ { "blocks": [ { "type": "text", "id": "example", "text": "example", "config": { "typography": { "family": "example", "size": 1, "weight": "300", "align": "left", "color": "example" }, "spacing": { "top": 1, "right": 1, "bottom": 1, "left": 1 }, "width": "example", "align": "left" } } ] } ] } }, "typography": { "family": "example", "size": 1, "weight": "300", "align": "left", "color": "example" }, "embedColorProfile": true }, "fonts": { "additionalProperty": { "src": "example", "weight": "example", "style": "example" } }, "attachments": [ { "name": "example", "content": "example", "mimeType": "example", "description": "example", "relationship": "example" } ], "rows": [ { "blocks": [ { "type": "text", "id": "example", "text": "example", "config": { "typography": { "family": "example", "size": 1, "weight": "300", "align": "left", "color": "example" }, "spacing": { "top": 1, "right": 1, "bottom": 1, "left": 1 }, "width": "example", "align": "left" } } ] } ] } }'

Renders a JSON template to a PDF/A-3a document, or a JSON validation response when Accept is application/json.

X-Upload-Url
string

Presigned PUT URL that receives the generated document.

Media type application/json
object
data

Per-block content overrides, keyed by block id. Object for most blocks; array of row objects for tables.

object
template
required
Template
object
version
required
integer
Allowed value: 2
config
TemplateConfig
object
title

Document title. Used as the PDF document title, which PDF/UA requires.

string
page
PageConfig
object
size
One of:
PresetPageSize
object
format
PageFormat
string
Allowed values: A3 A4 A5 A6 Letter Legal Tabloid
orientation
Orientation
string
Allowed values: portrait landscape
locale
string
margins
SpacingConfig
object
top

Top spacing in millimetres.

integer | null
right

Right spacing in millimetres.

integer | null
bottom

Bottom spacing in millimetres.

integer | null
left

Left spacing in millimetres.

integer | null
pageNumbers
PageNumbersConfig
object
enabled
boolean
position
Align
string
Allowed values: left center right
background
One of:
PageBackgroundConfig
object
src
required

HTTP, HTTPS, or base64 data URI for an image or PDF page background.

string
>= 1 characters
type
PageBackgroundType
string
Allowed values: auto image pdf
footer
PageFooterConfig
object
repeat
boolean
rows
Array<object>
Row
object
blocks
required
Array
One of:
TextBlock
object
type
required
string
Allowed value: text
id

Stable block identifier used for runtime data overrides.

string | null
text
required
string
config
BlockConfig
object
typography
One of:
TypographyConfig
object
family

Bundled or external font family key.

string | null
size

Font size in points.

integer | null
>= 1
weight

Font weight; one of the FontWeight enum values.

string | null
Allowed values: 300 400 500 600 700
align

Text alignment for this typography scope.

string | null
Allowed values: left center right
color

CSS color value used for text.

string | null
spacing
One of:
SpacingConfig
object
top

Top spacing in millimetres.

integer | null
right

Right spacing in millimetres.

integer | null
bottom

Bottom spacing in millimetres.

integer | null
left

Left spacing in millimetres.

integer | null
width

CSS width for this block, such as 50%, 80mm, or auto.

string | null
/^(auto|\d+(\.\d+)?(mm|cm|in|px|pt|pc|em|rem|%|vw|vh|ch))$/
align

Horizontal placement of this block within its row cell.

string | null
Allowed values: left center right
typography
TypographyConfig
object
family

Bundled or external font family key.

string | null
size

Font size in points.

integer | null
>= 1
weight

Font weight; one of the FontWeight enum values.

string | null
Allowed values: 300 400 500 600 700
align

Text alignment for this typography scope.

string | null
Allowed values: left center right
color

CSS color value used for text.

string | null
embedColorProfile

Embed the PDF/A ICC color profile. Disable only for PDF/UA-without-PDF/A output.

boolean
fonts

External fonts keyed by font family name.

object
key
additional properties
FontFace
object
src
required
string
weight

One or more whitespace-separated FontWeight values, e.g. “400” or “400 700”.

string
style
string
attachments
Array<object>
FileAttachment
object
name
required
string
content
required

Base64-encoded file content.

string
mimeType
string
description
string | null
relationship
string
rows
Array<object>
Row
object
blocks
required
Array
One of:
TextBlock
object
type
required
string
Allowed value: text
id

Stable block identifier used for runtime data overrides.

string | null
text
required
string
config
BlockConfig
object
typography
One of:
TypographyConfig
object
family

Bundled or external font family key.

string | null
size

Font size in points.

integer | null
>= 1
weight

Font weight; one of the FontWeight enum values.

string | null
Allowed values: 300 400 500 600 700
align

Text alignment for this typography scope.

string | null
Allowed values: left center right
color

CSS color value used for text.

string | null
spacing
One of:
SpacingConfig
object
top

Top spacing in millimetres.

integer | null
right

Right spacing in millimetres.

integer | null
bottom

Bottom spacing in millimetres.

integer | null
left

Left spacing in millimetres.

integer | null
width

CSS width for this block, such as 50%, 80mm, or auto.

string | null
/^(auto|\d+(\.\d+)?(mm|cm|in|px|pt|pc|em|rem|%|vw|vh|ch))$/
align

Horizontal placement of this block within its row cell.

string | null
Allowed values: left center right

PDF document or JSON validation response

string format: binary

PDF uploaded successfully

Invalid template, data, request, or JSON/upload conflict

Rendering failed

Upload target rejected the request or was unreachable