Render a template

POST
/v1/email_templates/{id}/render

Renders the draft (or a published version) with variables, exactly as a send would, and returns the subject, HTML and text: a preview, nothing is sent or stored. Without variables it renders the version's sample_variables.

Authorization

bearerAuth
headerAuthorizationBearer <token>

A secret API key from the dashboard: coss_live_… for production environments, coss_test_… for sandbox environments.

Path Parameters

id*string

The template's id or alias.

Header Parameters

Coss-Version?"2026-10-10"

The API version (a date) to use for this request. Defaults to your organization's version, pinned to the latest one when it first used the API and upgraded from the dashboard. The SDK always sends the version it was built for.

Value in"2026-10-10"

Request Body

application/json
  1. body

What to render: nothing is sent or stored.

version?integer

A published version to render. Default: the draft.

Range1 <= value
locale?string

The locale to render, e.g. "pt-BR". Falls back to the language ("pt"), then to the default locale, as sends do.

Lengthlength <= 35
variables?

Values by variable name, checked as a send checks them. Default: sample_variables.

Response Body

The rendered template.

application/json
  1. response
object*"email_template_render"
Value in"email_template_render"
template_id*string
version*|

The version rendered; null for the draft.

locale*string

The locale rendered.

subject*string
html*string|null
text*string|null
import { Coss } from "coss";const coss = new Coss({  apiKey: process.env.COSS_API_KEY,  baseUrl: "https://api.coss.com",});const { data, error } = await coss.email.templates.render("etpl_01k7c8m4q2f3e9v6t5r1n0p8yz", {  locale: "en",  variables: {    first_name: "Ada",  },});
{  "object": "email_template_render",  "template_id": "etpl_01k7c8m4q2f3e9v6t5r1n0p8yz",  "version": null,  "locale": "en",  "subject": "Welcome, Ada",  "html": "<p>Hi Ada, thanks for signing up!</p>",  "text": null}