Skip to main content
POST
/
journeys
/
{templateId}
/
templates
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 journeyTemplateGetResponse = await client.journeys.templates.create('x', {
  channel: 'email',
  notification: {
    name: 'Welcome email',
    tags: [],
    brand: null,
    subscription: null,
    content: { version: '2022-01-01', elements: [{ type: 'text' }] },
  },
});

console.log(journeyTemplateGetResponse.id);
{
  "name": "Welcome email",
  "tags": [],
  "brand": null,
  "subscription": null,
  "content": {
    "scope": "default",
    "version": "2022-01-01",
    "elements": []
  }
}

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

templateId
string
required

Journey id

Minimum string length: 1

Body

application/json

Request body for creating a notification template scoped to a journey.

channel
string
required
Minimum string length: 1
notification
object
required
state
string
providerKey
string
Minimum string length: 1

Response

Created notification template

A journey-scoped notification template.

name
string
required
tags
string[]
required
brand
object
required
subscription
object
required
content
object
required
id
string
required
state
enum<string>
default:DRAFT
required
Available options:
DRAFT,
PUBLISHED
created
integer<int64>
required
creator
string
required
updated
integer<int64>
updater
string