APIs & Integrations

yanki044
Member

Receive API of contacts emails filtered by a specific property?

SOLVE

I want to receive an API of contacts emails filtered by a specific property (in my case, class_id)?

Or at least API of contacts filtered by a specific property.

Is there any way I could do that?

0 Upvotes
1 Accepted solution
jackcoldrick
Solution
HubSpot Employee
HubSpot Employee

Receive API of contacts emails filtered by a specific property?

SOLVE

Hi @yanki044 ,

 

If I understand you correctly you are asking if there is a way to retrieve all contacts from a portal based on a specific value stored in a custom property. If that is the case the best approach to take would be one of the following: 

 

1) Get all contacts

You can use our Contacts API to pull all contacts from a portal and specify the properties to return. You can then loop through the data and filter out the contacts based on the value stored in the properties returned.  The endpoint required would be this one. Contacts are returned in sets of 100 and you can make additional requests using the "offset" parameter included in the response body.

 

2) Get all contacts on a list

You could programmatically create a list of contacts using this endpoint and setup your filters accordingly. You could then pull all contacts from the list using this endpoint. You would need to allow a few minutes for the list to populate with data depending on the number of contacts in your portal.

 

There is also a search endpoint documented here that would allow you to search for contacts in a portal using the "email address, first and last name, phone number, and company name" properties.

Jack Coldrick
Solutions Engineer @ HubSpot
Add me on LinkedIn

View solution in original post

1 Reply 1
jackcoldrick
Solution
HubSpot Employee
HubSpot Employee

Receive API of contacts emails filtered by a specific property?

SOLVE

Hi @yanki044 ,

 

If I understand you correctly you are asking if there is a way to retrieve all contacts from a portal based on a specific value stored in a custom property. If that is the case the best approach to take would be one of the following: 

 

1) Get all contacts

You can use our Contacts API to pull all contacts from a portal and specify the properties to return. You can then loop through the data and filter out the contacts based on the value stored in the properties returned.  The endpoint required would be this one. Contacts are returned in sets of 100 and you can make additional requests using the "offset" parameter included in the response body.

 

2) Get all contacts on a list

You could programmatically create a list of contacts using this endpoint and setup your filters accordingly. You could then pull all contacts from the list using this endpoint. You would need to allow a few minutes for the list to populate with data depending on the number of contacts in your portal.

 

There is also a search endpoint documented here that would allow you to search for contacts in a portal using the "email address, first and last name, phone number, and company name" properties.

Jack Coldrick
Solutions Engineer @ HubSpot
Add me on LinkedIn