Render a template publication
Render a template publication. Request: POST /v1/templates/{id}/publications/{publicationId}/render. Scope: templates:read.
POST
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.
apiKeyheader
x-api-key<token>id*stringMatch
^tmpl_[0-9a-hjkmnp-tv-z]{16,24}$publicationId*stringMatch
^tpub_[0-9a-hjkmnp-tv-z]{16,24}$application/json- body
data*The input to render with, validated against the publication's input schema.
locale?RenderLocaleLength
length <= 64timeZone?RenderTimeZoneLength
length <= 64TemplatePublicationRender
application/json- response
subject*stringpreheader?stringhtml*stringLength
length <= 2097152text*stringLength
length <= 2097152import { createClient } from "samva";
const samva = createClient({ apiKey: process.env.SAMVA_API_KEY! });
const result = await samva.templates.renderPublication({
"id": "example",
"publicationId": "example",
"data": {}
});Example Response
{
"subject": "string",
"preheader": "string",
"html": "string",
"text": "string"
}