Filtering companies by last activity date

I’m trying to reach the API endpoint, filtering by the “last activity” field, and I’m not receiving a response.

https://api.hubapi.com/crm/v3/objects/companies?limit=20&properties=lastActivity

This is the first time I’m attempting to access the HubSpot API. Any suggestions and/or assistance would be appreciated.

Thank you!

If you really want to dive in you might consider taking a certification course that teaches you all about using the APIs: https://academy.hubspot.com/

Hi @fsad :waving_hand:

Welcome to the community :slightly_smiling_face:

You might consider using the CRM Search API for this request.

For example, imagine you want to identify Companies that have a “Last Activity Date” of on or after 1 January 2024. Your HubSpot CRM Search API request might look something like this:

POST https://api.hubapi.com/crm/v3/objects/**COMPANY**/search

Headers:

  • Content-Type: application/json
  • Accept: application/json
  • Authorization: Bearer {YOUR_ACCESS_TOKEN}

Body (JSON):

{
 "limit": 100,
 "properties": [
 "notes_last_updated"
 ],
 "filterGroups": [
 {
 "filters": [
 {
 "propertyName": "notes_last_updated",
 "operator": "GTE",
 "value": "2024-01-01"
 }
 ]
 }
 ]
}

Please note that the property “Last Activity Date” has an internal name (used when interacting with HubSpot APIs) of “notes_last_updated”. This property’s description, as supplied by HubSpot, is:

“The last time a call, chat conversation, LinkedIn message, postal mail, meeting, note, sales email, SMS, or WhatsApp message was logged for a company. This is set automatically by HubSpot based on user actions in the company record.”

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