We use cookies to make HubSpot's community a better place. Cookies help to provide a more personalized experience and relevant advertising for you, and web analytics for us. To learn more, and to see a full list of cookies we use, check out our Cookie Policy (baked goods not included).
Oct 21, 2021 6:26 AM
Dear all,
I would like to ask if it is possible to obtain the owner of a contact by calling the contacts API.
client.crm.contacts.basic_api.get_page()
I saw in the past you could by adding "hubspot_owner_id" into properties, some people recommended to cross Apis with Owner, but I couldn't find a clear way either.
I would like to ask if there is any way to get the list of properties that I can add to the request.
Thank you in advance.
Solved! Go to Solution.
Oct 29, 2021 5:44 AM
Hi @HOrdonez
Relating to your original question --> yes, you can retrieve information about the owner of a Contact record, using the Contact API. For example:
GET
https://api.hubapi.com/crm/v3/objects/CONTACT/{{CONTACT_ID}}?properties=hubspot_owner_id,hubspot_owner_assigneddate,hubspot_team_id&hapikey={{HAPIKEY}}
Example Response Body:
{
"id": {{CONTACT_ID}},
"properties": {
"createdate": "2019-01-30T12:55:07.451Z",
"hs_object_id": {{CONTACT_ID}},
"hubspot_owner_assigneddate": "2021-08-26T14:30:29.555Z",
"hubspot_owner_id": {{CONTACT_OWNER_ID}},
"hubspot_team_id": {{CONTACT_OWNER_TEAM_ID}},
"lastmodifieddate": "2021-10-28T16:12:15.677Z"
},
"createdAt": "2019-01-30T12:55:07.451Z",
"updatedAt": "2021-10-28T16:12:15.677Z",
"archived": false
}
Likewise, specific property values can be retrieved when requesting lists or batches of Contacts via the API.
As @dennisedson mentioned, you can use the Get All Properties endpoint to inspect all available properties relevant to record ownership. Here are some I found that might be of interest (descriptions for each can be found in the API response):
Relating to your follow up question in this thread --> yes, it is possible to use the CRM Search API endpoint to retrieve a list of Contact records based on when they were last modified. For example:
POST
https://api.hubapi.com/crm/v3/objects/CONTACT/search?hapikey={{HAPIKEY}}
Request Body (JSON):
{
"limit": 5,
"filterGroups": [
{
"filters": [
{
"propertyName": "lastmodifieddate",
"operator": "GTE",
"value": "1635435000000"
}
]
}
]
}
For anyone not overly familiar with the CRM Search API --> "GTE" is the endpoint's "greater than or equal to" operator, and "1635435000000" reflects the example target datetime in Unix epoch time (milliseconds). I generally use EpochConverter for generating test timestamps like this.
Finally, the Contact property being searched on in the above example is "lastmodifieddate", not to be confused with "hs_lastmodifieddate". The latter is a hidden property which, based on some very quick testing, cannot be used within CRM Search API filters.
Hope this helps 🙂
All the best,
Zach
Oct 29, 2021 5:44 AM
Hi @HOrdonez
Relating to your original question --> yes, you can retrieve information about the owner of a Contact record, using the Contact API. For example:
GET
https://api.hubapi.com/crm/v3/objects/CONTACT/{{CONTACT_ID}}?properties=hubspot_owner_id,hubspot_owner_assigneddate,hubspot_team_id&hapikey={{HAPIKEY}}
Example Response Body:
{
"id": {{CONTACT_ID}},
"properties": {
"createdate": "2019-01-30T12:55:07.451Z",
"hs_object_id": {{CONTACT_ID}},
"hubspot_owner_assigneddate": "2021-08-26T14:30:29.555Z",
"hubspot_owner_id": {{CONTACT_OWNER_ID}},
"hubspot_team_id": {{CONTACT_OWNER_TEAM_ID}},
"lastmodifieddate": "2021-10-28T16:12:15.677Z"
},
"createdAt": "2019-01-30T12:55:07.451Z",
"updatedAt": "2021-10-28T16:12:15.677Z",
"archived": false
}
Likewise, specific property values can be retrieved when requesting lists or batches of Contacts via the API.
As @dennisedson mentioned, you can use the Get All Properties endpoint to inspect all available properties relevant to record ownership. Here are some I found that might be of interest (descriptions for each can be found in the API response):
Relating to your follow up question in this thread --> yes, it is possible to use the CRM Search API endpoint to retrieve a list of Contact records based on when they were last modified. For example:
POST
https://api.hubapi.com/crm/v3/objects/CONTACT/search?hapikey={{HAPIKEY}}
Request Body (JSON):
{
"limit": 5,
"filterGroups": [
{
"filters": [
{
"propertyName": "lastmodifieddate",
"operator": "GTE",
"value": "1635435000000"
}
]
}
]
}
For anyone not overly familiar with the CRM Search API --> "GTE" is the endpoint's "greater than or equal to" operator, and "1635435000000" reflects the example target datetime in Unix epoch time (milliseconds). I generally use EpochConverter for generating test timestamps like this.
Finally, the Contact property being searched on in the above example is "lastmodifieddate", not to be confused with "hs_lastmodifieddate". The latter is a hidden property which, based on some very quick testing, cannot be used within CRM Search API filters.
Hope this helps 🙂
All the best,
Zach
Oct 22, 2021 10:42 AM
@HOrdonez , you can hit the properties endpoint to get all of the available properties for an object
![]() | Make sure to subscribe to our YouTube channel where you can find the HubSpot Community Developer Show |
Oct 26, 2021 8:58 AM
Thank you @dennisedson. Really useful the property feature.
Do you know if it's possible to filter contacts by modification date, it doesn't appear here:
https://developers.hubspot.com/docs/api/crm/search
Or if there is other way to do it?
Thank you in advance.
Oct 27, 2021 2:01 PM
It might be worth looking at webhooks which can watch for changes of properties
@zaklein , what would you do?
![]() | Make sure to subscribe to our YouTube channel where you can find the HubSpot Community Developer Show |
Oct 28, 2021 10:31 AM
Thank you for your answer @dennisedson. I would just like to filter the API call by some timestamp in order to don't have to bulk all the data every time.
Having the infrastructure to deal with a Webhook is a bit more complex, but if this is the best practices you recommend. I can work on it.
I will wait @zaklein answer as well.