APIs & Integrations

whitfty1
Member

Get contacts in a list Issue

We have a static list that is populated via an API call. Prior to populating it is necessary for us to delete the Contacts within the list previously. After looking through the API docs, it seems the only way is to Get contacts in that list (https://api.hubapi.com/contacts/v1/lists/XXX/contacts/all?hapikey=XXX) and then Remove contacts from the list (https://api.hubapi.com/contacts/v1/lists/XXX/remove?hapikey=XXX).

After noticing some issues I began debugging the code and I realized that even if I just forced the code to delete the contacts in the list it would only delete some. I then placed the Get contacts in that list (/api.hubapi.com/contacts/v1/lists/XXX/contacts/all?hapikey=XXX) in the browser and it only shows about half of the people within the list. This would explain why my list would never empty.

Can someone explain why this is happening and how do I achieve my goal?

0 Upvotes
10 Replies 10
Not applicable

Get contacts in a list Issue

I am using the https://api.hubapi.com/contacts/v1/lists/all/contacts/all?hapikey=XXX&count=100&showListMemberships=...

But looping it through the offset and getting all the records

However we are not seeing some vids in some lists.

0 Upvotes
Dadams
HubSpot Employee
HubSpot Employee

Get contacts in a list Issue

@whitfty1 when making the remove request, does the response contain any discarded or invalid vids?

How many records are you removing from the list? It can take several seconds to remove a large number of records, so if you’re checking immediately after the remove request the remove job may not be complete yet.

0 Upvotes
whitfty1
Member

Get contacts in a list Issue

Did you understand my reply or should I try again?

0 Upvotes
Dadams
HubSpot Employee
HubSpot Employee

Get contacts in a list Issue

The count issue is related to the removal of the records. As long as a list is still processing and the records are still being removed, you may catch moments where the count of the records doesn’t line up with the current members of the list. You’d want to wait for the list to finish processing (you’ll see "processing": "DONE" in the metadata of the list) before using the numbers or members of the list.

0 Upvotes
whitfty1
Member

Get contacts in a list Issue

But that is what I’m trying to say. In my case it has now been since 1/27 and the list still isn’t at 0, it still says 110. On top of that, prior to trying to delete, I use the endpoint that is supposed to get all contacts from a specific list and the numbers are different that the 110 in the list as it shows 77 unique uservids.

0 Upvotes
Dadams
HubSpot Employee
HubSpot Employee

Get contacts in a list Issue

@whitfty1 can you send me a link to the list you’re looking at? If the list is done processing (which it should be after multiple days) then the count should line up with the number of records in the list, so if you’re seeing something different I’d need to see the list to take a look.

0 Upvotes
whitfty1
Member

Get contacts in a list Issue

The List is called “Training Credit Eligible” and the list number is 2233. It shows that I have 110 contacts there, however, if you use the end point to get contacts in a list, you will see less unique vids.

0 Upvotes
Dadams
HubSpot Employee
HubSpot Employee

Get contacts in a list Issue

Thanks @whitfty1, looking at this now, I’ll reach out to you directly when I have more details.

0 Upvotes
whitfty1
Member

Get contacts in a list Issue

Great. Thank you so much

0 Upvotes
whitfty1
Member

Get contacts in a list Issue

Yes there are a few but even before I get to that with just the Get Contacts from list (function) the numbers are off. For example, the list currently has 110 contacts in it. When I plug in the end point (/api.hubapi.com/contacts/v1/lists/XXX/contacts/all?hapikey=XXX) and do a search for ’ “vids” ’ which should show all unique contacts, I only see 77 instances of that

0 Upvotes