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 notificationTemplateMutationResponse = 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(notificationTemplateMutationResponse.notification);
{
  "notification": {
    "id": "nt_01abc123"
  },
  "state": "DRAFT"
}

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

Full document shape used in POST and PUT request bodies, and returned inside the GET response envelope.

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 returned by POST and PUT operations.

notification
object
required
state
enum<string>
required

The template state after the operation. Always uppercase.

Available options:
DRAFT,
PUBLISHED