Get Contacts that have lifecyclestage = Lead


#1

Hi, I'd like to get all the contacts that have lifecyclestage 'Lead'. I thought about easing /contacts/v1/search/query but that doesn't seem the solution. Thank you for any assistance/ideas!


#2

Hi @cvs,

At the moment it is not possible to search or retrieve contact records by specific property values. Also, the contact search API only works with email, name, phone number and company name.

Currently the best way to achieve what you want is to get all contact records and identify those with lifecyclestage of lead.

This topic has been brought up before and there is an idea posted here regarding this feature. If you would like to see this added, you can upvote and comment on the idea post. This information can help our Product team prioritize feature requests.


#3

Hi @Jasmin, my problem is, that the lifecyclestage is not in the contact properties. Do I have to use another call to fetch this? Ty!

To clarify, I get this result back:
{
"vid": 8651,
"addedAt": 1547799612811,
"portal-id": 2085618,
"is-contact": true,
"properties": {
"lastname": {
"value": "XXX"
},
"firstname": {
"value": "XXX"
},
"lastmodifieddate": {
"value": "1547799622572"
}
},
"merged-vids": [

],
"profile-url": "https://app.hubspot.com/contacts/....",
"merge-audits": [

],
"canonical-vid": 8651,
"profile-token": "XXX",
"form-submissions": [

],
"identity-profiles": [
{
"vid": 8651,
"identities": [
{
"type": "EMAIL",
"value": "XXX",
"timestamp": 1547799612658,
"is-primary": true
},
{
"type": "LEAD_GUID",
"value": "XXX",
"timestamp": 1547799612684
}
],
"saved-at-timestamp": 1547799612687,
"deleted-changed-timestamp": 0
}
]
}


#4

Hi, I found it so for future reference;

for each contact, you need to get all contact details using https://api.hubapi.com/contacts/v1/contact/vid/XXX/profile


#5

Hi @cvs, yes you can use that endpoint you referenced to get a contact by vid. If you use https://developers.hubspot.com/docs/methods/contacts/get_contacts to get all contacts, you can include the parameter &property=lifecyclestage to have lifecycle stage included in the response.