# API Contact search custom property

**URL:** <https://community.hubspot.com/t/api-contact-search-custom-property/12600>\
**Category:** APIs & Integrations\
**Tags:** contacts\
**Created:** [January 10, 2019, 12:41pm UTC](https://community.hubspot.com/t/api-contact-search-custom-property/12600 "2019-01-10T12:41:54Z")\
**Posts on this page:** 10\
**Page:** 1

<div class="post-metadata">

**Author:** ![system](https://d10pqhm3lwygmk.cloudfront.net/user_avatar/community.hubspot.com/system/32/124_2.png) [@system](https://community.hubspot.com/u/system)\
**Post date:** [January 10, 2019, 12:41pm UTC](https://community.hubspot.com/t/api-contact-search-custom-property/12600/1 "2019-01-10T12:41:54Z")

</div>

Since the api for search on custom property doesnt exist i have to find a workaround. Im thinking of retrieving all contacts and then looping through each contact - extracting that property and then checking it against the search criteria

The problem im having is what API do i use to get all contacts? the current one limits to 100 results returned which doesnt help me.

Please give me some ideas

---

<div class="post-metadata">

**Author:** ![cbarley](https://d10pqhm3lwygmk.cloudfront.net/user_avatar/community.hubspot.com/cbarley/32/82559_2.png) [@cbarley](https://community.hubspot.com/u/cbarley)\
**Post date:** [January 10, 2019, 6:31pm UTC](https://community.hubspot.com/t/api-contact-search-custom-property/12600/2 "2019-01-10T18:31:18Z")

</div>

Hi [@carolynebrownlee](https://community.hubspot.com/u/carolynebrownlee)! What is your end goal when searching for a specific custom property? If you are curious to see just the properties, you should be able to use this endpoint: [https://developers.hubspot.com/docs/methods/contacts/v2/get\_contacts\_properties](https://developers.hubspot.com/docs/methods/contacts/v2/get_contacts_properties). If you’re looking for the actual _values_ on each contact, then the [get all contacts endpoint](https://developers.hubspot.com/docs/methods/contacts/get_contacts) is your best bet. You’ll need to paginate through all of your contacts 100 at a time by using the `has-more` and `vid-offset` properties returned back to you.

I created a program that I pushed to Github that loops through contacts. Take a look here for an example! [GitHub - cbarley10/hubspot-pagination: paginate through contacts using NodeJS · GitHub](https://github.com/cbarley10/hubspot-pagination)

---

<div class="post-metadata">

**Author:** ![system](https://d10pqhm3lwygmk.cloudfront.net/user_avatar/community.hubspot.com/system/32/124_2.png) [@system](https://community.hubspot.com/u/system)\
**Post date:** [January 11, 2019, 4:39am UTC](https://community.hubspot.com/t/api-contact-search-custom-property/12600/3 "2019-01-11T04:39:17Z")

</div>

Thanks so much for your response. I will accomodate this work around.  
However it would really be helpful if we could do custom searches such as “&CustomPropertyName=TESTValue”

---

<div class="post-metadata">

**Author:** ![system](https://d10pqhm3lwygmk.cloudfront.net/user_avatar/community.hubspot.com/system/32/124_2.png) [@system](https://community.hubspot.com/u/system)\
**Post date:** [January 11, 2019, 5:32am UTC](https://community.hubspot.com/t/api-contact-search-custom-property/12600/4 "2019-01-11T05:32:00Z")

</div>

Can you help me with the URL - i only want to return a specific property for all contacts

Is this correct?

[https://api.hubapi.com/contacts/v1/lists/all/contacts/all?property=company\_reg&propertyMode=value\_only](https://api.hubapi.com/contacts/v1/lists/all/contacts/all?property=company_reg&propertyMode=value_only)

im asking because its not working

even when i add the &vidOffset={value returned in previous call where has\_more was true) doesnt appear to be working either because the vidOffset returned is the same with has\_more = true.

Very confusing the options available on this API

per example API documentation

[https://api.hubapi.com/contacts/v1/lists/all/contacts/all?hapikey=demo&count=5&property=company&propertyMode=value\_only](https://api.hubapi.com/contacts/v1/lists/all/contacts/all?hapikey=demo&count=5&property=company&propertyMode=value_only)

doesnt return only that propery

then the response says …has-more":true,“vid-offset”:9153424}

so then i resend the url with an offset but it returns the same vid offset?

[https://api.hubapi.com/contacts/v1/lists/all/contacts/all?hapikey=demo&count=5&property=company&propertyMode=value\_only&vidOffset=9153424](https://api.hubapi.com/contacts/v1/lists/all/contacts/all?hapikey=demo&count=5&property=company&propertyMode=value_only&vidOffset=9153424)

---

<div class="post-metadata">

**Author:** ![cbarley](https://d10pqhm3lwygmk.cloudfront.net/user_avatar/community.hubspot.com/cbarley/32/82559_2.png) [@cbarley](https://community.hubspot.com/u/cbarley)\
**Post date:** [January 11, 2019, 5:05pm UTC](https://community.hubspot.com/t/api-contact-search-custom-property/12600/5 "2019-01-11T17:05:58Z")

</div>

Hi [@carolynebrownlee](https://community.hubspot.com/u/carolynebrownlee), Agreed this endpoint is a bit complex. The endpoint returns a few fields by default (`lastmodifieddate` `firstname` and `lastname`). When you specify a property in the URL, you will get back that field on a contact _if that contact has a value for that field_.

Here’s an example URL: [api.hubapi.com/contacts/v1/lists/all/contacts/all?hapikey=XXXXXXXXX&property=lifecyclestage&propertyMode=value\_only](http://api.hubapi.com/contacts/v1/lists/all/contacts/all?hapikey=XXXXXXXXX&property=lifecyclestage&propertyMode=value_only)

For your other question

![](https://d2qpr2jzcazej7.cloudfront.net/original/3X/e/5/e5f4937571a25b03971dd14a3dcb19ad3a89d01d.png) carolynebrownlee:

> so then i resend the url with an offset but it returns the same vid offset?

When I go to [this URL](https://api.hubapi.com/contacts/v1/lists/all/contacts/all?hapikey=demo&count=5&property=company&propertyMode=value_only&vidOffset=9153424) I can see the offset in the url is different from the offset in the response.

In the url we have `9153424` and in the response we have `9153924`

---

<div class="post-metadata">

**Author:** ![system](https://d10pqhm3lwygmk.cloudfront.net/user_avatar/community.hubspot.com/system/32/124_2.png) [@system](https://community.hubspot.com/u/system)\
**Post date:** [January 14, 2019, 10:38am UTC](https://community.hubspot.com/t/api-contact-search-custom-property/12600/6 "2019-01-14T10:38:56Z")

</div>

OK thanks Connor it is working now  
 ![smiley.png](https://d2qpr2jzcazej7.cloudfront.net/original/3X/5/e/5ece32cc997517bd0f7529e47698e55a18eaae82.png)

---

<div class="post-metadata">

**Author:** ![system](https://d10pqhm3lwygmk.cloudfront.net/user_avatar/community.hubspot.com/system/32/124_2.png) [@system](https://community.hubspot.com/u/system)\
**Post date:** [January 14, 2019, 12:23pm UTC](https://community.hubspot.com/t/api-contact-search-custom-property/12600/7 "2019-01-14T12:23:56Z")

</div>

ok next problem - this isnt going to work. To do multiple requests going through each page is not fast enough. We having multiple queries a day and its not going to work in having users wait for a response. it takes 5 minutes to go through 64 pages

Are you sure there isnt another way? is there no way this development requirement could be bumped up the dev queue?

---

<div class="post-metadata">

**Author:** ![cbarley](https://d10pqhm3lwygmk.cloudfront.net/user_avatar/community.hubspot.com/cbarley/32/82559_2.png) [@cbarley](https://community.hubspot.com/u/cbarley)\
**Post date:** [January 14, 2019, 4:44pm UTC](https://community.hubspot.com/t/api-contact-search-custom-property/12600/8 "2019-01-14T16:44:16Z")

</div>

Hi [@carolynebrownlee](https://community.hubspot.com/u/carolynebrownlee), do you have an example of the code you’ve written that paginates through your contacts? My code on [github](https://github.com/cbarley10/hubspot-pagination) I shared earlier will paginate through about 300 contacts in batches of 10 in about 5 seconds. If I bump up the limit to 100 per request, it gets returned back to me in under 2 seconds. 5 minutes seems incredibly long. How many properties are you requesting, and how many contacts are you paginating through? You should be able to get up to 100 at a time

Pagination is a pretty common design pattern for APIs such as the contacts api and we do not have plans to alter it at the moment.

---

<div class="post-metadata">

**Author:** ![system](https://d10pqhm3lwygmk.cloudfront.net/user_avatar/community.hubspot.com/system/32/124_2.png) [@system](https://community.hubspot.com/u/system)\
**Post date:** [January 18, 2019, 10:27am UTC](https://community.hubspot.com/t/api-contact-search-custom-property/12600/9 "2019-01-18T10:27:24Z")

</div>

Thanks Connor - we managed to narrow it down to the actual server where the request was being submitted from.  
All is now sorted

---

<div class="post-metadata">

**Author:** ![hridayesh](https://avatars.discourse-cdn.com/v4/letter/h/8dc957/32.png) [@hridayesh](https://community.hubspot.com/u/hridayesh)\
**Post date:** [November 8, 2019, 10:10am UTC](https://community.hubspot.com/t/api-contact-search-custom-property/12600/10 "2019-11-08T10:10:04Z")

</div>

Hi [@carolynebrownle](https://community.hubspot.com/t5/user/viewprofilepage/user-id/79023),

did you get any solution for “API Contact search custom property”? I have the same requirement.  
Thanks!  
CC: @cbarley
