Fetching engagements by date filter for specific contact

I would like to retrieve engagements associated with a specific contact, filtered by a date/timestamp range.

Currently, I’m using this API: https://api.hubapi.com/engagements/v1/engagements/associated/contact/{vid}/paged?limit=200.

Is there a way to apply a date/timestamp filter to fetch only the relevant engagements for a contact?

The newer Associations API endpoint returns all engagements, while the ‘recent engagements’ endpoint filters by date but doesn’t allow filtering by contact ID.

For reference, here is an example of the Marketing Emails API with a date/timestamp filter:

https://api.hubapi.com/email/public/v1/events?recipient={emailID}&eventType=SENT&limit=200&startTimestamp=1725148800000&endTimestamp=1727740800000

I’m looking for something similar for engagements.

Could someone please guide me on how to achieve this, or let me know if there is an API that supports this requirement?

Hey, @Mahadev :waving_hand: It looks like you are hitting up against the limitations of our endpoints. There isn’t a single endpoint that meets all of your needs for making a filtered request for engagements and associations. You’ll likely need to make multiple requests and filter by date locally using custom logic. If you have a Sales, Service, or Content Hub Enterprise subscription, you can also investigate using GraphQL. We’ll also leave this here in case other community members have suggestions for you.

Best,

Jaycee

Hi @Mahadev ,
Wouldn’t you be able to use the Search API for this use-case? You could create a search API call where you search for all engagements associated to a specific contact and set a datetime range. This could look something like:

{
 "filterGroups": [
 {
 "filters": [
 {
 "propertyName": "associations.contact",
 "operator": "EQ",
 "value": "123"
 },
 {
 "propertyName": "hs_createdate",
 "operator": "BETWEEN",
 "highValue": "1642672800000",
 "value": "1579514400000"
 }
 ]
 }
 ]
}

Hi @Teun ,

The Search API provides separate endpoints for different engagement types such as calls, meetings, notes, and tasks. Instead of making individual API calls for each engagement type, I want to retrieve all types in a single API call. For this, I’m using the following endpoint:

https://api.hubapi.com/engagements/v1/engagements/associated/contact/{vid}/paged?limit=200.

However, this endpoint does not offer an option to filter results by date range. Could you suggest a solution for this?