Skip to main content
PUT
/
notifications
/
{id}
JavaScript
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.replace('id', {
  notification: {
    name: 'Updated Name',
    tags: ['updated'],
    brand: null,
    subscription: null,
    routing: null,
    content: { version: '2022-01-01', elements: [{ type: 'channel' }] },
  },
  state: 'PUBLISHED',
});

console.log(notificationTemplateResponse);
{
  "id": "nt_01abc123",
  "name": "Updated Name",
  "tags": [
    "updated"
  ],
  "brand": null,
  "subscription": null,
  "routing": null,
  "content": {
    "version": "2022-01-01",
    "elements": [
      {
        "type": "channel",
        "channel": "email",
        "elements": [
          {
            "type": "meta",
            "title": "Updated"
          },
          {
            "type": "text",
            "content": "Updated content."
          }
        ]
      }
    ]
  },
  "state": "PUBLISHED",
  "created": 1710000000000,
  "creator": "user_abc",
  "updated": 1710000001000,
  "updater": "user_def"
}

Documentation Index

Fetch the complete documentation index at: https://www.courier.com/docs/llms.txt

Use this file to discover all available pages before exploring further.

Authorizations

Authorization
string
header
required

Bearer authentication header of the form Bearer <token>, where <token> is your auth token.

Path Parameters

id
string
required

Template ID (nt_ prefix).

Body

application/json

Request body for replacing a notification template. Same shape as create. All fields required (PUT = full replacement).

notification
NotificationTemplatePayload · object
required

Core template fields used in POST and PUT request bodies (nested under a notification key) and returned at the top level in responses.

state
enum<string>
default:DRAFT

Template state after update. Case-insensitive input, normalized to uppercase in the response. Defaults to "DRAFT".

Available options:
DRAFT,
PUBLISHED

Response

Response for GET /notifications/{id}, POST /notifications, and PUT /notifications/{id}. Returns all template fields at the top level.

name
string
required

Display name for the template.

tags
string[]
required

Tags for categorization. Send empty array for none.

brand
object
required

Brand reference, or null for no brand.

subscription
object
required

Subscription topic reference, or null for none.

routing
object
required

Routing strategy reference, or null for none.

content
ElementalContent · object
required

Elemental content definition.

id
string
required

The template ID.

state
enum<string>
required

The template state. Always uppercase.

Available options:
DRAFT,
PUBLISHED
created
integer<int64>
required

Epoch milliseconds when the template was created.

creator
string
required

User ID of the creator.

updated
integer<int64>

Epoch milliseconds of last update.

updater
string

User ID of the last updater.