Create, update, and use user profiles to store contact details, custom attributes, and channel tokens for personalized notification delivery.
User profiles store the contact details and attributes Courier needs to deliver notifications. Instead of passing an email address or phone number with every send call, you create a profile once and send to the user by ID.This tutorial covers creating profiles, updating them with new data, storing push tokens, and using profile data in your notifications.
The Profiles API uses POST /profiles/:user_id to create or merge data into a profile. If the profile already exists, the supplied values are merged with the existing profile.
The user_id in the URL path (user_123) is the unique identifier you’ll use to send notifications to this user. You choose this ID; it can be any string.
A PUT replaces the entire profile. After this call, phone_number, locale, custom, and any other fields from the original profile are gone. Use POST for partial updates.
Courier looks up the user’s profile, resolves their contact details (email, phone, push tokens), and routes the notification based on channel configuration and user preferences.
You can override or supplement profile data at send time. The inline values are merged with the stored profile for that specific send without modifying the stored profile.
Push notification providers (FCM, APNS) require device tokens to deliver messages. Store tokens using the Device Tokens API or let Courier SDKs handle it automatically.
Any field stored in a user’s profile is available as a template variable. In your notification templates, reference profile fields with the profile prefix.For example, if a profile has:
You can use {{profile.name}} and {{profile.custom.company}} in your template content. You can also use {{name}} as a shorthand for top-level profile fields.
Custom attributes stored under the custom key are great for personalization: user roles, subscription tiers, company names, or any data your templates need.