---
title: "Render a template publication"
method: POST
path: "/v1/templates/{id}/publications/{publicationId}/render"
tags: ["Templates"]
---

# Render a template publication

`POST /v1/templates/{id}/publications/{publicationId}/render`

## Request

- Base URL: `https://api.samva.dev`
- URL: `https://api.samva.dev/v1/templates/{id}/publications/{publicationId}/render`
- Auth: API key in header `x-api-key`

Renders one immutable publication against the `data` you pass, formatted in the `locale` and `timeZone` you name as a send formats them, and returns the subject, preheader, HTML and plain text a send would produce. `data` is validated against the publication's input schema exactly as a send validates it; invalid input returns a validation error that names each failing field. Nothing is sent or stored. Unpublished workspace edits are never rendered: only a publication id renders.

## Path parameters

- `id` string, required
- `publicationId` string, required

## Request body

- RenderTemplatePublicationPayload
  - `data` object, required: The input to render with, validated against the publication's input schema.
  - `locale` string
  - `timeZone` string

## Response `200`

TemplatePublicationRender

- TemplatePublicationRender
  - `subject` string, required
  - `preheader` string
  - `html` string, required
  - `text` string, required

## Other responses

- `401`: UnauthorizedError
- `403`: ForbiddenError
- `404`: ResourceNotFoundError
- `409`: ConflictError
- `422`: ValidationError
- `500`: InternalError
- `504`: GatewayTimeoutError

---

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