Overview
OneSignal provides a default email-compliant unsubscribe experience that injects a link into your email templates so users can unsubscribe with ease and their subscription statuses are updated in real-time. If you want full control over branding, copy, and fields (such as category opt-outs), you can replace the default link with your own custom page and use the OneSignal API to unsubscribe or update user preferences. This guide explains how to add your own custom unsubscribe page to emails (removing the default OneSignal link) and which of our APIs to use to unsubscribe the user’s email Subscription. If you want to add more functionality to your custom unsubscribe page (like opt out of specific email categories instead of all), this is detailed in our Preference Center tutorial.Remove OneSignal’s default unsubscribe link
OneSignal automatically inserts a special link in the format[unsubscribe_url]
to your email templates. This URL unsubscribes the user from all emails in OneSignal. See Email Unsubscribe Links for details.
To use your own page, locate and remove the default link in your template.
- Drag-and-Drop Editor
- HTML Editor
In the drag-and-drop editor, the default link may appear nested like:

Drag-and-Drop editor unsubscribe link
Add your custom unsubscribe link
Now that you have removed our special link, you can replace it with your own URL. Many times, these links require some additional data to be passed to your page. Use Liquid variables to pass OneSignal data to your page. Common parameters:Parameter | Description |
---|---|
subscription.email | Subscriber’s email address |
subscription.external_id | User’s external ID |
app.id | OneSignal App ID |
message.id | ID of the email notification |
subscription.language | Preferred language (for localization) |
subscription.unsubscribe_token | Security token for API verification |
HTML

Add custom unsubscribe link
Disable click tracking
Unsubscribe clicks are generally not used for engagement metrics. If you want to disable link tracking, you can add thedata-disable-tracking="true"
attribute to your link like this:
HTML
Provider | Attribute |
---|---|
OneSignal | data-disable-tracking="true" |
Mailgun | disable-tracking=true |
SendGrid | clicktracking=off |
Mandrill | mc:disable-tracking |
Hosting your custom unsubscribe page
Deploy a web page that:- Reads query parameters from the unsubscribe link.
- Displays user-friendly opt-out or preference options.
- Sends the unsubscribe or update request to OneSignal via API.
We provide a working GitHub sample project you can fork and deploy.

Sample unsubscribe page UI
Calling the OneSignal API
Depending on your use case, you can use the following APIs to unsubscribe or update user preferences:- Update Subscription by Token
- Unsubscribe Email with Token
- Update User
This API is most commonly used when you have the user’s email address and just want to subscribe or unsubscribe them from all emails.Required query parameters:
app_id
token
- Call this API from your server.
You should now be equipped with everything you need to know about creating a custom unsubscribe page.