import Courier from '@trycourier/courier';
const client = new Courier({
apiKey: process.env['COURIER_API_KEY'], // This is the default and can be omitted
});
const notificationTemplateResponse = await client.notifications.create({
notification: {
name: 'Welcome Email',
tags: ['onboarding', 'welcome'],
brand: { id: 'bnd_01kx4mrd0pfzw8wt7pn7p2fzag' },
subscription: { topic_id: 'pt_01kx4h2jdafq8bk9a26x0kvd1t' },
routing: { strategy_id: 'rs_01kx4h2jdafq8bk9amzvy6hbv0' },
content: {
version: '2022-01-01',
elements: [
{
type: 'channel',
channel: 'email',
elements: [
{ type: 'meta', title: 'Welcome!' },
{ type: 'text', content: 'Hello {{data.name}}.' },
],
},
],
},
alias: 'welcome',
},
state: 'DRAFT',
});
console.log(notificationTemplateResponse);import os
from courier import Courier
client = Courier(
api_key=os.environ.get("COURIER_API_KEY"), # This is the default and can be omitted
)
notification_template_response = client.notifications.create(
notification={
"name": "Welcome Email",
"tags": ["onboarding", "welcome"],
"brand": {
"id": "bnd_01kx4mrd0pfzw8wt7pn7p2fzag"
},
"subscription": {
"topic_id": "pt_01kx4h2jdafq8bk9a26x0kvd1t"
},
"routing": {
"strategy_id": "rs_01kx4h2jdafq8bk9amzvy6hbv0"
},
"content": {
"version": "2022-01-01",
"elements": [{
"type": "channel",
"channel": "email",
"elements": [{
"type": "meta",
"title": "Welcome!",
}, {
"type": "text",
"content": "Hello {{data.name}}.",
}],
}],
},
"alias": "welcome",
},
state="DRAFT",
)
print(notification_template_response)package main
import (
"context"
"fmt"
"github.com/trycourier/courier-go/v4"
"github.com/trycourier/courier-go/v4/option"
"github.com/trycourier/courier-go/v4/shared"
)
func main() {
client := courier.NewClient(
option.WithAPIKey("My API Key"),
)
notificationTemplateResponse, err := client.Notifications.New(context.TODO(), courier.NotificationNewParams{
NotificationTemplateCreateRequest: courier.NotificationTemplateCreateRequestParam{
Notification: courier.NotificationTemplateWritePayloadParam{
NotificationTemplatePayloadParam: courier.NotificationTemplatePayloadParam{
Brand: courier.NotificationTemplatePayloadBrandParam{
ID: "bnd_01kx4mrd0pfzw8wt7pn7p2fzag",
},
Content: shared.ElementalContentParam{
Elements: []shared.ElementalNodeUnionParam{{
OfElementalTextNodeWithType: &shared.ElementalTextNodeWithTypeParam{
ElementalTextNodeParam: shared.ElementalTextNodeParam{
ElementalBaseNodeParam: shared.ElementalBaseNodeParam{},
},
},
}},
Version: "2022-01-01",
},
Name: "Welcome Email",
Routing: courier.NotificationTemplatePayloadRoutingParam{
StrategyID: "rs_01kx4h2jdafq8bk9amzvy6hbv0",
},
Subscription: courier.NotificationTemplatePayloadSubscriptionParam{
TopicID: "pt_01kx4h2jdafq8bk9a26x0kvd1t",
},
Tags: []string{"onboarding", "welcome"},
},
},
},
})
if err != nil {
panic(err.Error())
}
fmt.Printf("%+v\n", notificationTemplateResponse)
}
package com.courier.example;
import com.courier.client.CourierClient;
import com.courier.client.okhttp.CourierOkHttpClient;
import com.courier.models.ElementalContent;
import com.courier.models.ElementalTextNodeWithType;
import com.courier.models.notifications.NotificationTemplateCreateRequest;
import com.courier.models.notifications.NotificationTemplatePayload;
import com.courier.models.notifications.NotificationTemplateResponse;
import com.courier.models.notifications.NotificationTemplateWritePayload;
public final class Main {
private Main() {}
public static void main(String[] args) {
CourierClient client = CourierOkHttpClient.fromEnv();
NotificationTemplateCreateRequest params = NotificationTemplateCreateRequest.builder()
.notification(NotificationTemplateWritePayload.builder()
.brand(NotificationTemplatePayload.Brand.builder()
.id("bnd_01kx4mrd0pfzw8wt7pn7p2fzag")
.build())
.content(ElementalContent.builder()
.addElement(ElementalTextNodeWithType.builder().build())
.version("2022-01-01")
.build())
.name("Welcome Email")
.routing(NotificationTemplatePayload.Routing.builder()
.strategyId("rs_01kx4h2jdafq8bk9amzvy6hbv0")
.build())
.subscription(NotificationTemplatePayload.Subscription.builder()
.topicId("pt_01kx4h2jdafq8bk9a26x0kvd1t")
.build())
.addTag("onboarding")
.addTag("welcome")
.build())
.build();
NotificationTemplateResponse notificationTemplateResponse = client.notifications().create(params);
}
}require "courier"
courier = Courier::Client.new(api_key: "My API Key")
notification_template_response = courier.notifications.create(
notification: {
brand: {id: "bnd_01kx4mrd0pfzw8wt7pn7p2fzag"},
content: {elements: [{}], version: "2022-01-01"},
name: "Welcome Email",
routing: {strategy_id: "rs_01kx4h2jdafq8bk9amzvy6hbv0"},
subscription: {topic_id: "pt_01kx4h2jdafq8bk9a26x0kvd1t"},
tags: ["onboarding", "welcome"]
}
)
puts(notification_template_response)<?php
require_once dirname(__DIR__) . '/vendor/autoload.php';
use Courier\Client;
use Courier\TextStyle;
use Courier\Core\Exceptions\APIException;
$client = new Client(apiKey: getenv('COURIER_API_KEY') ?: 'My API Key');
try {
$notificationTemplateResponse = $client->notifications->create(
notification: [
'brand' => ['id' => 'bnd_01kx4mrd0pfzw8wt7pn7p2fzag'],
'content' => [
'elements' => [
[
'channels' => ['string'],
'if' => 'if',
'loop' => 'loop',
'ref' => 'ref',
'channel' => 'email',
'elements' => [
[
'channels' => ['string'],
'if' => 'if',
'loop' => 'loop',
'ref' => 'ref',
'title' => 'Welcome!',
'type' => 'meta',
],
[
'channels' => ['string'],
'if' => 'if',
'loop' => 'loop',
'ref' => 'ref',
'align' => 'left',
'bold' => 'bold',
'color' => 'color',
'content' => 'Hello {{data.name}}.',
'fontSize' => 'font_size',
'format' => 'markdown',
'italic' => 'italic',
'lineHeight' => 'line_height',
'locales' => ['foo' => ['content' => 'content']],
'strikethrough' => 'strikethrough',
'textStyle' => TextStyle::TEXT,
'underline' => 'underline',
'type' => 'text',
],
],
'fontSize' => 'font_size',
'lineHeight' => 'line_height',
'padding' => 'padding',
'raw' => ['foo' => 'bar'],
'type' => 'channel',
],
],
'version' => '2022-01-01',
],
'name' => 'Welcome Email',
'routing' => ['strategyID' => 'rs_01kx4h2jdafq8bk9amzvy6hbv0'],
'subscription' => ['topicID' => 'pt_01kx4h2jdafq8bk9a26x0kvd1t'],
'tags' => ['onboarding', 'welcome'],
'email' => [
'bcc' => ['string'],
'cc' => ['string'],
'from' => 'from',
'replyTo' => 'reply_to',
],
'alias' => 'welcome',
],
state: 'DRAFT',
idempotencyKey: 'order-ORD-456-user-123',
xIdempotencyExpiration: '1785312000',
);
var_dump($notificationTemplateResponse);
} catch (APIException $e) {
echo $e->getMessage();
}using System;
using System.Collections.Generic;
using System.Text.Json;
using TryCourier;
using Models = TryCourier.Models;
using TryCourier.Models.Notifications;
CourierClient client = new();
NotificationCreateParams parameters = new()
{
Notification = new()
{
Brand = new("bnd_01kx4mrd0pfzw8wt7pn7p2fzag"),
Content = new()
{
Elements =
[
new Models::ElementalChannelNodeWithType()
{
Channels =
[
"string"
],
If = "if",
Loop = "loop",
Ref = "ref",
Channel = "email",
Elements =
[
new Models::UnionMember1()
{
Channels =
[
"string"
],
If = "if",
Loop = "loop",
Ref = "ref",
Title = "Welcome!",
Type = Models::UnionMember1IntersectionMember1Type.Meta,
},
new Models::UnionMember0()
{
Channels =
[
"string"
],
If = "if",
Loop = "loop",
Ref = "ref",
Align = Models::Align.Left,
Bold = "bold",
Color = "color",
Content = "Hello {{data.name}}.",
FontSize = "font_size",
Format = Models::Format.Markdown,
Italic = "italic",
LineHeight = "line_height",
Locales = new Dictionary<string, Models::LocalesItem>(
)
{
{ "foo", new("content") }
},
Strikethrough = "strikethrough",
TextStyle = Models::TextStyle.Text,
Underline = "underline",
Type = Models::UnionMember0IntersectionMember1Type.Text,
},
],
FontSize = "font_size",
LineHeight = "line_height",
Padding = "padding",
Raw = new Dictionary<string, JsonElement>()
{
{ "foo", JsonSerializer.SerializeToElement("bar") }
},
Type = Models::ElementalChannelNodeWithTypeIntersectionMember1Type.Channel,
},
],
Version = "2022-01-01",
},
Name = "Welcome Email",
Routing = new("rs_01kx4h2jdafq8bk9amzvy6hbv0"),
Subscription = new("pt_01kx4h2jdafq8bk9a26x0kvd1t"),
Tags =
[
"onboarding", "welcome"
],
Email = new()
{
Bcc =
[
"string"
],
Cc =
[
"string"
],
From = "from",
ReplyTo = "reply_to",
},
Alias = "welcome",
},
};
var notificationTemplateResponse = await client.Notifications.Create(parameters);
Console.WriteLine(notificationTemplateResponse);courier notifications create \
--api-key 'My API Key' \
--notification "{brand: {id: bnd_01kx4mrd0pfzw8wt7pn7p2fzag}, content: {elements: [{}], version: '2022-01-01'}, name: Welcome Email, routing: {strategy_id: rs_01kx4h2jdafq8bk9amzvy6hbv0}, subscription: {topic_id: pt_01kx4h2jdafq8bk9a26x0kvd1t}, tags: [onboarding, welcome]}"curl --request POST \
--url https://api.courier.com/notifications \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"notification": {
"name": "Welcome Email",
"tags": [
"onboarding",
"welcome"
],
"brand": {
"id": "bnd_01kx4mrd0pfzw8wt7pn7p2fzag"
},
"subscription": {
"topic_id": "pt_01kx4h2jdafq8bk9a26x0kvd1t"
},
"routing": {
"strategy_id": "rs_01kx4h2jdafq8bk9amzvy6hbv0"
},
"content": {
"version": "2022-01-01",
"elements": [
{
"type": "channel",
"channel": "email",
"elements": [
{
"type": "meta",
"title": "Welcome!"
},
{
"type": "text",
"content": "Hello {{data.name}}."
}
]
}
]
},
"alias": "welcome"
},
"state": "DRAFT"
}
'{
"id": "nt_01kx4h2jdafq8bk9aftxak4b40",
"name": "Welcome Email",
"tags": [
"onboarding",
"welcome"
],
"brand": {
"id": "bnd_01kx4mrd0pfzw8wt7pn7p2fzag"
},
"subscription": {
"topic_id": "pt_01kx4h2jdafq8bk9a26x0kvd1t"
},
"routing": {
"strategy_id": "rs_01kx4h2jdafq8bk9amzvy6hbv0"
},
"content": {
"version": "2022-01-01",
"elements": [
{
"type": "channel",
"channel": "email",
"elements": [
{
"type": "meta",
"title": "Welcome!"
},
{
"type": "text",
"content": "Hello {{data.name}}."
}
]
}
]
},
"alias": "welcome",
"state": "DRAFT",
"created": 1710000000000,
"creator": "user_abc",
"updated": 1710000000000,
"updater": "user_abc"
}Create Notification Template
Create a notification template. Requires all fields in the notification object. Templates are created in draft state by default.
Content must place its elements inside a channel block — { "type": "channel", "channel": "email", "elements": [...] } — or the request returns 400. The template designer renders only the channel block matching the tab it draws, so content stored without one cannot be opened. An empty elements array is accepted, and the requirement applies to creation only: PUT /notifications/{id} still accepts unwrapped content. Note this endpoint takes versioned content only — the { title, body } shorthand accepted by /send is rejected here with an invalid_request_error on notification.content.version.
import Courier from '@trycourier/courier';
const client = new Courier({
apiKey: process.env['COURIER_API_KEY'], // This is the default and can be omitted
});
const notificationTemplateResponse = await client.notifications.create({
notification: {
name: 'Welcome Email',
tags: ['onboarding', 'welcome'],
brand: { id: 'bnd_01kx4mrd0pfzw8wt7pn7p2fzag' },
subscription: { topic_id: 'pt_01kx4h2jdafq8bk9a26x0kvd1t' },
routing: { strategy_id: 'rs_01kx4h2jdafq8bk9amzvy6hbv0' },
content: {
version: '2022-01-01',
elements: [
{
type: 'channel',
channel: 'email',
elements: [
{ type: 'meta', title: 'Welcome!' },
{ type: 'text', content: 'Hello {{data.name}}.' },
],
},
],
},
alias: 'welcome',
},
state: 'DRAFT',
});
console.log(notificationTemplateResponse);import os
from courier import Courier
client = Courier(
api_key=os.environ.get("COURIER_API_KEY"), # This is the default and can be omitted
)
notification_template_response = client.notifications.create(
notification={
"name": "Welcome Email",
"tags": ["onboarding", "welcome"],
"brand": {
"id": "bnd_01kx4mrd0pfzw8wt7pn7p2fzag"
},
"subscription": {
"topic_id": "pt_01kx4h2jdafq8bk9a26x0kvd1t"
},
"routing": {
"strategy_id": "rs_01kx4h2jdafq8bk9amzvy6hbv0"
},
"content": {
"version": "2022-01-01",
"elements": [{
"type": "channel",
"channel": "email",
"elements": [{
"type": "meta",
"title": "Welcome!",
}, {
"type": "text",
"content": "Hello {{data.name}}.",
}],
}],
},
"alias": "welcome",
},
state="DRAFT",
)
print(notification_template_response)package main
import (
"context"
"fmt"
"github.com/trycourier/courier-go/v4"
"github.com/trycourier/courier-go/v4/option"
"github.com/trycourier/courier-go/v4/shared"
)
func main() {
client := courier.NewClient(
option.WithAPIKey("My API Key"),
)
notificationTemplateResponse, err := client.Notifications.New(context.TODO(), courier.NotificationNewParams{
NotificationTemplateCreateRequest: courier.NotificationTemplateCreateRequestParam{
Notification: courier.NotificationTemplateWritePayloadParam{
NotificationTemplatePayloadParam: courier.NotificationTemplatePayloadParam{
Brand: courier.NotificationTemplatePayloadBrandParam{
ID: "bnd_01kx4mrd0pfzw8wt7pn7p2fzag",
},
Content: shared.ElementalContentParam{
Elements: []shared.ElementalNodeUnionParam{{
OfElementalTextNodeWithType: &shared.ElementalTextNodeWithTypeParam{
ElementalTextNodeParam: shared.ElementalTextNodeParam{
ElementalBaseNodeParam: shared.ElementalBaseNodeParam{},
},
},
}},
Version: "2022-01-01",
},
Name: "Welcome Email",
Routing: courier.NotificationTemplatePayloadRoutingParam{
StrategyID: "rs_01kx4h2jdafq8bk9amzvy6hbv0",
},
Subscription: courier.NotificationTemplatePayloadSubscriptionParam{
TopicID: "pt_01kx4h2jdafq8bk9a26x0kvd1t",
},
Tags: []string{"onboarding", "welcome"},
},
},
},
})
if err != nil {
panic(err.Error())
}
fmt.Printf("%+v\n", notificationTemplateResponse)
}
package com.courier.example;
import com.courier.client.CourierClient;
import com.courier.client.okhttp.CourierOkHttpClient;
import com.courier.models.ElementalContent;
import com.courier.models.ElementalTextNodeWithType;
import com.courier.models.notifications.NotificationTemplateCreateRequest;
import com.courier.models.notifications.NotificationTemplatePayload;
import com.courier.models.notifications.NotificationTemplateResponse;
import com.courier.models.notifications.NotificationTemplateWritePayload;
public final class Main {
private Main() {}
public static void main(String[] args) {
CourierClient client = CourierOkHttpClient.fromEnv();
NotificationTemplateCreateRequest params = NotificationTemplateCreateRequest.builder()
.notification(NotificationTemplateWritePayload.builder()
.brand(NotificationTemplatePayload.Brand.builder()
.id("bnd_01kx4mrd0pfzw8wt7pn7p2fzag")
.build())
.content(ElementalContent.builder()
.addElement(ElementalTextNodeWithType.builder().build())
.version("2022-01-01")
.build())
.name("Welcome Email")
.routing(NotificationTemplatePayload.Routing.builder()
.strategyId("rs_01kx4h2jdafq8bk9amzvy6hbv0")
.build())
.subscription(NotificationTemplatePayload.Subscription.builder()
.topicId("pt_01kx4h2jdafq8bk9a26x0kvd1t")
.build())
.addTag("onboarding")
.addTag("welcome")
.build())
.build();
NotificationTemplateResponse notificationTemplateResponse = client.notifications().create(params);
}
}require "courier"
courier = Courier::Client.new(api_key: "My API Key")
notification_template_response = courier.notifications.create(
notification: {
brand: {id: "bnd_01kx4mrd0pfzw8wt7pn7p2fzag"},
content: {elements: [{}], version: "2022-01-01"},
name: "Welcome Email",
routing: {strategy_id: "rs_01kx4h2jdafq8bk9amzvy6hbv0"},
subscription: {topic_id: "pt_01kx4h2jdafq8bk9a26x0kvd1t"},
tags: ["onboarding", "welcome"]
}
)
puts(notification_template_response)<?php
require_once dirname(__DIR__) . '/vendor/autoload.php';
use Courier\Client;
use Courier\TextStyle;
use Courier\Core\Exceptions\APIException;
$client = new Client(apiKey: getenv('COURIER_API_KEY') ?: 'My API Key');
try {
$notificationTemplateResponse = $client->notifications->create(
notification: [
'brand' => ['id' => 'bnd_01kx4mrd0pfzw8wt7pn7p2fzag'],
'content' => [
'elements' => [
[
'channels' => ['string'],
'if' => 'if',
'loop' => 'loop',
'ref' => 'ref',
'channel' => 'email',
'elements' => [
[
'channels' => ['string'],
'if' => 'if',
'loop' => 'loop',
'ref' => 'ref',
'title' => 'Welcome!',
'type' => 'meta',
],
[
'channels' => ['string'],
'if' => 'if',
'loop' => 'loop',
'ref' => 'ref',
'align' => 'left',
'bold' => 'bold',
'color' => 'color',
'content' => 'Hello {{data.name}}.',
'fontSize' => 'font_size',
'format' => 'markdown',
'italic' => 'italic',
'lineHeight' => 'line_height',
'locales' => ['foo' => ['content' => 'content']],
'strikethrough' => 'strikethrough',
'textStyle' => TextStyle::TEXT,
'underline' => 'underline',
'type' => 'text',
],
],
'fontSize' => 'font_size',
'lineHeight' => 'line_height',
'padding' => 'padding',
'raw' => ['foo' => 'bar'],
'type' => 'channel',
],
],
'version' => '2022-01-01',
],
'name' => 'Welcome Email',
'routing' => ['strategyID' => 'rs_01kx4h2jdafq8bk9amzvy6hbv0'],
'subscription' => ['topicID' => 'pt_01kx4h2jdafq8bk9a26x0kvd1t'],
'tags' => ['onboarding', 'welcome'],
'email' => [
'bcc' => ['string'],
'cc' => ['string'],
'from' => 'from',
'replyTo' => 'reply_to',
],
'alias' => 'welcome',
],
state: 'DRAFT',
idempotencyKey: 'order-ORD-456-user-123',
xIdempotencyExpiration: '1785312000',
);
var_dump($notificationTemplateResponse);
} catch (APIException $e) {
echo $e->getMessage();
}using System;
using System.Collections.Generic;
using System.Text.Json;
using TryCourier;
using Models = TryCourier.Models;
using TryCourier.Models.Notifications;
CourierClient client = new();
NotificationCreateParams parameters = new()
{
Notification = new()
{
Brand = new("bnd_01kx4mrd0pfzw8wt7pn7p2fzag"),
Content = new()
{
Elements =
[
new Models::ElementalChannelNodeWithType()
{
Channels =
[
"string"
],
If = "if",
Loop = "loop",
Ref = "ref",
Channel = "email",
Elements =
[
new Models::UnionMember1()
{
Channels =
[
"string"
],
If = "if",
Loop = "loop",
Ref = "ref",
Title = "Welcome!",
Type = Models::UnionMember1IntersectionMember1Type.Meta,
},
new Models::UnionMember0()
{
Channels =
[
"string"
],
If = "if",
Loop = "loop",
Ref = "ref",
Align = Models::Align.Left,
Bold = "bold",
Color = "color",
Content = "Hello {{data.name}}.",
FontSize = "font_size",
Format = Models::Format.Markdown,
Italic = "italic",
LineHeight = "line_height",
Locales = new Dictionary<string, Models::LocalesItem>(
)
{
{ "foo", new("content") }
},
Strikethrough = "strikethrough",
TextStyle = Models::TextStyle.Text,
Underline = "underline",
Type = Models::UnionMember0IntersectionMember1Type.Text,
},
],
FontSize = "font_size",
LineHeight = "line_height",
Padding = "padding",
Raw = new Dictionary<string, JsonElement>()
{
{ "foo", JsonSerializer.SerializeToElement("bar") }
},
Type = Models::ElementalChannelNodeWithTypeIntersectionMember1Type.Channel,
},
],
Version = "2022-01-01",
},
Name = "Welcome Email",
Routing = new("rs_01kx4h2jdafq8bk9amzvy6hbv0"),
Subscription = new("pt_01kx4h2jdafq8bk9a26x0kvd1t"),
Tags =
[
"onboarding", "welcome"
],
Email = new()
{
Bcc =
[
"string"
],
Cc =
[
"string"
],
From = "from",
ReplyTo = "reply_to",
},
Alias = "welcome",
},
};
var notificationTemplateResponse = await client.Notifications.Create(parameters);
Console.WriteLine(notificationTemplateResponse);courier notifications create \
--api-key 'My API Key' \
--notification "{brand: {id: bnd_01kx4mrd0pfzw8wt7pn7p2fzag}, content: {elements: [{}], version: '2022-01-01'}, name: Welcome Email, routing: {strategy_id: rs_01kx4h2jdafq8bk9amzvy6hbv0}, subscription: {topic_id: pt_01kx4h2jdafq8bk9a26x0kvd1t}, tags: [onboarding, welcome]}"curl --request POST \
--url https://api.courier.com/notifications \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"notification": {
"name": "Welcome Email",
"tags": [
"onboarding",
"welcome"
],
"brand": {
"id": "bnd_01kx4mrd0pfzw8wt7pn7p2fzag"
},
"subscription": {
"topic_id": "pt_01kx4h2jdafq8bk9a26x0kvd1t"
},
"routing": {
"strategy_id": "rs_01kx4h2jdafq8bk9amzvy6hbv0"
},
"content": {
"version": "2022-01-01",
"elements": [
{
"type": "channel",
"channel": "email",
"elements": [
{
"type": "meta",
"title": "Welcome!"
},
{
"type": "text",
"content": "Hello {{data.name}}."
}
]
}
]
},
"alias": "welcome"
},
"state": "DRAFT"
}
'{
"id": "nt_01kx4h2jdafq8bk9aftxak4b40",
"name": "Welcome Email",
"tags": [
"onboarding",
"welcome"
],
"brand": {
"id": "bnd_01kx4mrd0pfzw8wt7pn7p2fzag"
},
"subscription": {
"topic_id": "pt_01kx4h2jdafq8bk9a26x0kvd1t"
},
"routing": {
"strategy_id": "rs_01kx4h2jdafq8bk9amzvy6hbv0"
},
"content": {
"version": "2022-01-01",
"elements": [
{
"type": "channel",
"channel": "email",
"elements": [
{
"type": "meta",
"title": "Welcome!"
},
{
"type": "text",
"content": "Hello {{data.name}}."
}
]
}
]
},
"alias": "welcome",
"state": "DRAFT",
"created": 1710000000000,
"creator": "user_abc",
"updated": 1710000000000,
"updater": "user_abc"
}Authorizations
Bearer authentication header of the form Bearer <token>, where <token> is your auth token.
Headers
A unique key that makes this request idempotent. If Courier receives another request with the same Idempotency-Key, it returns the stored response from the first request without performing the operation again (including the original status code and any error). Use it to safely retry POST requests after network failures without risking duplicate sends. The key is scoped to this endpoint.
How long the idempotency key remains valid, as a Unix epoch timestamp in seconds or an ISO 8601 date string. Only applies when Idempotency-Key is provided. If omitted, the key is retained for 25 hours; the maximum is 1 year.
Body
Request body for creating a notification template.
Template fields accepted in POST and PUT request bodies, nested under a notification key.
Show child attributes
Show child attributes
Template state after creation. Case-insensitive input, normalized to uppercase in the response. Defaults to "DRAFT".
DRAFT, PUBLISHED Response
Created
Response for GET /notifications/{id}, POST /notifications, and PUT /notifications/{id}. Returns all template fields at the top level.
Display name for the template.
Tags for categorization. Send empty array for none.
Brand reference, or null for no brand.
Show child attributes
Show child attributes
Subscription topic reference, or null for none.
Show child attributes
Show child attributes
Routing strategy reference, or null for none.
Show child attributes
Show child attributes
Elemental content definition.
Show child attributes
Show child attributes
The template ID.
The template state. Always uppercase.
DRAFT, PUBLISHED Epoch milliseconds when the template was created.
User ID of the creator.
Email header fields for the template's email channel: the From, Reply-to, CC and BCC values set in the Studio email channel settings. Each value may use template variables, such as {{data.cc}}, which are resolved at send time.
Reads omit email when no header is set, and omit each unset field.
Writes treat it as optional, with three meanings. Omit it to keep the stored headers. Send null to clear all four. Send an object to replace all four: a field the object leaves out is cleared. Other email channel settings, such as the subject, are kept either way. Headers only apply while content has an email channel; with no email channel they are not stored.
Show child attributes
Show child attributes
A template's send-time alias as returned by a read, omitted entirely when it has none. Usually a single string; an array for a template that resolves from several aliases, which writes through this API can no longer produce — only templates predating that restriction, or aliases attached outside this API, hold more than one.
Epoch milliseconds of last update.
User ID of the last updater.