APIs & Integrations

AbdulQayyum
Participant

How to get all the contacts having hs_leads_status = Open?

SOLVE

I want to get all the contacts with hs_lead_status = Open &  I am testing 

 

https://api.hubapi.com/contacts/v1/lists/all/contacts/all?property=phone&property=hs_lead_status

 

It returns not all the contacts but a few ones like I am getting only 19 contacts with hs_leads_status = Closed as well.

How to pass the correct parameters?

2 Accepted solutions
Teun
Solution
Recognized Expert | Diamond Partner
Recognized Expert | Diamond Partner

How to get all the contacts having hs_leads_status = Open?

SOLVE

Hi @AbdulQayyum ,

 

You should probably use the Search API instead. Where your code should look something like this:

curl https://api.hubapi.com/crm/v3/objects/contacts/search \
  --request POST \
  --header "Content-Type: application/json" \
  --data '{
    "filterGroups":[
      {
        "filters":[
          {
            "propertyName": "hs_lead_status",
            "operator": "EQ",
            "value": "Open"
          }
        ]
      }
    ]
  }'


Learn more about HubSpot by following me on LinkedIn or YouTube

Did my answer solve your issue? Help the community by marking it as the solution.


View solution in original post

AbdulQayyum
Solution
Participant

How to get all the contacts having hs_leads_status = Open?

SOLVE

Yes. Thanks.

It helps me to resolve the issue.

POST Request : https://api.hubapi.com/crm/v3/objects/contacts/search?
Body: 

{
    "properties": [ "phone""hs_lead_status" ],
    "filterGroups":[
      {
        "filters":[
          {
            "propertyName""hs_lead_status",
            "operator""EQ",
            "value""Open"
          }
        ]
      }
    ]
  }

View solution in original post

0 Upvotes
3 Replies 3
AbdulQayyum
Participant

How to get all the contacts having hs_leads_status = Open?

SOLVE

there is one thing so weird and that is:

I am using this https://api.hubapi.com/contacts/v1/lists/all/contacts/all?count=25000&property=phone&property=hs_lea... but it only returns few records, i have 3200+ records in hubpost account which are specifically having leads status as Open but here it is returning only 432 records.

0 Upvotes
Teun
Solution
Recognized Expert | Diamond Partner
Recognized Expert | Diamond Partner

How to get all the contacts having hs_leads_status = Open?

SOLVE

Hi @AbdulQayyum ,

 

You should probably use the Search API instead. Where your code should look something like this:

curl https://api.hubapi.com/crm/v3/objects/contacts/search \
  --request POST \
  --header "Content-Type: application/json" \
  --data '{
    "filterGroups":[
      {
        "filters":[
          {
            "propertyName": "hs_lead_status",
            "operator": "EQ",
            "value": "Open"
          }
        ]
      }
    ]
  }'


Learn more about HubSpot by following me on LinkedIn or YouTube

Did my answer solve your issue? Help the community by marking it as the solution.


AbdulQayyum
Solution
Participant

How to get all the contacts having hs_leads_status = Open?

SOLVE

Yes. Thanks.

It helps me to resolve the issue.

POST Request : https://api.hubapi.com/crm/v3/objects/contacts/search?
Body: 

{
    "properties": [ "phone""hs_lead_status" ],
    "filterGroups":[
      {
        "filters":[
          {
            "propertyName""hs_lead_status",
            "operator""EQ",
            "value""Open"
          }
        ]
      }
    ]
  }
0 Upvotes