Question

How to unsubscribe a user from all lists via the API?

  • 13 January 2022
  • 2 replies
  • 20 views

Badge

How to unsubscribe a user from all lists via the API?

 

We’ve got hundreds of mailing lists, so cannot loop around each one unsubscribing hoping they’re in it.

 

How can we get a list of Lists that the user is subscribed to, to unsubscribe them via the API

 

or

 

An API call that unsubscribes the user from all lists they’re members of?

 

Thanks


2 replies

Userlevel 5
Badge +28

.

Userlevel 1

Hey @owen_fnatic,

A user once unsubscribed from a list gets unsubscribed everywhere since that detail gets attached to his profile in Klaviyo and consent is removed globally for that user. 

The best way to bulk unsubscribe users from mailing lists is to create a separate list of users that you want to unsubscribe and then unsubscribe them all from that list via API. Once that is done, they will be unsubscribed from everywhere and get suppressed. 

 

curl --request DELETE \
--url 'https://a.klaviyo.com/api/v2/list/LIST_ID/subscribe?api_key=API_KEY' \
--header 'Content-Type: application/json' \
--data '
{
"emails": [
"email1@example.com",
"email2@example.com"
]
}
'

 

Reply