Use the User Preferences API to manage notification preferences from your backend. This tutorial covers reading and updating preferences programmatically; for setting up subscription topics and surfacing preferences to users, see: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.
- How To Set Up a Hosted Preference Center for a turnkey hosted page
- How To Embed Preferences in React for in-app components
Prerequisites
- Subscription topics configured in the Preferences Editor
- Templates mapped to topics
- Your Courier API key (from Settings > API Keys)
Required Parameters
Every preference update needs two identifiers:user_id- The recipient’s unique ID (same ID used in send requests)topic_id- The subscription topic ID, found in the Preferences Editor
Read a User’s Preferences
Fetch all preferences for a user to see their current opt-in/out status across all topics:Update a Topic Preference
Set a user’s opt-in status for a specific topic. Thetopic object requires a status field with one of these values:
| Status | Behavior |
|---|---|
OPTED_IN | User receives notifications for this topic |
OPTED_OUT | User does not receive notifications for this topic |
REQUIRED | User cannot opt out (use for critical notifications like security alerts) |
Custom Routing (Enterprise)
Enterprise customers can set channel delivery preferences per topic. For example, if a notification template has email, SMS, and push channels, you can let a user receive only email:Custom routing requires an Enterprise plan. The notification template must have multiple delivery channels configured and be linked to a subscription topic.
Tenant-Scoped Preferences
If your app uses tenants, pass atenant_id to read or write preferences scoped to a specific tenant:
What’s Next
Set Up Hosted Preferences
Deploy a hosted preference page for your users
Embed Preferences in React
Build an in-app preference center with React components
Preferences Editor
Configure topics, sections, and channel options
User Preferences API
Full API reference