APIs & Integrations

dsheehan
Member

Can I query all contacts by a property?

I can’t seem to query by property, say, just get firstname=‘Danny’ or something super simple? I can get queries with lists and recent and all, but not any queries by specific properties, esp. those created by our organization.

Any code examples, etc. would be much appreciated.

0 Upvotes
3 Replies 3
Dadams
HubSpot Employee
HubSpot Employee

Can I query all contacts by a property?

Hi @dsheehan

The /search/query endpoint will only work with a few default properties (email, first and last name, and company), and we don’t have a way to search for contacts based on a custom property.

If you’re going to need to find all contacts with a certain value for a property on a regular basis, your best bet would be to create a smart list with that criteria, then periodically poll for new records in that list.

Get recently added contacts from a list | Contact Lists API

GET /contacts/v1/lists/:list_id/contacts/recent

If you’re only doing this search once, you can still create a list for this, and pull all of the records in the list.

Get contacts in a list | Contact Lists API

GET /contacts/v1/lists/:list_id/contacts/all

It’s also possible to create lists through the API.

Create a new contact list | Contact Lists API

POST /contacts/v1/lists

0 Upvotes
dsheehan
Member

Can I query all contacts by a property?

Thanks for the reply. Is that feature ever going to be integrated into the API? It’s certainly something that we’re interested in for our CRM.

douwe
Participant

Can I query all contacts by a property?

I'd also like this feature, to be able to add certain properties to the standard search query.