Bug in fetch contact details API

Hi team,

I’ve encountered a case that I believe may indicate a bug in the system. It appears that the contactId parameter is accepted as both a string and an integer value within the system. However, on the API end, it only accepts an integer.

We’re using the following API endpoint: https://api.hubapi.com/crm/v3/objects/contacts/{{value}}?properties=email. As per the documentation, the value parameter should accept both string and integer values. However, when an integer is passed, an error occurs.

Could you please review this discrepancy and provide some insights into the underlying cause?

Thanks!

Hi @devphoenix, I hope that you are well!
Thanks for asking the Community!
Let’s check with our Top Experts on this: Hi @zach_threadint, @Teun, @HubSpot_Corey do you have tips or suggestions to help @devphoenix, please?
Thanks a lot and have a fantastic day!
Best,
Bérangère

Hi @devphoenix :waving_hand:

In the screenshot you’ve supplied, it appears as though you are attempting to retrieve information about a HubSpot Contact with an internal record ID (property API name “hs_object_id”) of “promoter”. HubSpot internal record IDs are always integers (often expressed in string format, e.g. “123456789”), which is why you’re receiving a 404 not found error message.

Maybe you are trying to retrieve a HubSpot Contact using a different unique identifier (i.e. not HubSpot’s default internal record ID)? If this is true, you’ll need to specify the “idProperty” in the request query parameters.

I hope this proves helpful. Please let me know if you have any follow-up questions.

Hi @devphoenix and thanks for the tag @BérangèreL ,
Just to add to @zach_threadint 's reply. To pull an object using this API you can only use record id, email or a unique custom property as explained here. If you’re wanting to find results using anything else, you might have better luck using the filter groups in the search API found here.

Hi @zach_threadint, @Teun, @HubSpot_Corey,

Thank you for your assistance.

I’d like to clarify the issue we’re facing:

According to the HubSpot API documentation for /crm/v3/objects/contacts/{contactId} (reference link), contactId should accept a string value. However, in our use case, the API behaves inconsistently:

  • We observed that int values are generally accepted as contactId.
  • One specific case involved a company with an associated contact where the contactId is a string. When this string is passed to the API, it returns an error (as shown in the screenshot previously shared).

Issue Summary: If hs_object_id is supposed to be an integer, why is it sometimes stored as a string (e.g., with a promotor value)? Conversely, if hs_object_id is actually a string, why does the /crm/v3/objects/contacts/{contactId} endpoint only accept integers in some cases?

Would appreciate any insights on this behavior.

Thank you!

Hi @devphoenix :waving_hand:

Thanks for the extra information.

The hs_object_id property is always set by HubSpot and will always be set as an integer (often formatted as a string in API responses, e.g. “hs_object_id”: “123456789”). Therefore, the “promotor” value you’ve mentioned is definitely not the given Contact’s hs_object_id, which is why you’re receiving a 404 not found error (i.e. there’s no Contact in your HubSpot Portal where the hs_object_id is equal to “promotor”).

By default, the contactId API request path parameter, expects the relevant hs_object_id. Alternatively, as @HubSpot_Corey mentions here, you can also set contactId as another unique identifier. However, in order to do this you must set the request query paramater “idProperty” to the given unique identifer property name (e.g. “email” or a custom property that has been configured as a unique identifier).

I think where you’ll need to go from here is to work out where this value “promotor” is coming from, because it’s definitely not coming from HubSpot’s default hs_object_id property.

I hope that proves helpful. Please let me know if you have any follow-up questions.