Skip to main content
POST
/
notifications
/
{id}
/
publish
JavaScript
import Courier from '@trycourier/courier';

const client = new Courier({
  apiKey: process.env['COURIER_API_KEY'], // This is the default and can be omitted
});

await client.notifications.publish('id');
import os
from courier import Courier

client = Courier(
api_key=os.environ.get("COURIER_API_KEY"), # This is the default and can be omitted
)
client.notifications.publish(
id="id",
)
package main

import (
"context"

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

func main() {
client := courier.NewClient(
option.WithAPIKey("My API Key"),
)
err := client.Notifications.Publish(
context.TODO(),
"id",
courier.NotificationPublishParams{},
)
if err != nil {
panic(err.Error())
}
}
package com.courier.example;

import com.courier.client.CourierClient;
import com.courier.client.okhttp.CourierOkHttpClient;
import com.courier.models.notifications.NotificationPublishParams;

public final class Main {
private Main() {}

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

client.notifications().publish("id");
}
}
require "courier"

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

result = courier.notifications.publish("id")

puts(result)
<?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 {
$result = $client->notifications->publish('id', version: 'v321669910225');

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

CourierClient client = new();

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

await client.Notifications.Publish(parameters);
courier notifications publish \
--api-key 'My API Key' \
--id id
curl --request POST \
--url https://api.courier.com/notifications/{id}/publish \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '{}'

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

Optional request body for publishing a notification template. Omit or send an empty object to publish the current draft.

version
string

Historical version to publish (e.g. "v001"). Omit to publish the current draft.

Pattern: ^v\d+$

Response

Successfully published, or already published with no changes (idempotent).