Aller au contenu principal

TemplateVersion

One version with its content, as reading, saving or publishing a version answers.

idstring<uuid>required

The version's own id (a UUID).

numberintegerrequired

The version number, counting from 1 per template.

statusstringrequired

published for the version renders use by default, archived for a version that was published before, draft for one never published.

Possible values: [draft, published, archived]

checksumstringrequired

Checksum of the content; send it as base_checksum to save the next version conditionally.

change_notestringnullablerequired
source_file objectnullablerequired

Word and PowerPoint templates: the file of this version; download it from /templates/{id}/versions/{which}/file. Null for other kinds.

sha256stringrequired

Possible values: Value must match regular expression ^[0-9a-f]{64}$

bytesintegerrequired

Possible values: >= 1

formatstringrequired

Possible values: [docx, pptx]

created_atstring<date-time>required
published_atstring<date-time>nullablerequired

When the version was last published; null for a draft.

htmlstringrequired

The body markup; empty for Word and PowerPoint templates.

cssstringrequired

Empty when there is none.

headstringrequired

Empty when there is none.

settings objectrequired

Rendering settings. A request's settings are deep-merged over the template's, which are merged over the defaults: only the keys you send change, and a section set to null (such as footer: null) is removed. The settings reference explains each key with examples.

paper object

PDF page size. Defaults to A4 portrait.

formatstring

A0 to A6, Letter, Legal, Tabloid or Ledger; A4 by default. Ignored when width and height are set.

Example: A4
widthstringnullable

Custom page width as a CSS length; needs height too.

Example: 100mm
heightstringnullable

Custom page height as a CSS length; needs width too.

Example: 150mm
landscapeboolean
Default value: false
margin object

Page margins as CSS lengths; 20mm top and bottom and 15mm left and right by default. Header and footer are drawn inside the top and bottom margin.

topstring
Example: 20mm
rightstring
Example: 15mm
bottomstring
Example: 20mm
leftstring
Example: 15mm
header objectnullable

Printed across the whole page width inside the top margin; null removes the template's.

htmlstring

Markup of the running header, rendered with the template's language and data. Elements with the classes pageNumber and totalPages show the page numbers.

heightstring

Height of the header box as a CSS length.

paddingstring

CSS padding inside the header box; 0 for designs that run edge to edge.

Default value: 0 10mm
footer objectnullable

Printed across the whole page width inside the bottom margin; null removes the template's.

htmlstring

Markup of the running footer, rendered like the header.

heightstring

Height of the footer box as a CSS length.

paddingstring

CSS padding inside the footer box; 0 for designs that run edge to edge.

Default value: 0 10mm
printBackgroundboolean

Print background colours and images.

Default value: true
scalenumber

Scales the page content, from 0.1 to 2.

Default value: 1
preferCssPageSizeboolean

Let @page rules in the CSS decide the page size instead of paper.

Default value: false
pageRangesstring

Keep only these pages of a PDF; empty keeps all. The page count, the plan's page limit and the units count the pages that are kept.

Default value:
Example: 1-3, 5
waitFor object

When the page counts as loaded, before it is printed or captured.

networkIdle object

auto waits for the load event, the fonts and the requests still running, and for half a second of network idle only on a URL or a document with scripts of its own. true always waits for that half second, false never does.

oneOf
boolean
selectorstringnullable

Wait until an element matching this CSS selector exists and is visible.

Default value: null
functionstringnullable

A JavaScript expression or function, evaluated in the page every 50 ms until its value is truthy: a function is called, a promise counts by what it resolves to, and an error counts as not yet. It shares timeoutMs with selector, which is waited for first. Still false then, the render fails with render_timeout, whose detail names the last error; text that is not JavaScript fails it at once with 400 invalid_request.

Possible values: <= 4096 characters

Default value: null
Example: () => window.chartsReady === true
timeoutMsinteger

How long to wait for selector and function together, in milliseconds, at most 30,000; then the render fails with render_timeout.

Possible values: >= 0

Default value: 5000
delayMsinteger

An extra pause after everything else, in milliseconds; a value above 10,000 counts as 10,000.

Possible values: >= 0

Default value: 0
tailwindboolean

Compile the Tailwind utility classes the document uses, for templates and plain html alike.

Default value: false
pdf object

PDF output only: what the file says about itself, and its structure for assistive technology.

metadata object

The document properties. The title is what a PDF reader shows in its title bar and a screen reader announces first; PDF/UA-1 requires one.

titlestring

Rendered with the data like the template, so it may use template expressions. Applies to stored templates, to html with an engine and to markdown, where it comes before the front matter's title and the first heading; a plain html or url render ignores it, so give such a page a <title> instead.

Example: Rechnung {{ invoice.number }}
authorstring

