Email Templates

Preview an email template

POST/email-templates/{id}/actions/preview

Renders the template as the platform would send it and returns { "data": { "html", "subject" } }. The body can try content, subject, a theme and branding without saving: anything left out comes from the template as it is stored. It only reads, sends no email and emits no webhook, so there is nothing to undo. Use PATCH /email-templates/{id} to save changes.

Path parameters

  • idstringRequired#

    The template slug, such as user_welcome. It is the template's id. A leading underscore is accepted and ignored.

Headers

  • Idempotency-Keystring#

    Makes a retry safe. Send a new UUID for each new request and reuse it only to retry that request; the first response is replayed for 24 hours.

Request body

application/json, optional

  • contentstring | null#

    The content to render. Defaults to the content the template sends.

  • subjectstring | null#

    The subject to render. Defaults to the template's subject.

  • themestring | null#

    The email theme to render with, for this preview only. delio is the platform default, institutional is formal, boutique refined, family-office understated, heritage traditional, clean minimal and corporate structured. Defaults to the token organisation's theme: its own, its parent's, else delio.

    One of: delio, institutional, boutique, family-office, heritage, clean, corporate
  • brandingobject#

    Branding to render with in place of the organisation's own.

{
  "content": "<p>Welcome, {{contactForename}}.</p>",
  "theme": "corporate"
}

Responses

200

The rendered email.

{
  "data": {
    "html": "<html>...rendered email...</html>",
    "subject": "Welcome to the platform"
  }
}
401

Authentication failed. error.code is one of invalid_token, expired, revoked.

Error
403

Authorization failed. error.code is one of org_disabled, ip_blocked, missing_scope, scope_disabled, user_disabled.

Error
404

Resource not found (error.code = not_found).

Error
422

The request can't be processed (HTTP 422): validation_failed with one ErrorDetail per problem, or a code documented on the operation.

Error
429

Rate limit exceeded (error.code = rate_limited).

Error

Examples

curl -X POST https://your-org-domain/kong/core/api/v2/email-templates/{id}/actions/preview\
  -H "Authorization: Bearer $HELM_API_KEY"\
  -H "Content-Type: application/json"\
  -d '{
  "content": "<p>Welcome, {{contactForename}}.</p>",
  "theme": "corporate"
}'