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: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.
- All tenant members with a single
tenant_idinto - Individual users with explicit tenant context
- Multiple users with shared or per-recipient tenant context
- Tenant hierarchies using
include_childrenorinclude_parent
Send to tenant members
Specify atenant_id in the to field and Courier fans out the message to every user with a membership in that tenant:
Send to a user with tenant context
Setcontext.tenant_id on a recipient to attach tenant metadata, preferences, and branding to their notification:
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.
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 withmessage.context.tenant_id. Every recipient inherits that context.
Override tenant context per recipient
You can override the message-level tenant for specific recipients by settingcontext.tenant_id on individual entries in the to array. Per-recipient context takes precedence over the message-level context.
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 specifytenant_id explicitly; otherwise Courier returns a "Tenant Context Not Found" error.
- 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_idwhen using thetenant/<template_id>format
Send to child tenant users
To fan out a message to all users in a tenant’s child tenants, setinclude_children: true:
Send to parent tenant users
To fan out upward through the hierarchy, setinclude_parent: true:
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.