---
title: "Preview Document Template"
method: POST
path: "/document_generation/template-preview"
tags: ["Document AI — DMS"]
---

# Preview Document Template

`POST /document_generation/template-preview`

## Request

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

Render a template with variables (or its stored sample data) to a watermarked PDF (pdf_base64, max 8 MB) or to HTML (output=html) without storing a document and without the per-document price. Returns missing variables, unknown helpers...

## Request body

- object
  - `template_id` string: Stored template to preview.
  - `template_version` integer: Version to preview (default: current).
  - `variables` object: Variables to render; omit to use the stored sample_data.
  - `locale` string: Locale for numbers, dates and currency (e.g. de_DE, en_GB).
  - `output` 'pdf' | 'html': Preview format.
  - `html_content` string: Inline template instead of template_id.

## Response `200`

Success

- SuccessEnvelope: Success envelope. Payload fields are endpoint-specific (top-level fields, `result`/`job_result` for jobs, `data` on some account endpoints).
  - `status` 'success', required
  - `processing_time` union
    - string
    - number
  - `_billing` object

## Other responses

- `4XX`: Error
- `5XX`: Error

---

[API](https://skmtc.dev/paperoffice/apis/paperoffice-ai-api.md) · [All operations](https://skmtc.dev/paperoffice/apis/paperoffice-ai-api/llms.txt) · [OpenAPI document](https://skmtc.dev/paperoffice/apis/paperoffice-ai-api/revisions/c6a6228a4509?raw)
