Update user’s subscription group status (V2)
/v2/subscription/status/set
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.
To see examples or test this endpoint for Email Subscription Groups:
To see examples or test this endpoint for SMS Subscription Groups:
To see examples or test this endpoint for WhatsApp Groups:
Prerequisites
To use this endpoint, you 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.
Differences from V1
The V2 endpoint differs from the V1 endpoint in the following ways:
- Multiple subscription groups: V2 lets you update multiple subscription groups in a single API request, while V1 supports only one subscription group per request.
- Update both email and SMS in one call: When using
external_ids, you can update both email and SMS subscription groups for the same users in a single API call. With V1, you must make separate API calls for email and SMS subscription groups. - Using email or phone identifiers: If you use
emailsorphonesinstead ofexternal_ids, you cannot update both email and SMS subscription groups in the same request. You must make separate API calls—one for email subscription groups and one for SMS subscription groups.
Phone number format: Phone numbers must be in E.164 format (for example, +12223334444). Phone numbers that are not in E.164 format are rejected.
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
9
10
11
{
"subscription_groups":[
{
"subscription_group_id": (required, string),
"subscription_state": (required, string)
"external_ids": (required*, array of strings),
"emails": (required*, array of strings),
"phones": (required*, array of strings in E.164 format),
}
]
}
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_ids |
Required* | Array of strings | The external_id of the user or users, may include up to 50 ids. |
emails |
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, all users that share the email address are updated with the subscription group changes. |
phones |
Required* | String in E.164 format | You can pass user phone numbers as an array of strings. Must include at least one phone number (up to 50). Phone numbers must be in E.164 format (for example, +12223334444). If multiple users ( external_id) in the same workspace share the same phone number, then all users that share the phone number are updated with the same subscription group changes. |
use_double_opt_in_logic |
Optional | Boolean | If this parameter is omitted or set to false, users are not entered into the SMS double opt-in workflow. |
Identifier selection:
- To update both email and SMS subscription groups in a single API call, use
external_ids. You cannot include bothemailsandphonesin the same request. - If you use
emailsorphonesinstead ofexternal_ids, make separate API calls—one for email subscription groups and one for SMS subscription groups. - You can send
emails,phones, orexternal_idsindividually.
Example requests
The following example uses external_ids to update both email and SMS subscription groups in a single API call. This is only possible when using external_ids—you cannot update both email and SMS subscription groups in one call when using emails or phones.
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
curl --location --request POST 'https://rest.iad-01.braze.com/v2/subscription/status/set' \
--header 'Content-Type: application/json' \
--header 'Authorization: Bearer YOUR-REST-API-KEY' \
--data-raw '{
"subscription_groups":[
{
"subscription_group_id":"subscription_group_identifier",
"subscription_state":"subscribed",
"external_ids":["example-user","[email protected]"]
},
{
"subscription_group_id":"subscription_group_identifier",
"subscription_state":"subscribed",
"external_ids":["example-user","[email protected]"]
}
]
}
1
2
3
4
5
6
7
8
9
10
11
12
13
curl --location --request POST 'https://rest.iad-01.braze.com/v2/subscription/status/set' \
--header 'Content-Type: application/json' \
--header 'Authorization: Bearer YOUR-REST-API-KEY' \
--data-raw '{
"subscription_groups":[
{
"subscription_group_id":"subscription_group_identifier",
"subscription_state":"subscribed",
"emails":["[email protected]","[email protected]"]
}
]
}
'
SMS and WhatsApp
1
2
3
4
5
6
7
8
9
10
11
12
13
curl --location --request POST 'https://rest.iad-01.braze.com/v2/subscription/status/set' \
--header 'Content-Type: application/json' \
--header 'Authorization: Bearer YOUR-REST-API-KEY' \
--data-raw '{
"subscription_groups":[
{
"subscription_group_id":"subscription_group_identifier",
"subscription_state":"subscribed",
"phones":["+12223334444","+15556667777"]
}
]
}
'
Edit this page on GitHub