Loading...
Skip to main content

Subscribe users to a list

Subscribes the users to the list, overwriting existing subscriptions. If the list does not exist, it will be automatically created.

URL: https://api.courier.com/lists/:list_id/subscriptions

Method: PUT

Path Parameters

list_idstringrequired
A unique identifier associated with the list you wish to retrieve.

Body Parameters

recipientsarray
An array of list subscriptions
+ Show Properties

Responses

status: 204 Successfully subscribed

status: 400 Bad Request

messagestring
A message describing the error that occurred.
typestring
[invalid_request_error] The type of error that occurred.

Request Example

curl --request PUT \
--url https://api.courier.com/lists/example.list.id/subscriptions \
--header 'Accept: application/json' \
--header 'Content-Type: application/json' \
--data '
{
"recipients": [
{
"recipientId": "0460766e-8463-4905-ae98-b72c7aef41d6"
}
]
}
'

Responses Example

Empty
{
"message": "Error Message",
"type": "invalid_request_error"
}

Example

Method: PUT

URL: https://api.courier.com/lists/abcdefgh12345678/subscriptions

Body: ​

{
"recipientId": "0460766e-8463-4905-ae98-b72c7aef41d6",
"preferences": {
"notifications": {
"abcdefgh12345678": {
"channel_preferences": [
{
"channel": "direct_message"
}
],
"rules": [
{
"type": "snooze"
}
],
"status": "OPTED_IN"
}
},
"categories": {
"cooking": {
"channel_preferences": [
{
"channel": "direct_message"
}
],
"rules": [
{
"type": "snooze"
}
],
"status": "OPTED_IN"
}
}
}
}