Document AI — DMS

Create Document from Template

Create a new PDF document in a workspace from a document generation template and store it in the DMS.

post/document_generation/create-from-template

Request

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

Request body

template_idstring required

Template ID from po_templates_list (e.g. tpl_invoice_standard_1a2b3c4d).

variablesobject required

Template placeholder values as a JSON object, not an array. Required. JSON [] returns HTTP 400 VARIABLES_INVALID. Empty object {} is allowed and then checked against variables_schema.required. Fields listed in the template variables_schema.required must be present and non-empty or the call returns HTTP 400 and creates no document. Extra keys are allowed. Arrays for {{#each}} blocks.

output_format'pdf'

Rendered output format. Only pdf is available.

workspace_idinteger required

Target workspace ID (required). Use po_workspaces_list to find valid workspace IDs. The caller needs upload rights in this workspace.

titlestring

Document title (overrides the template name). May contain {{variable}} placeholders.

metadataobject

Additional metadata stored as document meta fields.

auto_classifyboolean

When true, order AI-DMS processing for the generated document (billed separately).

ai_dms_tier'basic' | 'premium' | 'ultra'

AI-DMS tier used when auto_classify is true and the workspace does not order AI-DMS automatically.

processing_lane'no_sla' | 'sla_24h' | 'sla_12h' | 'sla_6h' | 'sla_1h' | 'instant'

Start-SLA lane (wait-to-start guarantee, not completion). Values: no_sla (fair use ×1), sla_24h (×1.5), sla_12h (×2), sla_6h (×3), sla_1h (×4), instant (×5 interactive start). Prefer this over legacy numeric priority. If omitted: workspace default_processing_lane, else no_sla.

template_versioninteger

Corporate plan and above: Pin a template version (default: current). List versions with po_templates_versions_list.

localestring

Corporate plan and above: Locale for numbers, dates and currency (e.g. de_DE, en_GB). Default: template locale, then workspace locale.

idempotency_keystring

Corporate plan and above: Retry-safe key: the same key with the same request returns the first document (HTTP 200, no second charge); with a different request HTTP 409.

Response

Success

status'success' required
_billingobject

Changes

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