# Fetching engagements by date filter for specific contact

**URL:** <https://community.hubspot.com/t/fetching-engagements-by-date-filter-for-specific-contact/117663>\
**Category:** APIs & Integrations\
**Tags:** free\
**Created:** [October 4, 2024, 8:45am UTC](https://community.hubspot.com/t/fetching-engagements-by-date-filter-for-specific-contact/117663 "2024-10-04T08:45:19Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![Mahadev](https://avatars.discourse-cdn.com/v4/letter/m/e19b73/32.png) [@Mahadev](https://community.hubspot.com/u/Mahadev)\
**Post date:** [October 4, 2024, 8:45am UTC](https://community.hubspot.com/t/fetching-engagements-by-date-filter-for-specific-contact/117663/1 "2024-10-04T08:45:19Z")

</div>

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.](https://api.hubapi.com/engagements/v1/engagements/associated/contact/%7Bvid%7D/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](https://secure-web.cisco.com/1qLwRV2AD3JyQoS88YKI9TKm-Te5jO2CoFpPuZ29yQPQLQJ8vti5E30qoFqejGI7sUtwGMohzYz8-Uv7Vabm-jCC8nKklCq-Fhkqscb4fKiVDe4Gi5kfeYoZ5poMPzjz6e3AhPYqsWw9Hpekr3z0rKOhOk1IdLu6wqCroBnupq3iK0WklzleBY8X21BgRjipcWe-ZryT1zvhHgR9aG48DOcMxWPYew3VlZTFwSCngH7CEUGrmZR4mFPZIFKkRsQF3F2aURQiHXpcRzytinOcrAUc4uI4QGItMkHEcdM7Dro9EqFIhpeACPrKrf3XpWhrtEQGi8zYKmdlJkB1s9P9im5tx6wTRFJqVRERPYKtyQKNCRiHIF-e9YjSa-OmKz1Q4c8q8BpDv67FqhX_TmAf5ww/https%3A%2F%2F8-04.na1.hs-service-engage.com%2FCtc%2F41%2B23284%2F8-04%2FJlF2-6qcW8wLKSR6lZ3kXW64gVlB4VY_DVW7162fv6YSG0CW2TCrvC7sDMzwV8pxk-5-lyH3W1ZwK8M2NSf3KN8Tl8gh6dJ8hW9lQx926f9_DrN3sY04F6QqzYW8YjpTC8DBDr5W2HBB9F2TKRTQN7SC9Hs62jDbN17TJz1XN595W6DcWWq4v89v3W2dLccN182b3_W8bTvyz6fM73-W3bghH73q2TqgW4Rhsdb6xD4pwN3Gn8bcK91xPW5LhbHG6YYHncW2Vm_rb1lVVTxW6gpT9S2jJ7y6N4JQFjHV9jKzN6hDGwXzgwg-W2fsL5V9m1VxGW5cy3v17RVcxfW4B1JJv2LcD2NW3RrKn77Ghj-6W4CNbTn7zZTX_f2z61cv04)

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?

---

<div class="post-metadata">

**Author:** ![Jaycee\_Lewis](https://d10pqhm3lwygmk.cloudfront.net/user_avatar/community.hubspot.com/jaycee_lewis/32/61352_2.png) [@Jaycee\_Lewis](https://community.hubspot.com/u/Jaycee_Lewis)\
**Post date:** [October 4, 2024, 6:56pm UTC](https://community.hubspot.com/t/fetching-engagements-by-date-filter-for-specific-contact/117663/2 "2024-10-04T18:56:27Z")

</div>

Hey, @Mahadev 👋 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**](https://developers.hubspot.com/docs/cms/data/query-hubspot-data-using-graphql). We’ll also leave this here in case other community members have suggestions for you.

Best,

Jaycee

---

<div class="post-metadata">

**Author:** ![Teun](https://d10pqhm3lwygmk.cloudfront.net/user_avatar/community.hubspot.com/teun/32/28739_2.png) [@Teun](https://community.hubspot.com/u/Teun)\
**Post date:** [October 4, 2024, 8:04pm UTC](https://community.hubspot.com/t/fetching-engagements-by-date-filter-for-specific-contact/117663/3 "2024-10-04T20:04:39Z")

</div>

Hi @Mahadev ,  
Wouldn’t you be able to use the [Search API](https://developers.hubspot.com/docs/api/crm/search) for this use-case? You could create a search API call where you search for all [engagements](https://developers.hubspot.com/docs/api/crm/search#searchable-crm-objects-and-engagements) associated to a [specific contact](https://developers.hubspot.com/docs/api/crm/search#search-through-associations) and set a datetime range. This could look something like:

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

```

---

<div class="post-metadata">

**Author:** ![Mahadev](https://avatars.discourse-cdn.com/v4/letter/m/e19b73/32.png) [@Mahadev](https://community.hubspot.com/u/Mahadev)\
**Post date:** [October 7, 2024, 8:49am UTC](https://community.hubspot.com/t/fetching-engagements-by-date-filter-for-specific-contact/117663/4 "2024-10-07T08:49:18Z")

</div>

Hi @Teun ,

The [Search API](https://developers.hubspot.com/docs/api/crm/search?_gl=1*18tihj1*_gcl_au*MjAzNTc1OTgwMC4xNzI4Mjg3MDQ1*_ga*MTE1NzIwNzE2Ni4xNzI4Mjg3MDQ2*_ga_LXTM6CQ0XK*MTcyODI4NjQzMS4yNS4xLjE3MjgyOTA0MDguMzguMC4w) 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](https://api.hubapi.com/engagements/v1/engagements/associated/contact/%7Bvid%7D/paged?limit=200).

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