---
title: "Compile template"
method: POST
path: "/api/templates.compile"
---

# Compile template

`POST /api/templates.compile`

Compiles an MJML template with provided data, returning the rendered HTML. Useful for previewing templates before saving.

## Request body

- CompileTemplateRequest
  - `template_content` object, required — MJML template structure to compile
  - `template_data` object, required — Data to use for Liquid templating

## Response `200`

Template compiled successfully

- CompileTemplateResponse
  - `html` string — Compiled HTML output
  - `errors` string[] — Compilation errors, if any

## Other responses

- `400` — Bad request - compilation failed
- `401` — Unauthorized - invalid or missing authentication token
- `500` — Internal server error

## Changes

- **2025-11-14** `940c5636d0b4` — 1 info
  - endpoint added

[Change history](https://skmtc.dev/pierre-b/apis/notifuse-api/changes/api/templates.compile/post.md)

---

[API](https://skmtc.dev/pierre-b/apis/notifuse-api.md) · [All operations](https://skmtc.dev/pierre-b/apis/notifuse-api/llms.txt) · [OpenAPI document](https://skmtc-service-production.skmtc.workers.dev/v1/apis/pierre-b/notifuse-api/revisions/c39acad12e49/schema)