Rendered with the data like title for stored templates, html with an engine and markdown with an engine; written as given for plain html, url, markdown without an engine and Word and PowerPoint templates. A Markdown document's front matter fills it where the settings leave it empty.

Example: Fennlor Studio GmbH
subjectstring

Rendered like author.

keywordsstring

Rendered like author, as one text; left out of the file when it comes out empty.

taggedboolean

Writes the structure tree (headings, lists, tables, links) a screen reader reads the document by.

Default value: false
outlineboolean

Writes bookmarks from the headings.

Default value: false
ua objectnullable

Makes the file a PDF/UA-1 document (ISO 14289-1): tagged, repaired where the browser's output breaks the standard, and held against veraPDF's machine-checkable rules of PDF/UA-1. true is { "check": "strict" }. The render carries the verdict as accessibility, and the file names itself PDF/UA-1 only when it passed. A passed check does not make a document accessible: alternative texts, reading order and contrast are in the template. Cannot be combined with post.merge_after, and is not available for Word and PowerPoint templates; each answers 400 invalid_request. With an e-invoice the file is a PDF/A-3b and a PDF/UA-1 document at once: both are checked in the file that is delivered, and the render carries both reports. false in a request switches off what the template declares. Asked for by a request whose output is an image, it answers 400 too; declared by an image template it is ignored. No plan limit and no extra unit.

oneOf
boolean
pdfa objectnullable

Makes the file a PDF/A file (ISO 19005) for archiving: "2b" for PDF/A-2b, "3b" for PDF/A-3b, and true for "3b". The finished PDF is converted and held against veraPDF's rules of that level; the render carries the verdict as pdfa, and a file that fails is not delivered (422 pdfa_validation_failed, with the report). A merge, a watermark, the test mark, pdf.ua and Word and PowerPoint templates go with it. A password does not, since PDF/A forbids encryption, and an e-invoice is a PDF/A-3b already, so "2b" beside one is refused; each answers 400 invalid_request. PDF/A is a file format: whether an archive meets a law such as the GoBD depends on how it is run, not on the file. false in a request switches off what the template declares. Asked for by a request whose output is an image, it answers 400 too; declared by an image template it is ignored. Every plan, and no extra unit.

oneOf
boolean
image object

Image output (png, jpg, webp): the browser window the page is captured in.

widthinteger

Window width in CSS pixels; 1200 by default.

Example: 1200
heightinteger

Window height in CSS pixels; 630 by default.

Example: 630
deviceScaleFactornumber

Pixel density: 2 makes a 1200 × 630 window a 2400 × 1260 image.

Default value: 2
formatstring

Output of an image template when the request names no output. jpg is accepted as well.

Possible values: [png, jpeg, webp]

qualityinteger

JPEG and WebP quality; 90 by default.

Possible values: >= 1 and <= 100

fullPageboolean

Capture the whole height of the page instead of the window.

Default value: false
transparentboolean

Transparent background (PNG).

Default value: false
clipSelectorstringnullable

CSS selector of one element to capture instead of the window; the first match counts. When none appears within 30 seconds, the render fails with render_timeout.

Default value: null
office object

Word and PowerPoint templates. Page setup, margins, headers and footers come from the document; the Chromium settings above do not apply.

outputstring

Output when the request names none; the template's own format without it.

Possible values: [docx, pptx, pdf]

localestring

BCP 47 tag that formats dates and numbers, picks the translation dictionary and sets <html lang>; en-GB by default.

Example: de-DE
timezonestring

IANA time zone for dates; Europe/Berlin by default.

Example: Europe/Berlin
currencystring

ISO 4217 code the money helper uses when none is given; EUR by default.

Example: EUR
markdown objectnullable

How a markdown render looks and what raw HTML in its text does. Refused beside any other source, a template's included, and a stored template's settings.markdown is never read. The block is strict: an unknown key or a value that does not exist answers 400 invalid_request with its field, so a typo never prints the document in another look.

themestring

document sets headings, text, tables, code and quotes in the fonts the renderer has, and in the brand kit's fonts and primary colour where the organisation has one. none is the print reset alone, for a look of your own in css.

Possible values: [document, none]

Default value: document
htmlstring

safe shows raw HTML in the text as text, keeps <br> and a few formatting tags without attributes (sup, sub, kbd, mark, u, ins, del, s, small) and removes HTML comments. allow writes raw HTML as it stands, scripts included, as an html render does: for Markdown you wrote yourself. In both, links keep http, https, mailto, tel, relative addresses and anchors (an address with any other scheme makes no link, and its text stays), and pictures http, https, relative addresses (a file of the workspace library by name) and data:image/ in PNG, JPEG, GIF, WebP and SVG.

Possible values: [safe, allow]

Default value: safe
breaksboolean

A single line break becomes a line break in the document, as in a chat. Off by default, as in GitHub Flavored Markdown, where a paragraph ends at an empty line.

