Overview
Use this API to update an existing Subscription’s properties. This API can be useful if:- You only know the
token
andtoken_type
and want to update metadata or status flags directly. - You are managing Subscription status outside of the OneSignal SDK. Like with a custom preference page or unsubscribe page.
How to use this API
To update a Subscription, you must know thetoken_type
and the token
.
The token_type
is the Subscription’s type (e.g., Email
, SMS
, iOSPush
, AndroidPush
, etc.).
The token
is the push token, email address, or phone number associated with the Subscription.
Ensure the token
is valid and correctly formatted for the chosen token_type
.
- Email format: Should be a valid email address that you confirmed can receive emails.
- SMS format: Phone number must be in E.164 format.
- iOSPush APNS token format: 64 characters, hexadecimal characters only (0-9,a-f).
- AndroidPush FCM token format: Typically 163 characters, alphanumeric characters, may contain hyphens, colons and underscore.
token_type
and token
of a Subscription with this API. If the token_type
is incorrect:- Use Delete Subscription to remove the incorrect entry.
- Use Create Subscription by alias to recreate the subscription with the correct type.
token
and token_type
, an Http 400
error is returned with a list of subscription IDs that match the criteria.Headers
Your App API key with prefix Key
. See Keys & IDs.
Path Parameters
Your OneSignal App ID in UUID v4 format. See Keys & IDs.
The subscription channel type. Must match the format of the token.
Email
, SMS
, iOSPush
, AndroidPush
, HuaweiPush
, FireOSPush
, WindowsPush
, macOSPush
, ChromeExtensionPush
, ChromePush
, FirefoxPush
, SafariPush
The push token, email address, or phone number associated with the subscription. Ensure the token
is valid and correctly formatted for the chosen subscription type
. Email format: Should be a valid email address that you confirmed can receive emails. SMS format: Phone number must be in E.164 format. iOSPush APNS token format: 64 characters, hexadecimal characters only (0-9,a-f). AndroidPush FCM token format: Typically 163 characters, alphanumeric characters, may contain hyphens, colons and underscore.
Body
The subscription's properties.
Response
202
The Subscription update request has been accepted successfully. This process is asynchronous and may take a few seconds to complete.