Getting the ListMemberships for a Contact doesn't return full list

I’m using the Legacy Contacts endpoint with param `showListMemberships=true` in order to get the list memberships for the contact. It works great unless the Contact is a member of more than 5 lists, at which point a bug is happening… the response restricts to only 5 list memberships instead of all of them (without a way of knowing how to get the other list memberships, if there are more memberships, or any additional info for this).

Here’s my shortened request:

GET https://api.hubapi.com/contacts/v1/contact/vid/:contact_vid_id/profile?showListMemberships=true...

Here’s my shortened response, which is incorrect… the Contact is also a member of static-list-id 5, which this excludes… but if I go to that list in the HubSpot CRM UI and search for the contact, I can clearly find it there.

{
 "vid": 551,
 ...
 "list-memberships": [
 {
 "static-list-id": 2,
 "internal-list-id": 2,
 "timestamp": 1614350641615,
 "vid": 551,
 "is-member": true
 },
 {
 "static-list-id": 7,
 "internal-list-id": 11,
 "timestamp": 1627329258097,
 "vid": 551,
 "is-member": true
 },
 {
 "static-list-id": 8,
 "internal-list-id": 12,
 "timestamp": 1627329284744,
 "vid": 551,
 "is-member": true
 },
 {
 "static-list-id": 9,
 "internal-list-id": 13,
 "timestamp": 1627329316037,
 "vid": 551,
 "is-member": true
 },
 {
 "static-list-id": 10,
 "internal-list-id": 14,
 "timestamp": 1627329321711,
 "vid": 551,
 "is-member": true
 }
 ],
 ...
}

I also noticed that when I visit the contact in the HubSpot CRM UI and see it’s list memberships (via HubSpot) it also incorrectly shows only 5 lists the contact is a membership of, instead of all lists it’s a member of. (I’m assuming the CRM UI uses the same endpoint I’m using in my app).

This is clearly a bug as I don’t see any documentation saying that it purposefully only shows 5 of the memberships :confused: this is causing problems for our users that use several lists and when they have contacts that are members of more than 5 lists. Our app is restricting contact syncing to the lists that they have chosen to watch, so when this list membership data is incorrect, the app then incorrectly prevents syncing the contact, and then we get contacts complaining (for obvious reason, haha).

What options do I have in order to get an accurate full list of list memberships for a given contact? Even if I need to paginate through the memberships, I need a way to find out.

Hi @Skipio ,

Please read this documentation. You have to set offset and get next page result.
https://legacydocs.hubspot.com/docs/methods/contacts/get_contacts
Screen shot :

Hope this helps!

If we were able to answer your query, kindly help the community by marking it as a solution.
Thanks and Regards.

You’re solution doesn’t work as that is not what I was asking (I already know how to get all contacts from X list).

What I’m asking/needing is: for X contact, “get all list memberships” they have (accurately). Please fully re-read my original question to see the problem I’m facing when I try to do this; as you can see (and can test in your own HubSpot account) if you have 6+ lists and put a single contact into those lists, then try to get the list memberships for the single contact… the lists memberships will be in-accurate (it only shows 5 of the list memberships instead of the 6+ memberships).

Your solution suggests that I will need to get all lists for the HubSpot user, loop through all of them getting all of their contacts, and looping through all the returned contacts in order to determine if X contact is found in X, Y, Z, (etc) lists. I suppose that could work, but it’s a very poor solution that will constantly trigger rate limits for every User trying to sync contacts. I’m hoping for a more efficient solution since HubSpot API’s should already know all of the list memberships X contact has (as the contact can already be correctly found inside of each list in the HubSpot CRM UI, so they should have the technology :winking_face_with_tongue: ).

I wonder if this is just a bug if certain conditions are met?
I have X contact inside of 6 static lists, but the list memberships only shows 5 of those lists.

I just added the contact into 1 dynamic list, and the list memberships now shows 5 statis lists and 1 dynamic list. :person_shrugging:

Something isn’t working right, it should be returning 6 static lists, and 1 dynamic list for X contact.

Here’s a Loom screencast showing what’s happening: https://www.loom.com/share/881e328c9775444f8a758c8d7fdf7596

So either it’s a bug that’s preventing a 6th static list from being returned in the list memberships results, or there’s a bug specifically on the list that isn’t being returned?

There must be something wrong with this specific contact. I just added a different contact to all 7 lists, and the list memberships is accurately showing all 7 lists.

I’m going to contact support to help with this bug.

[UPDATE - 2021/08/30]

FYI for anyone having the same problem, customer support got back to me and fixed this issue by removing the contact and re-adding them to the list. There was no explanation as to why/how this happened or how to avoid it though :person_shrugging: