---
title: "Renders (possibly unsaved) editor sections through the real production pipeline — sample data, regional compliance blocks, QuestPDF — and returns one PNG per page. More than one page on a fixed-size label format means the content overflows the label."
method: POST
path: "/templates/render-preview"
tags: ["Templates"]
---

# Renders (possibly unsaved) editor sections through the real production pipeline — sample data, regional compliance blocks, QuestPDF — and returns one PNG per page. More than one page on a fixed-size label format means the content overflows the label.

`POST /templates/render-preview`

## Request

- Base URL: `https://api.clinicos.vet/backend/business`
- URL: `https://api.clinicos.vet/backend/business/templates/render-preview`
- Auth: HTTP bearer
- TypeScript: <https://skmtc.dev/clinicos/apis/pawthosx-business-api-v1/docs/templates/render-preview/post.ts> (a function with typed inputs; its response is checked against the schema)

## Request body

- RenderTemplatePreviewRequestDto: Request to render a live preview of (possibly unsaved) template editor state through the real production render pipeline.
  - `sections` TemplateSectionDto[]
    - `id` string
    - `type` string
    - `content` string
    - `order` union
      - integer
      - string, int32
    - `columns` TemplateSectionDto[], nullable
    - `widthPercent` union
      - number, double
      - string, double
  - `format` string, nullable: Physical output format, e.g. "bottle-label". Null falls back to the default.
  - `type` string, nullable: Template type, e.g. "labels". For labels the preview includes the region-mandated compliance blocks appended at print time.
  - `category` string, nullable: Client-message category; scopes which tokens get sample values.
  - `emailSubject` string, nullable
  - `emailBody` string, nullable
  - `smsBody` string, nullable

## Response `200`

OK

- TemplatePreviewResultDto: Server-rendered template preview: one PNG per output page plus the physical page dimensions. More than one page on a fixed-size label format means the content overflows the label.
  - `pages` string[]: Base64-encoded PNG per rendered page.
  - `pageCount` union
    - integer
    - string, int32
  - `widthMm` union
    - number, float
    - string, float
  - `heightMm` union
    - number, float
    - string, float
  - `dpi` union
    - integer
    - string, int32
  - `emailSubject` string, nullable: Client-message previews only: the subject with sample data substituted.
  - `emailBody` string, nullable: Client-message previews only: the email body with sample data substituted.
  - `smsBody` string, nullable: Client-message previews only: the SMS body with sample data substituted.
  - `unknownVariables` string[], nullable: Client-message previews only: tokens left as written because they aren't merge fields for the category. Null when there are none.

## Changes

- **2026-10-28** `099cf36186e0`: 24 info
  - added the new optional request property `category` (media type: application/json)
  - added the new optional request property `category` (media type: text/json)
  - added the new optional request property `category` (media type: application/*+json)
  - added the new optional request property `emailBody` (media type: application/json)
  - …20 more

[Operation history](https://skmtc.dev/clinicos/apis/pawthosx-business-api-v1/changes/templates/render-preview/post.md)

---

[API](https://skmtc.dev/clinicos/apis/pawthosx-business-api-v1.md) - [All operations](https://skmtc.dev/clinicos/apis/pawthosx-business-api-v1/llms.txt) - [OpenAPI document](https://skmtc.dev/clinicos/apis/pawthosx-business-api-v1/revisions/099cf36186e0?raw)