Default value: false
highlightboolean

A fenced code block whose info string names a language (ts, python) is coloured by highlight.js, in the document theme's colours; false prints code in the text's colour. A fence without a language, or with one highlight.js does not take, prints plain, and nothing is guessed. The languages are highlight.js's common set (Bash, C, C++, C#, CSS, Diff, Go, GraphQL, INI and TOML, Java, JavaScript, JSON, Kotlin, Less, Lua, Makefile, Markdown, Objective-C, Perl, PHP and PHP templates, Python and Python sessions, R, Ruby, Rust, SCSS, shell sessions, SQL, Swift, TypeScript, VB.NET, WebAssembly, XML and HTML, YAML) and Dockerfile and nginx, by their names and aliases (ts, sh, yml, html). A document colours its first 256 kB of code; a block over 100 kB, or with a line over 1,000 characters, prints plain. The classes are highlight.js's own (hljs-keyword), so the none theme with css takes any highlight.js stylesheet.

Default value: true
mathboolean

Formulas are typeset by KaTeX: $…$ and $`…`$ in a line, $$…$$ on lines of their own, and fenced blocks whose language is math. A $ opens a formula only before a character that is no space, and closes one only after such a character and not before a digit, so $5 and $10 stays text; \$ is a dollar sign. Off by default, because a $ in a business document is usually money. A formula is at most 4 kB of TeX, and a document holds at most 1,000 formulas and 256 kB of TeX in all. A formula that does not parse, uses a command that would link, load or write HTML (\href, \url, \includegraphics, \htmlClass), or is past a limit fails the render with markdown_syntax_error, which names its line. \gdef defines a macro for the rest of the document. In a PDF/UA-1 file each formula is a Formula whose alternative text is its TeX.

Default value: false
diagramsboolean

A fenced block whose language is mermaid is drawn by Mermaid (flowcharts, sequences, states, classes, entities, Gantt charts, pies and the other kinds Mermaid draws), in the document's font, with the brand kit's primary colour on borders where the organisation has one. Off by default, because Mermaid is a large script that runs on the text. Labels are text, links and clicks are off. A document holds at most 50 diagrams of 50 kB each, and Mermaid takes at most 500 edges a diagram. A diagram that cannot be drawn fails the render with markdown_syntax_error, which names its line; drawing takes the render's time like anything else in the page, so a document of very large diagrams can answer render_timeout. Give each diagram accTitle (and accDescr): they are its name, which a PDF/UA-1 file needs.

Default value: false
cssstring

A stylesheet that comes after the theme, at most 256 kB. The converter writes the document into <div class="ff-markdown">.

Possible values: <= 262144 characters

einvoice objectnullable

Makes the template an invoice template: every PDF rendered from it is a ZUGFeRD / Factur-X e-invoice built from the _invoice block of the data, as if the request said post.einvoice. A request's settings.einvoice and post.einvoice merge over it field by field; post.einvoice: false switches it off for one request. Image output of the same template is not affected. false in a request switches off what the template declares.

oneOf

What kind of e-invoice a render makes. Every field has a default, so {} asks for a Factur-X invoice in the EN 16931 profile.

profilestring

en16931 carries every field of the European standard; basic is the smallest profile that is an invoice on its own. Any other profile answers 422 einvoice_profile_unsupported.

Possible values: [basic, en16931]

Default value: en16931
flavourstring

ZUGFeRD and Factur-X are one specification under two names, and the file is the same. The choice decides the name and release the render reports (Factur-X 1.09 or ZUGFeRD 2.5).

Possible values: [factur-x, zugferd]

Default value: factur-x
xmlstring

both stores the XML as a file of its own beside the PDF, kept and deleted with it; the render links it as einvoice.xml_url. A test render on a plan without e-invoices (Free) keeps no such file: it delivers the marked PDF alone, and xml_url is null.

Possible values: [embedded, both]

Default value: embedded
display_checkstring

What happens when the PDF does not show a value of the XML (the invoice number, the totals): warn reports it in einvoice.display.missing, strict fails the render with 422 einvoice_display_mismatch.

Possible values: [warn, strict]

Default value: warn
design object

The visual editor's layers of an image template, stored with a version. Authoring data only: renders use the version's HTML and CSS, which the editor writes from it, and a render request's design is ignored. Kept as it is when you copy a version; at most 256 kB. See the visual editor guide.

property name*any

The visual editor's layers of an image template, stored with a version. Authoring data only: renders use the version's HTML and CSS, which the editor writes from it, and a render request's design is ignored. Kept as it is when you copy a version; at most 256 kB. See the visual editor guide.

property name*any

Rendering settings. A request's settings are deep-merged over the template's, which are merged over the defaults: only the keys you send change, and a section set to null (such as footer: null) is removed. The settings reference explains each key with examples.

