/v1/workspaces/{workspace_id}/notification-types/{type_id}/templates/{channel}/{locale}AuthCreate or replace a template
Sets the template of one channel and locale. Every change is kept as a version (the last 20); writing the same body again changes nothing. For `email`, the body names a Mail template (`mail_template_name`); setup status reports one that does not exist.
Path parameters
workspace_id*string · uuidId of the workspace.
type_id*string · uuidId of the type.
channel*enum (5)Template channel.
locale*stringTemplate locale (BCP 47).
Request body
body*objectThe channel template, field names as shown (stored and returned exactly as sent). Text fields use the Mustache subset `{{var}}`, `{{#section}}`, `{{^inverted}}` (no partials). `inbox`: `{title, body (Markdown), action_url?, avatar_url?, actions?: [{label, url? | action_key?}] (≤ 2)}`. `email`: `{mail_template_name, data_mapping?}` (the HTML lives in Mail; `data_mapping` maps Mail variables to Notify variables). `push`: `{title?, body, url?, image_url?, badge?: "unread_count" | number, sound?, thread_id?, data_only?, apns_overrides?, fcm_overrides?}`. `webpush`: `{title, body?, url?, icon?, tag?}`. URL fields must be https (http only for localhost). At most 32 KB.
Example: {"title":"Invoice {{invoice_id}} paid","body":"We received **{{amount}}**."}
Response · 200 Replaced (or unchanged).
channel*objectChannel.
locale*stringLocale (BCP 47).
Example: "pt-PT"
version*integerCurrent version.
updated_at*string · date-timeLast change.
body*objectThe channel template, field names as shown (stored and returned exactly as sent). Text fields use the Mustache subset `{{var}}`, `{{#section}}`, `{{^inverted}}` (no partials). `inbox`: `{title, body (Markdown), action_url?, avatar_url?, actions?: [{label, url? | action_key?}] (≤ 2)}`. `email`: `{mail_template_name, data_mapping?}` (the HTML lives in Mail; `data_mapping` maps Mail variables to Notify variables). `push`: `{title?, body, url?, image_url?, badge?: "unread_count" | number, sound?, thread_id?, data_only?, apns_overrides?, fcm_overrides?}`. `webpush`: `{title, body?, url?, icon?, tag?}`. URL fields must be https (http only for localhost). At most 32 KB.
variables*arrayVariables the template uses.
Example
Request
PUT https://api.notify.productcraft.co/v1/workspaces/{workspace_id}/notification-types/{type_id}/templates/{channel}/{locale}
Authorization: Bearer YOUR_TOKEN
Content-Type: application/json
{
"body": {
"title": "Invoice {{invoice_id}} paid",
"body": "We received **{{amount}}**."
}
}import { Notify } from "@productcraft/notify";
// Reads PRODUCTCRAFT_API_KEY and PRODUCTCRAFT_WORKSPACE_ID from the environment;
// client routes take a recipient token: notify.client({ token })
const notify = new Notify();
const template = await notify.notificationTypes.templates.update("3f0c3c1e-8a2b-4c55-9d3f-0a1b2c3d4e5f", "inbox", "pt-PT", { body: { body: "We received **{{amount}}**.", title: "Invoice {{invoice_id}} paid" } });notify.notificationTypes.templates.update(typeId, channel, locale, params, options?): Notify.Template
Response
{
"channel": {},
"locale": "pt-PT",
"version": 0,
"updated_at": "2026-01-01T00:00:00.000Z",
"body": {},
"variables": [
"string"
]
}