Get List of Contacts that have opted out


#1

What is the best api if I want to get the list of contacts who have opted out? I could not get this by using the opt out property on the contacts api.


#2

@cbarnes199 There are a couple of different ways you can do this.

  1. Is Using the get all contacts end point. Here is an example for that
    https://api.hubapi.com/contacts/v1/lists/all/contacts/all?hapikey=xxxxx&property=hs_email_optout

This would give you all the contact with that property. Then you could sort out the results of the API call.

  1. The other way would be to build the list with in hubspot and then hit the lists end point and pull that exact list back.

Here is an example of the get all contacts in a list

https://api.hubapi.com/contacts/v1/lists/115/contacts/all?hapikey=xxxxx