sample_data objectrequired

{} when there is none.

property name*any

{} when there is none.

data_schema objectnullablerequired
property name*anynullable
i18n objectnullablerequired
property name*anynullable
data_sets objectrequired

The named sample data sets besides sample_data (name → data); {} when there are none.

property name*any

The named sample data sets besides sample_data (name → data); {} when there are none.

partials objectrequired

Partials the template includes (name → source); {} when there are none.

property name*string
schema_check object

Only when the request published the version: how the data schema changed against the version callers used before.

sourcestringrequired

Possible values: [stored, inferred, none]

breaking object[]required
  • Array [
  • pathstringrequired

    Dotted field path; items[] for array elements, empty for the data itself.

    Example: customer.email
    pointerstringrequired
    Example: /properties/customer/properties/email
    kindstringrequired

    Possible values: [field-added-required, field-added-optional, field-removed, field-became-required, field-became-optional, type-narrowed, type-widened, enum-values-removed, enum-values-added, enum-added, enum-removed, const-changed, constraint-tightened, constraint-relaxed, additional-properties-closed, additional-properties-opened, keyword-changed]

    breakingbooleanrequired
    messagestringrequired
    Example: "customer.email" is now required
  • ]
  • safe object[]required
  • Array [
  • pathstringrequired

    Dotted field path; items[] for array elements, empty for the data itself.

    Example: customer.email
    pointerstringrequired
    Example: /properties/customer/properties/email
    kindstringrequired

    Possible values: [field-added-required, field-added-optional, field-removed, field-became-required, field-became-optional, type-narrowed, type-widened, enum-values-removed, enum-values-added, enum-added, enum-removed, const-changed, constraint-tightened, constraint-relaxed, additional-properties-closed, additional-properties-opened, keyword-changed]

    breakingbooleanrequired
    messagestringrequired
    Example: "customer.email" is now required
  • ]
  • TemplateVersion
    {
    "id": "3fa85f64-5717-4562-b3fc-2c963f66afa6",
    "number": 0,
    "status": "draft",
    "checksum": "string",
    "change_note": "string",
    "source_file": {
    "sha256": "string",
    "bytes": 0,
    "format": "docx"
    },
    "created_at": "2024-07-29T15:51:28.071Z",
    "published_at": "2024-07-29T15:51:28.071Z",
    "html": "string",
    "css": "string",
    "head": "string",
    "settings": {
    "paper": {
    "format": "A4",
    "width": "100mm",
    "height": "150mm",
    "landscape": false
    },
    "margin": {
    "top": "20mm",
    "right": "15mm",
    "bottom": "20mm",
    "left": "15mm"
    },
    "header": {
    "html": "string",
    "height": "string",
    "padding": "0 10mm"
    },
    "footer": {
    "html": "string",
    "height": "string",
    "padding": "0 10mm"
    },
    "printBackground": true,
    "scale": 1,
    "preferCssPageSize": false,
    "pageRanges": "1-3, 5",
    "waitFor": {
    "networkIdle": true,
    "selector": null,
    "function": "() => window.chartsReady === true",
    "timeoutMs": 5000,
    "delayMs": 0
    },
    "tailwind": false,
    "pdf": {
    "metadata": {
    "title": "Rechnung {{ invoice.number }}",
    "author": "Fennlor Studio GmbH",
    "subject": "string",
    "keywords": "string"
    },
    "tagged": false,
    "outline": false,
    "ua": true,
    "pdfa": true
    },
    "image": {
    "width": 1200,
    "height": 630,
    "deviceScaleFactor": 2,
    "format": "png",
    "quality": 0,
    "fullPage": false,
    "transparent": false,
    "clipSelector": null
    },
    "office": {
    "output": "docx"
    },
    "locale": "de-DE",
    "timezone": "Europe/Berlin",
    "currency": "EUR",
    "markdown": {
    "theme": "document",
    "html": "safe",
    "breaks": false,
    "highlight": true,
    "math": false,
    "diagrams": false,
    "css": "string"
    },
    "einvoice": {
    "profile": "en16931",
    "flavour": "factur-x",
    "xml": "embedded",
    "display_check": "warn"
    },
    "design": {}
    },
    "sample_data": {},
    "data_schema": {},
    "i18n": {},
    "data_sets": {},
    "partials": {},
    "schema_check": {
    "source": "stored",
    "breaking": [
    {
    "path": "customer.email",
    "pointer": "/properties/customer/properties/email",
    "kind": "field-added-required",
    "breaking": true,
    "message": "\"customer.email\" is now required"
    }
    ],
    "safe": [
    {
    "path": "customer.email",
    "pointer": "/properties/customer/properties/email",
    "kind": "field-added-required",
    "breaking": true,
    "message": "\"customer.email\" is now required"
    }
    ]
    }
    }