Hi All,
As per documentation , i can only search contacts using contact id or email as idproperty param only accept email. I tried creating a custom property using API with hasunique value attribute to true , but it gives error that hasuniquevalue can be set tru for the field.
Can anyone help , how can i use any custom feildd to get/update contact as i can not use email and do not want use ID field.
Hello @Chauhan0
To search for contacts using a custom field, you will need to create a custom property that can be used as a filter in your API request. Unfortunately, the “hasuniquevalue” attribute is not available for custom properties, so you will need to find another way to ensure that the value of the custom property is unique for each contact.
One way to achieve this is to create a custom property with a unique prefix followed by a unique identifier, such as a contact’s email address or HubSpot ID. For example, you could create a custom property called “My_Custom_Field__email” and populate it with the contact’s email address.
To search for contacts using this custom property, you would need to include it in your API request as a filter. Here’s an example using the HubSpot Contacts API:
https://api.hubapi.com/contacts/v1/search/query?q=My_Custom_Field__email:john.doe@example.com&hapikey=demo
In this example, the “q” parameter specifies the search query, which includes the name of the custom property (“My_Custom_Field__email”) followed by the value to search for (“john.doe@example.com”). You will also need to include your HubSpot API key in the request URL. I hope this helps!
Thanks & Regards
Himanshu Rauthan
Hi, we would like to try this endpoint ourselves, however the hapikey was deprecated in 2022, and we have to use OAuth instead. What would this request on this endpoint look like using OAuth ? Thank you.