# Retrieve Association with Tasks

**URL:** <https://community.hubspot.com/t/retrieve-association-with-tasks/114800>\
**Category:** APIs & Integrations\
**Tags:** free\
**Created:** [August 20, 2024, 8:57am UTC](https://community.hubspot.com/t/retrieve-association-with-tasks/114800 "2024-08-20T08:57:12Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![teja21](https://avatars.discourse-cdn.com/v4/letter/t/a9adbd/32.png) [@teja21](https://community.hubspot.com/u/teja21)\
**Post date:** [August 20, 2024, 8:57am UTC](https://community.hubspot.com/t/retrieve-association-with-tasks/114800/1 "2024-08-20T08:57:12Z")

</div>

I have following endpoint with contactId which associated with task, and I want to fetch task details with association of contact. Check below screenshot where I’m hitting the endpoint but I gets an error of infer object.

 ![teja21_0-1724143758482.png](https://d2qpr2jzcazej7.cloudfront.net/original/3X/2/8/28bee3cef3e58f041d7917e22ab1774075e5c319.png)

Anybody there who can suggest on this and guide me to fetch associated object with Task.

Regards,

@teja21

---

<div class="post-metadata">

**Author:** ![coldrickjack](https://d10pqhm3lwygmk.cloudfront.net/user_avatar/community.hubspot.com/coldrickjack/32/6684_2.png) [@coldrickjack](https://community.hubspot.com/u/coldrickjack)\
**Post date:** [August 20, 2024, 10:27am UTC](https://community.hubspot.com/t/retrieve-association-with-tasks/114800/2 "2024-08-20T10:27:18Z")

</div>

Hi @teja21,

The reason you are encountering this issue is due to an invalid value being supplied in the “associations” query parameter. In your case it seems as though you’d like to get the associated contacts linked to the task. If that is the case you can use the CRM APIs, specifically [GET /crm/v3/objects/tasks](https://developers.hubspot.com/beta-docs/reference/api/crm/engagements/tasks#get-%2Fcrm%2Fv3%2Fobjects%2Ftasks) as follows:

```lia-code-sample
GET https://api.hubapi.com/crm/v3/objects/tasks?associations=contacts
RESPONSE
{
 "results": [
 {
 "id": "31319162089",
 "properties": {
 "hs_createdate": "2024-08-08T14:26:07.802Z",
 "hs_lastmodifieddate": "2024-08-13T07:01:33.124Z",
 "hs_object_id": "31319162089"
 },
 "createdAt": "2024-08-08T14:26:07.802Z",
 "updatedAt": "2024-08-13T07:01:33.124Z",
 "archived": false,
 "associations": {
 "contacts": {
 "results": [
 {
 "id": "28333023942",
 "type": "task_to_contact"
 }
 ]
 }
 }
 }
 ]
}

```

Notice in the above example I specifcy “ **associations=contacts** ”. The response contains the IDs of any associated contacts in the “associations” object. I can then pull information on the contact using [GET /crm/v3/objects/contacts/{contactId}](https://developers.hubspot.com/beta-docs/reference/api/crm/objects/contacts#get-%2Fcrm%2Fv3%2Fobjects%2Fcontacts%2F%7Bcontactid%7D).

I hope this helps!

Jack
