---
title: "Render a template preview"
method: POST
path: "/templates/{templateKey}/render"
tags: ["templates"]
---

# Render a template preview

`POST /templates/{templateKey}/render`

## Request

- Base URL: `https://api.mailly.site` (the document declares no server; this is the origin it was published from)
- URL: `https://api.mailly.site/templates/{templateKey}/render`
- Auth: HTTP bearer

## Path parameters

- `templateKey` string, required: template stable key

## Request body

- object
  - `version` number: Published version number
  - `draft` boolean: Render the draft (mutually exclusive with version)
  - `locale` string
  - `variables` object

## Response `200`

Render result

- object
  - `success` boolean, required
  - `templateKey` string, required
  - `version` union, required
    - number
    - string
  - `rendered` object, required

## Other responses

- `400`: Invalid parameters
- `401`: Missing or invalid API key
- `404`: Template not found

---

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