Skip to main content
When you send with a tenant context, Courier automatically applies the tenant’s metadata, preferences, branding, and provider credentials to every notification. You can target:
  • All tenant members with a single tenant_id in to
  • Individual users with explicit tenant context
  • Multiple users with shared or per-recipient tenant context
  • Tenant hierarchies using include_children or include_parent

Send to tenant members

Specify a tenant_id in the to field and Courier fans out the message to every user with a membership in that tenant:
Courier looks up the tenant’s members and sends to each one:

Send to a user with tenant context

Set context.tenant_id on a recipient to attach tenant metadata, preferences, and branding to their notification:
This sends to user1 with tenantA’s preferences, branding, and metadata. User-level preferences and data take precedence over tenant values.
A user doesn’t need to be a tenant member to receive a notification with tenant context. This is useful when tenants hold provider credentials or metadata but you don’t need fan-out to all members.
If the recipient is an audience (audience_id), context.tenant_id does not limit which audience members receive the message; it only affects branding, preferences, and variables such as {{tenant.name}}. To scope the send to members of a specific tenant, add an inline MEMBER_OF filter on the audience recipient.

Send to multiple users with tenant context

When sending to an array of users, you can set a shared tenant context at the message level with message.context.tenant_id. Every recipient inherits that context.
All three users receive the notification with tenantA’s branding, preferences, and metadata.

Override tenant context per recipient

You can override the message-level tenant for specific recipients by setting context.tenant_id on individual entries in the to array. Per-recipient context takes precedence over the message-level context.
In this example, user1 and user2 receive the notification with tenantA’s context, while user3 receives it with tenantB’s context.

Users with multiple tenant memberships

Courier auto-infers tenant context for users who belong to exactly one tenant. For users with multiple memberships, you must specify tenant_id explicitly; otherwise Courier returns a "Tenant Context Not Found" error.
When using Courier Create templates with the tenant/<template_id> format, tenant is the literal word, not your tenant ID. Your actual tenant ID goes in context.tenant_id.
Rules of thumb:
  • Single-tenant users: tenant context is auto-inferred; specifying it is optional
  • Multi-tenant users: always specify context.tenant_id
  • Courier Create templates: always include context.tenant_id when using the tenant/<template_id> format

Send to child tenant users

To fan out a message to all users in a tenant’s child tenants, set include_children: true:
Given the following hierarchy, Courier fans out to all five users (User1 through User5):

Send to parent tenant users

To fan out upward through the hierarchy, set include_parent: true:
Given the same hierarchy, Courier fans out to User2, User3, and User4. User1 isn’t in the chain upward from ChildTenantA2, and User5 is in a child tenant (not a parent):

Tenants Overview

Tenant hierarchies, metadata, and configuration.

Tenant Deep Dive

Advanced tenant patterns and data model.

Inbox With Tenants

Tenant-scoped in-app notification feeds.

Tenants API

Full API reference for tenant operations.