Skip to main content
Use the Courier API to send notifications from your app when important events happen, like a new sign-up, order update, or password reset. Each send request specifies the recipient, content, and delivery channels. Let’s start with a simple example. The example below sends a welcome email using inline content without a template to show how the Send API works over a single channel.
const { requestId } = await courier.send({
  message: {
    to: { email: "user@example.com" },
    content: {
      title: "Welcome!",
      body: "Thanks for signing up, {{name}}"
    },
    data: { name: "John Doe" },
    routing: {
      method: "single",
      channels: ["email"]
    }
  }
});
Courier also supports SDKs to send with popular languages and frameworks. Check out the courier-samples repository for ready-to-run Courier send examples.
Every send request contains a message object with four core fields: to (recipient), content or template (what to send), routing (which channels), and data (personalization variables). For a conceptual overview of how these work together, see How Sending Works.

Sending Messages with Templates

Templates are an easy way to create, update, and manage notification content in Courier without changing your code. The template parameter accepts either a template ID or a template alias. Template IDs are permanent unique identifiers, while aliases are human-readable names you can give a template (eg welcome-email).
{
  "message": {
    "template": "JN96DHQ99CMNZ5KVQ2RXJ1XYJRHT",
    "to": { "user_id": "user_123" },
    "data": {
      "name": "John Doe",
      "company": "Acme Corp"
    }
  }
}

Sending to Users

Send to a Courier User by specifying their user_id in the to field. Courier automatically looks up the user’s stored identifiers (email, phone, push tokens, chat handles) and applies your routing rules to deliver the message through the best available channels. Use profile variables from the user object in your templates or channel conditions to personalize message content and control which channels are used.
{
  "user_id": "user_123",
  "profile": {
    "email": "user@example.com",
    "phone_number": "+1234567890",
    "custom": {
      "name": "John Doe",
      "subscription_tier": "premium",
      "company": "Acme Corp",
      "role": "admin"
    }
  }
}

Sending to Multiple Channels

You can send a single message across multiple channels using routing rules. In this example, Courier will try each channel in order until the message is successfully delivered.
{
  "message": {
    "to": { "user_id": "user_123" },
    "template": "order-confirmation", // Template alias
    "routing": {
      "method": "single",
      "channels": ["email", "sms", "push"]
    },
    "data": {
      "order_id": "ORD-12345",
      "total": "$99.99"
    }
  }
}
Courier supports two routing methods that define how messages flow across channels:
  • single — Try channels in the listed order until one succeeds. This is the default and provides priority-based fallback delivery (for example, try push first, then email, then SMS).
  • all — Send through every listed channel at once so users receive the message everywhere they’re active.
With single, the order of channels in the array determines priority. Courier attempts the first channel, and if delivery fails or the user lacks contact info for that channel, it moves to the next one.

What Channels does Courier Support?

Courier supports sending through multiple channel types. Each channel can connect to one or more providers that you configure in your workspace. Each channel is configured independently. You can include any combination of channels in a single send request and control delivery order or fallback behavior using routing rules.

Sending to Multiple Users

Send the same message to multiple recipients in a single API call by using an array in the to field:
{
  "message": {
    "to": [
      { "email": "user1@example.com" },
      { "email": "user2@example.com" },
      { "email": "user3@example.com" }
    ],
    "template": "FRH3QXM9E34W4RKP7MRC8NZ1T8V8",
    "data": {
      "payload": "Example payload"
    }
  }
}
When sending to multiple users, Courier processes each recipient individually. Each user receives their own personalized message based on their profile data and the template variables you provide. The data object applies to all recipients. For user-specific personalization, ensure your template uses profile-based variables ({{profile.variable}}).