Document AI — DMS

Update Document Template

Update an existing document generation template: HTML content, header/footer, page layout, metadata, variables_schema or is_active.

post/document_generation/template-update

Request

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

Request body

template_idstring required

Template ID to update (required).

namestring

Updated template display name.

html_contentstring

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

descriptionstring

Updated template description.

categorystring

Template category (e.g. invoices, contracts, reports).

variables_schemaobject

Schema describing expected merge-field variables; its required list is enforced 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 snippet rendered at the top of each page (max 512 KB).

footer_htmlstring

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

is_active0 | 1

1 = active template, 0 = deactivated (hidden from lists and generation).

engine'hbs_v2' | 'po_regex_v1'

Corporate plan and above: Template engine.

custom_cssstring

Corporate plan and above: CSS for the document.

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 the new version.

expected_versioninteger

Corporate plan and above: Optimistic lock: fail with HTTP 409 if the current version differs.

restore_versioninteger

Corporate plan and above: Create a new version with the content of this older version.

Response

Success

status'success' required
_billingobject

Changes

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