Solved

Retrieving list unsubscribes or global unsubscribes using latest version of API

  • 20 November 2023
  • 2 replies
  • 180 views

Badge +1

We want to download/retrieve email addresses of all profiles that have unsubscribed from a list. We need to do this to keep our global opt-outs in sync with other apps. I see that API v2 had API endpoint to do this. Looks like the latest version of the API does not. How can we retrieve opt-outs/unsubs? What’s the best way to do it using the API?

Any help or pointers would be appreciated, thank you.

icon

Best answer by KeviSunshine 20 November 2023, 23:06

View original

2 replies

Userlevel 4
Badge +7

Hi @red3i,

This is a use case I know I am going to have soon so I thought I’d do some investigation for you.

It looks like you have to use the GET profiles endpoint documented here: https://developers.klaviyo.com/en/reference/get_profiles.

You’ll need to add the “subscriptions” as an additional response field, and then sort the response based on that. 

Look at the documentation on that endpoint for the `subscriptions` object. You can filter by those subscription fields (I’m imagining filtering by the timestamp, taking anything that has happened since the last time you ran your API call).

There’s also an example `subscriptions` object shown there. It’s quite big so I won’t copy it…

 

This seems like quite a circuitous route to take for something that could be much simpler… if anyone else out there knows a better way of doing this, or if you find one @red3i, please let us know.

 

Cheers,

Kevin.

Badge +1

Hi @KeviSunshine -

We could not get it to work. We ended up creating a dynamic segment of profiles that unsubscribe or complain. Then we created a flow that triggers a notification email to one of our internal email addresses whenever a profile gets added to the dynamic list. The notification email contains email address of the profile that got added. We then have a script that periodically checks this internal mailbox, reads emails and adds the email address contained within to our master suppression list.

 

Cheers!

Reply