How/where to get the contact ID ?

Hi !

Following the documentation on the Contacts API, I’m having a hard time figuring out where the {contactId} property is supposed to come from. In the legacy API, one could use the hubspotutk cookie to get a unique token to identify contacts. I’m struggling to find how to do the same with the new API.

I’d like to be able to fetch, from my website, the contact record associated with the visitor, so I can personalize the content. How can this be done ?

Thank you !

Hey, @LeKevoid :waving_hand: Can you share an example request? Or clarify your goal a bit more for the community, please?
If you don’t have Contact ID, but you do have their email address, for example, you can use their email address instead:
Please note: the idProperty query parameter doesn’t appear on the Endpoints tab due to technical limitations, but it can be used for contacts exclusively with email. To use an email address as the unique identifier, set the idProperty as email and enter the email address in place of the contact ID. This should be set as a query parameter rather than added to the request body.

If that is not what you are after, can you specific the part in the documentation that is not working as expected? Or the endpoint example you are working with, please?

Thank you in advance. — Jaycee

I think that I have the same requirement. I am looking for a technique that will allow me to personalise the content on a WordPress page based on discovering the HubSpot contact id of the visitor to my web page.
(Ideally, I would like to do this in JavaScript within my WordPress page, but if I need to use the HubSpot API then I expect that call will need to come from a server in order to keep access tokens secure.)
What options are there for achieving this?