Skip to main content
GET
/
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.retrieve('id');

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.retrieve(
id="id",
)
print(notification_template_response)
package main

import (
"context"
"fmt"

"github.com/trycourier/courier-go"
"github.com/trycourier/courier-go/option"
)

func main() {
client := courier.NewClient(
option.WithAPIKey("My API Key"),
)
notificationTemplateResponse, err := client.Notifications.Get(
context.TODO(),
"id",
courier.NotificationGetParams{},
)
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.notifications.NotificationRetrieveParams;
import com.courier.models.notifications.NotificationTemplateResponse;

public final class Main {
private Main() {}

public static void main(String[] args) {
CourierClient client = CourierOkHttpClient.fromEnv();

NotificationTemplateResponse notificationTemplateResponse = client.notifications().retrieve("id");
}
}
require "courier"

courier = Courier::Client.new(api_key: "My API Key")

notification_template_response = courier.notifications.retrieve("id")

puts(notification_template_response)
<?php

require_once dirname(__DIR__) . '/vendor/autoload.php';

use Courier\Client;
use Courier\Core\Exceptions\APIException;

$client = new Client(apiKey: getenv('COURIER_API_KEY') ?: 'My API Key');

try {
$notificationTemplateResponse = $client->notifications->retrieve(
'id', version: 'version'
);

var_dump($notificationTemplateResponse);
} catch (APIException $e) {
echo $e->getMessage();
}
using System;
using TryCourier;
using TryCourier.Models.Notifications;

CourierClient client = new();

NotificationRetrieveParams parameters = new() { ID = "id" };

var notificationTemplateResponse = await client.Notifications.Retrieve(parameters);

Console.WriteLine(notificationTemplateResponse);
courier notifications retrieve \
--api-key 'My API Key' \
--id id
curl --request GET \
--url https://api.courier.com/notifications/{id} \
--header 'Authorization: Bearer <token>'
{
  "id": "nt_01kx4h2jdafq8bk9aftxak4b40",
  "name": "Welcome Email",
  "tags": [
    "onboarding"
  ],
  "brand": {
    "id": "bnd_01kx4mrd0pfzw8wt7pn7p2fzag"
  },
  "subscription": {
    "topic_id": "pt_01kx4h2jdafq8bk9a26x0kvd1t"
  },
  "routing": null,
  "content": {
    "version": "2022-01-01",
    "elements": [
      {
        "type": "channel",
        "channel": "email",
        "elements": [
          {
            "type": "meta",
            "title": "Welcome!"
          },
          {
            "type": "text",
            "content": "Hello {{data.name}}."
          }
        ]
      }
    ]
  },
  "state": "PUBLISHED",
  "created": 1710000000000,
  "creator": "user_abc",
  "updated": 1710000001000,
  "updater": "user_def"
}
{
"type": "invalid_request_error",
"message": "Notification template nt_01kx4kepxgfq9ty3r3wyf61n5t not found"
}

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).

Query Parameters

version
string

Version to retrieve. One of "draft", "published", or a version string like "v001". Defaults to "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 | null
required

Brand reference, or null for no brand.

subscription
object | null
required

Subscription topic reference, or null for none.

routing
object | null
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.