POST
/v1/emails/compileCompile email
Bind JSON into a saved email letter and get inbox HTML. Compiled messages are not stored.
Overview
Use this after the host editor save, or with a template ID from the dashboard. The response includes HTML, a text alternative, and provider-shaped payloads for Resend, Mailgun, and Brevo. You send the message.
Scope
documents:generate. Email compile is metered
separately from PDF generation.Endpoint
POST https://api.shablonix.online/v1/emails/compile
Content-Type: application/json
Authorization: Bearer tf_live_your_api_key Request Body
| Parameter | Type | Required | Description |
|---|---|---|---|
template_id | string | One of | Saved email template ID |
template | object | One of | Inline letter. Use engine: "handlebars-html" |
data | object | Yes | JSON matching the letter bindings, not an unrelated host DTO |
Response
{
"id": "email_…",
"template_id": "cm…",
"subject": "Payment reminder · RC-2048",
"preheader": "Outstanding balance of €120.00 requires attention.",
"html": "<!doctype html>…",
"text": "Payment Reminder\n…",
"providers": {
"resend": { "subject": "…", "html": "…", "text": "…" },
"mailgun": { "subject": "…", "html": "…", "text": "…" },
"brevo": { "subject": "…", "htmlContent": "…", "textContent": "…" }
},
"stored": false,
"compiled_at": "2026-08-23T16:20:00.000Z"
} Code Examples
import { Shablonix } from '@shablonix/sdk';
const client = new Shablonix(process.env.SHABLONIX_API_KEY!);
const letter = await client.compileEmail({
templateId: 'cmEmailTemplateId',
data: {
customer: { name: 'Ada Lovelace' },
invoice: { number: 'INV-2048', total: '€149.00' },
},
});
await resend.emails.send({
from: 'billing@your-app.example',
to: 'ada@example.com',
...letter.providers.resend,
});