2 weeks ago
- last edited
2 weeks ago
by BérangèreL
Participant
User/Owner IDs don't align
SOLVE
When we get a user from the POST /crm/v3/objects/users/search endpoint, it has an ID 1 of [ID 1 here]. When I GET /crm/v3/owners, it has an ID 2 of [ID 2 here] (makes sense that it's different, one is a user and one is an owner), but the userId on the exact same owner/person is [ID 3 here]. Doesn't match the ID 1 [ID 1 here] at all. How does this work?????
I agree, the concept of User ID / Owner ID / CRM Record ID can be confusing. Here's how I understand it:
We're working with 2 distinct HubSpot "Object Types" (albeit "special" Object Types that don't always operate in the same way as the standard CRM Object Types):
Owner
User
Relevant to your described use case, a User "record" has the following ID properties:
"hs_object_id" (also returned as "id" by the API, outside the "properties" object)
"hubspot_owner_id"
"hs_internal_user_id"
To demonstrate the relationship between these IDs, you might like to consider the following HubSpot API responses, representing the same "person" who accesses the given HubSpot portal:
// GET /crm/v3/owners
{
"results": [
{
"id": "209582270", // matches "hubspot_owner_id" in subsequent example
"email": "example@gmail.com",
"type": "PERSON",
"firstName": "Example",
"lastName": "Owner",
"userId": 9887783, // matches "hs_internal_user_id" in subsequent example
"userIdIncludingInactive": 9887783,
"createdAt": "2021-12-15T12:27:06.833Z",
"updatedAt": "2022-10-14T04:26:29.590Z",
"archived": false,
"teams": [
{
"id": "140468592",
"name": "Test Team 1",
"primary": true
}
]
}
]
}
// GET /crm/v3/objects/users?properties=hubspot_owner_id,hs_internal_user_id
{
"results": [
{
"id": "60177263045", // this is the User's CRM Record ID (i.e. "hs_object_id")
"properties": {
"hs_createdate": "2021-12-15T12:27:01.825Z",
"hs_internal_user_id": "9887783", // matches "userId" in the previous example
"hs_lastmodifieddate": "2024-07-16T04:51:26.719Z",
"hs_object_id": "60177263045",
"hubspot_owner_id": "209582270" // matches "id" in the previous example
},
"createdAt": "2021-12-15T12:27:01.825Z",
"updatedAt": "2024-07-16T04:51:26.719Z",
"archived": false
}
]
}
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
I agree, the concept of User ID / Owner ID / CRM Record ID can be confusing. Here's how I understand it:
We're working with 2 distinct HubSpot "Object Types" (albeit "special" Object Types that don't always operate in the same way as the standard CRM Object Types):
Owner
User
Relevant to your described use case, a User "record" has the following ID properties:
"hs_object_id" (also returned as "id" by the API, outside the "properties" object)
"hubspot_owner_id"
"hs_internal_user_id"
To demonstrate the relationship between these IDs, you might like to consider the following HubSpot API responses, representing the same "person" who accesses the given HubSpot portal:
// GET /crm/v3/owners
{
"results": [
{
"id": "209582270", // matches "hubspot_owner_id" in subsequent example
"email": "example@gmail.com",
"type": "PERSON",
"firstName": "Example",
"lastName": "Owner",
"userId": 9887783, // matches "hs_internal_user_id" in subsequent example
"userIdIncludingInactive": 9887783,
"createdAt": "2021-12-15T12:27:06.833Z",
"updatedAt": "2022-10-14T04:26:29.590Z",
"archived": false,
"teams": [
{
"id": "140468592",
"name": "Test Team 1",
"primary": true
}
]
}
]
}
// GET /crm/v3/objects/users?properties=hubspot_owner_id,hs_internal_user_id
{
"results": [
{
"id": "60177263045", // this is the User's CRM Record ID (i.e. "hs_object_id")
"properties": {
"hs_createdate": "2021-12-15T12:27:01.825Z",
"hs_internal_user_id": "9887783", // matches "userId" in the previous example
"hs_lastmodifieddate": "2024-07-16T04:51:26.719Z",
"hs_object_id": "60177263045",
"hubspot_owner_id": "209582270" // matches "id" in the previous example
},
"createdAt": "2021-12-15T12:27:01.825Z",
"updatedAt": "2024-07-16T04:51:26.719Z",
"archived": false
}
]
}
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