Update user’s subscription group status
Use this endpoint to batch update the subscription state of up to 50 users on the Braze dashboard.
You can access a subscription group’s subscription_group_id by navigating to the Subscription Group page.
If you want to see examples or test this endpoint for Email Subscription Groups:
If you want to see examples or test this endpoint for SMS and RCS Subscription Groups:
Prerequisites
To use this endpoint, you’ll need an API key with the subscription.status.set permission.
If you’re interested in using this endpoint with LINE subscription groups, contact your customer success manager.
Rate limit
This endpoint has a rate limit of 5,000 requests per minute shared across the /subscription/status/set and /v2/subscription/status/set endpoint as documented in API rate limits.
Request body
1
2
Content-Type: application/json
Authorization: Bearer YOUR-REST-API-KEY
1
2
3
4
5
6
7
8
{
"subscription_group_id": (required, string) the id of your subscription group,
"subscription_state": (required, string) available values are "unsubscribed" (not in subscription group) or "subscribed" (in subscription group),
"external_id": (required*, array of strings) the external ID of the user or users, may include up to 50 IDs,
"phone": (required*, array of strings in E.164 format) The phone number of the user (must include at least one phone number and at most 50 phone numbers),
"use_double_opt_in_logic": (optional, boolean) defaults to `false`; when `subscription_state` is "subscribed", set to `true` to enter the user into the SMS double opt-in workflow,
// SMS and RCS subscription group - you must include one of external_id or phone
}
* SMS and RCS subscription groups: Braze accepts only external_id or phone.
1
2
Content-Type: application/json
Authorization: Bearer YOUR-REST-API-KEY
1
2
3
4
5
6
7
8
{
"subscription_group_id": (required, string) the id of your subscription group,
"subscription_state": (required, string) available values are "unsubscribed" (not in subscription group) or "subscribed" (in subscription group),
"external_id": (required*, array of strings) the external ID of the user or users, may include up to 50 IDs,
"email": (required*, array of strings) the email address of the user (must include at least one email and at most 50 emails),
// Email subscription group - you must include one of external_id or email
// Note that sending an email address that is linked to multiple profiles updates all relevant profiles
}
* Email subscription groups: You must include either email or external_id.
This property should not be used for updating a user’s profile information. Use the /users/track property instead.
Adding existing users to a subscription group: This endpoint is the recommended way to backfill or bulk-update subscription group membership for existing users. You can pass up to 50 external_ids, email addresses, or phone numbers per request. Users can also update their own subscription status through an email preference center link.
Creating new users with a subscription group: When creating new users using the /users/track endpoint, you can set subscription groups within the user attributes object, which allows you to create a user and set the subscription group state in one API call.
Request parameters
| Parameter | Required | Data Type | Description |
|---|---|---|---|
subscription_group_id |
Required | String | The id of your subscription group. |
subscription_state |
Required | String | Available values are unsubscribed (not in subscription group) or subscribed (in subscription group). |
external_id |
Required* | Array of strings | The external_id of the user or users, may include up to 50 ids. |
email |
Required* | String or array of strings | The email address of the user, can be passed as an array of strings. Must include at least one email address (with a maximum of 50). If multiple users ( external_id) in the same workspace share the same email address, then Braze updates all users that share the email address with the subscription group changes. |
phone |
Required* | String in E.164 format | The phone number of the user, can be passed as an array of strings. Must include at least one phone number (up to 50). If multiple users ( external_id) in the same workspace share the same phone number, then Braze updates all users that share the phone number with the same subscription group changes. |
use_double_opt_in_logic |
Optional | Boolean | Applies only to SMS subscription groups; ignored for email and other subscription group types. Defaults to false if omitted. For SMS subscription groups, set to true to enter the user into the SMS double opt-in workflow when their subscription status is set to subscribed. If this parameter is omitted or set to false, users are subscribed without entering the double opt-in workflow. |
Example requests
1
2
3
4
5
6
7
8
9
10
curl --location --request POST 'https://rest.iad-01.braze.com/subscription/status/set' \
--header 'Content-Type: application/json' \
--header 'Authorization: Bearer YOUR-REST-API-KEY' \
--data-raw '{
"subscription_group_id": "subscription_group_identifier",
"subscription_state": "unsubscribed",
"external_id": "external_identifier",
"email": ["[email protected]", "[email protected]"]
}
'
SMS and RCS
1
2
3
4
5
6
7
8
9
10
curl --location --request POST 'https://rest.iad-01.braze.com/subscription/status/set' \
--header 'Content-Type: application/json' \
--header 'Authorization: Bearer YOUR-REST-API-KEY' \
--data-raw '{
"subscription_group_id": "subscription_group_identifier",
"subscription_state": "unsubscribed",
"external_id": "external_identifier",
"phone": ["+12223334444", "+11112223333"]
}
'
Example success response
The status code 201 could return the following response body.
1
2
3
{
"message": "success"
}
The endpoint accepts only the email or phone value, not both. If you provide both, you receive this response: {"message":"Either an email address or a phone number should be provided, but not both."}
Edit this page on GitHub