Skip to main content
PUT

Upsert Email Template

Sets your business’s custom subject/body for a B2B email type, replacing Khaime’s default for all future sends of that type. Keyed by (business_id, template_type) — calling this again for the same type updates the existing override rather than creating a duplicate.

Path Parameters

string
required
One of the 11 legacy B2B type names — see Get Default Template for the full list.

Request Body

string
required
Internal label for this template, max 100 characters. Not shown to customers.
string
required
Email subject line, max 255 characters. Supports {{variable}} placeholders — see Template Variables below.
string
required
Full HTML email body. Supports the same {{variable}} placeholders as subject, plus conditional blocks (see below).
boolean
default:"true"
Set false to save a draft without it taking effect — Khaime’s default is still used for sends while is_active is false.

Response

Returns 200 even when this call creates a new override for the first time — not 201.
Note template_type in the response is Khaime’s internal mapped name (e.g. b2b_quote_sent), not the quote_sent short name you passed in the URL.

Template Variables

Rendering is a plain string substitution, not a full template engine: {{key}} is replaced with the value if present, and left as empty string if that key has no value for this send (there’s no error or fallback text — a typo in a variable name silently renders as nothing, it won’t throw).
Conditional block. The enclosed content is kept only if key has a truthy value for this send; otherwise the whole block (including its contents) is stripped. Use this for optional sections — e.g. only show a rejection reason when one exists.
Only a subset of variables is populated per event — which ones depend on the template type. Passing a variable that isn’t relevant to that event type just renders empty.
Preview Email Template renders against a fixed set of sample values covering most of these keys — use it to sanity-check your placeholders before saving, but note its sample data doesn’t cover every conditional field (e.g. rejection_reason isn’t populated in preview mode).

Error Codes