Hey everyone,
I’m trying to fetch all the contacts marked as ‘Open’ leads in Hubspot. I’ve been playing around with the Contact List API, but I’m running into some issues.
Here’s what I’ve tried so far:
GET /contacts/v1/lists/all/contacts/all
?count=100
&property=phone
&property=hs_lead_status
&hs_lead_status=Open
The problem is, this query is also returning contacts with ‘Closed’ lead status. I’m not sure if I’m formatting the parameters correctly or if there’s a better way to filter the results.
Does anyone know how to modify this API call to only get the contacts with open lead status? Or is there a different endpoint I should be using instead?
Thanks in advance for any help or suggestions!
hey there, i’ve got a different idea for ya. why not try the crm api instead? it’s got better filtering options. use this:
GET /crm/v3/objects/contacts?filter=hs_lead_status=Open&properties=phone,hs_lead_status
this should grab just the open leads with their phone #s. give it a shot and let us know how it goes!
yo, i’ve run into this before. the trick is to use the ‘filter’ parameter instead. try this:
GET /contacts/v1/lists/all/contacts/all?count=100&property=phone&property=hs_lead_status&filter=hs_lead_status:equal:Open
that should do the trick for ya. lemme know if it works!
I’ve dealt with a similar issue when working with Hubspot’s API. The problem lies in how the filtering works for property values. Instead of using the parameter directly in the URL, you need to use the ‘propertyMode’ parameter set to ‘filter_only’ and then specify your filter criteria.
Try modifying your request like this:
GET /contacts/v1/lists/all/contacts/all
?count=100
&property=phone
&property=hs_lead_status
&propertyMode=filter_only
&filter=hs_lead_status:equal:Open
This should return only the contacts with ‘Open’ lead status. Remember to URL encode the filter parameter if you’re not using a library that handles this automatically.
If you’re still having trouble, you might want to consider using the Search API endpoint, which offers more advanced filtering capabilities.
As someone who’s worked extensively with HubSpot’s API, I can tell you that filtering contacts by lead status can be tricky. The Contact List API isn’t always the best choice for this kind of query. Instead, I’d recommend using the Contacts Search API endpoint. It’s more flexible and allows for precise filtering.
Here’s what I’ve found works reliably:
GET /contacts/v1/search/query?q=hs_lead_status:Open&count=100&property=phone&property=hs_lead_status
This approach uses a search query to filter contacts directly, which is more efficient and accurate for your needs. It’ll return only contacts with ‘Open’ lead status, along with their phone numbers.
Just remember to paginate your results if you have more than 100 open leads. You can use the ‘offset’ parameter for this. Also, be mindful of your API call limits – large queries can eat up your quota quickly.
Having worked with HubSpot’s API before, I can suggest an alternative approach that might be more effective for your use case. Instead of using the Contact List API, consider leveraging the Contacts Search API. It provides more robust filtering capabilities.
Try this endpoint:
GET /contacts/v1/search/query?q=hs_lead_status:Open&count=100&property=phone&property=hs_lead_status
This method directly filters contacts based on their lead status, ensuring you only get ‘Open’ leads. It’s generally more reliable and efficient for specific property-based searches.
Remember to implement pagination if you have more than 100 open leads, using the ‘offset’ parameter. Also, keep an eye on your API call limits to avoid hitting quota restrictions.