APIs & Integrations

akshayMore
Participant

difference between hs_object_id and id in the get endpoint response

SOLVE

I am using CRM objects GET API endpoint for example, Retrieve companies

I get a response such:


"results": [
{
"archived": false,
"createdAt": "2023-03-03T11:59:25.795Z",
"id": "7777",
"properties": {
"createdate": "2023-03-03T11:59:25.795Z",
"domain": "xyz.com",
"hs_lastmodifieddate": "2023-05-15T12:40:31.237Z",
"hs_object_id": "7777",
"name": "xyz"
},
"updatedAt": "2023-05-15T12:40:31.237Z"
},
{
"archived": false,
"createdAt": "2023-03-07T12:10:04.817Z",
"id": "6666",
"properties": {
"createdate": "2023-03-07T12:10:04.817Z",
"domain": "abc.com",
"hs_lastmodifieddate": "2025-02-04T13:19:43.104Z",
"hs_object_id": "6666",
"name": "abc"
},
"updatedAt": "2025-02-04T13:19:43.104Z"
}
]

 

My questions:

  1. Can I assume that id and hs_object_id same always for a given objects such as company, deals, products?
  2. Can I also assume createdAt and createdate Same?
  3. Similarily, Can I also assume hs_lastmodifieddate and updatedAt Same?

    I would like to know how values differ? as far as I can see the data in above keys have same value in my data
0 Upvotes
1 Accepted solution
zach_threadint
Solution
Guide

difference between hs_object_id and id in the get endpoint response

SOLVE

Hi @akshayMore 👋

 

In response to your questions (to the best of my knowledge):

  1. Yes, you can always assume that "id" and "hs_object_id" will be the same value for all object types.
  2. This depends on the object type you're working with. For Contacts and Companies, the value for the "createdate" property and the "createdAt" 'attribute' should be the same, because "createdate" is read-only for these object types. However, the "createdate" property is not read-only for at least some object types, including Tickets, Deals, Products and Line Items. To check whether or not a property is read-only, you can use the Properties API (look for modificationMetadata.readOnlyValue). Note also that there's a separate property on all object types, "hs_createdate". This is always read-only, so it should always match the "createdAt" attribute.
  3. Yes, you can always assume "updatedAt" will match "hs_lastmodifieddate".

Please note, there may be subtleties that I'm not aware, so please take this with a pinch of salt. Regardless, I hope this proves helpful. Please let me know if you have any follow-up questions.

All the best,

Zach

--

Zach Klein
HubSpot Integrations & App Developer
Meanjin / Brisbane, Australia



Say g'day


If my post helped answer your query, please consider marking it as a solution.


View solution in original post

3 Replies 3
zach_threadint
Solution
Guide

difference between hs_object_id and id in the get endpoint response

SOLVE

Hi @akshayMore 👋

 

In response to your questions (to the best of my knowledge):

  1. Yes, you can always assume that "id" and "hs_object_id" will be the same value for all object types.
  2. This depends on the object type you're working with. For Contacts and Companies, the value for the "createdate" property and the "createdAt" 'attribute' should be the same, because "createdate" is read-only for these object types. However, the "createdate" property is not read-only for at least some object types, including Tickets, Deals, Products and Line Items. To check whether or not a property is read-only, you can use the Properties API (look for modificationMetadata.readOnlyValue). Note also that there's a separate property on all object types, "hs_createdate". This is always read-only, so it should always match the "createdAt" attribute.
  3. Yes, you can always assume "updatedAt" will match "hs_lastmodifieddate".

Please note, there may be subtleties that I'm not aware, so please take this with a pinch of salt. Regardless, I hope this proves helpful. Please let me know if you have any follow-up questions.

All the best,

Zach

--

Zach Klein
HubSpot Integrations & App Developer
Meanjin / Brisbane, Australia



Say g'day


If my post helped answer your query, please consider marking it as a solution.


akshayMore
Participant

difference between hs_object_id and id in the get endpoint response

SOLVE

Thanks a lot for the quick response! helpful!

SteveHTM
Key Advisor | Partner
Key Advisor | Partner

difference between hs_object_id and id in the get endpoint response

SOLVE

@akshayMore - confusing, isn't it! I am pretty sure you can assume that these examples of 'id' and 'hs_object_id' demonstrate that the record ID values will always be the same - just represented differently due to the history of the API development over time.

 

Steve

Steve Christian

HTM Solutions

https://info.htmsolutions.biz/meetings/stevec2

mobilePhone
+1 6195183009
emailAddress
stevec@htmsolutions.biz
website
www.htmsolutions.biz
address
San Diego, CA
Create Your Own Free Signature