Including Deleted items in API list actions

New Contributor

I have a puzzler from a user:

 

Is there a way to include deleted contact lists from the API? They don't show up in the standard "get contact lists" request, but you can still retreive them one by one:

https://developers.hubspot.com/docs/methods/lists/get_lists

 

The issue is coming in that while the list is deleted (and not showing up in the list api call), the contacts are still marked as belonging to the list, even though it's deleted.

 

Thanks in advance.

Reply
0 Upvotes
3 Replies 3
Highlighted
Community Manager

Hey @SegMetrics,

 

Currently, it is not possible to include deleted list when retrieving HubSpot list using the Get all contact lists endpoint. That said, if a list is deleted and you have a record of the list id, we are able to use the Get a contact list by its unique ID endpoint to retrieve the list and if it's deleted, you would see the following value:

deleted:true,

Additionally, when a list is deleted, I wouldn't expect to see contact still showing up as member of the list. Do you mind sharing with me where are you seeing that contacts are still marked as belonging to the deleted list?

Reply
0 Upvotes
Highlighted
New Contributor

Hey @WendyGoh , apologies for the delay.

Just confirmed that we still get lists in the contacts API call, even if they are deleted.

 

Here is the call I'm making:

https://api.hubapi.com/contacts/v1/lists/all/contacts/all?showListMemberships=1&property=email&prope...

 

It includes list memberships even if the list has been deleted in the past.

 

Is there anyway to exclude those lists that have been deleted?

Currently we're running a filter locally, but it's strange that they would return the ID of a list that has been deleted on the contact.

 

Thanks,

Keith

 

Reply
0 Upvotes
Highlighted
Community Manager

Hey @SegMetrics,

 

Currently it is not possible to exclude list that have been deleted when using the Get all contacts endpoint with the showListMemberships parameter. 

 

One way that I'd like to suggest is to either:

1. Keep track of the current list id by using the Get all contact lists | Contact Lists API

or

2. Check if the list has been deleted by using the Get a contact list by its unique ID | Contact Lists API > If it's deleted, it will show - deleted: true

Reply
0 Upvotes