Render a template publication

Render a template publication. View request and response details for this Samva email API endpoint.

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

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.

Authorization

apiKey
headerx-api-key<token>

Path Parameters

id*string
Match^tmpl_[0-9a-hjkmnp-tv-z]{16,24}$
publicationId*string
Match^tpub_[0-9a-hjkmnp-tv-z]{16,24}$

Request Body

application/json
  1. body
data*

The input to render with, validated against the publication's input schema.

locale?RenderLocale
Lengthlength <= 64
timeZone?RenderTimeZone
Lengthlength <= 64

Response Body

TemplatePublicationRender

application/json
  1. response
subject*string
preheader?string
html*string
Lengthlength <= 2097152
text*string
Lengthlength <= 2097152
Example Request
import { 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"}

Related documentation