Document AI — DMS

Create Document Template

Create a reusable document generation template (HTML with {{placeholder}} merge fields) for po_documents_create_from_template.

post/document_generation/template-create

Request

  • Base URL: https://api.paperoffice.ai/latest
  • URL: https://api.paperoffice.ai/latest/document_generation/template-create
  • Auth: HTTP bearer

Request body

template_idstring

Optional template ID (auto-generated from name when omitted).

namestring required

Display name for the template.

html_contentstring required

HTML body with {{variable}} placeholders for merge fields (max 5 MB).

descriptionstring

Optional template description.

categorystring

Category (e.g. invoices, contracts, reports).

variables_schemaobject

Schema of expected template variables; fields in its required list must be present and non-empty when generating.

page_formatstring

Page size (A4, A3, A5, Letter, Legal).

page_orientation'portrait' | 'landscape'

Page orientation: portrait or landscape.

margin_topinteger

Top page margin in millimeters.

margin_rightinteger

Right page margin in millimeters.

margin_bottominteger

Bottom page margin in millimeters.

margin_leftinteger

Left page margin in millimeters.

header_htmlstring

HTML rendered at the top of each page (max 512 KB).

footer_htmlstring

HTML rendered at the bottom of each page (max 512 KB).

engine'hbs_v2' | 'po_regex_v1'

Corporate plan and above: Template engine: hbs_v2 (conditions, loops, paths, locale helpers) or po_regex_v1 (legacy).

custom_cssstring

Corporate plan and above: CSS for the document (url() and @import are removed).

sample_dataobject

Corporate plan and above: Sample variables for preview and validation.

locale_defaultstring

Corporate plan and above: Default locale (e.g. de_DE).

title_patternstring

Corporate plan and above: Default document title with placeholders.

image_datastring

Corporate plan and above: Template image for the app: https URL or PNG/JPEG/WebP/SVG data URI (max 2 MB); empty string removes it.

change_notestring

Corporate plan and above: Note stored with version 1.

Response

Success

status'success' required
_billingobject

Changes

No recorded changes to this operation across all 1 revision of this API.