APIs & Integrations

Egoi
Contributor | Partner
Contributor | Partner

Retrieve deal association tags using HubSpot API

SOLVE

Hi there,

I´m trying to retrieve deal association tags using the API, but cannot find the property where this information is saved in the CRM. To be more precise, the data I want to retrieve is the one shown below

Captura de pantalla 2024-05-28 a las 16.08.50.png

 

This information is set in the Associations tab, in objects, but cannot find a way to retrieve this information from API when fetching deals information through API.

 

Thanks in advance!

0 Upvotes
1 Accepted solution
Teun
Solution
Recognized Expert | Elite Partner
Recognized Expert | Elite Partner

Retrieve deal association tags using HubSpot API

SOLVE

Hi @Egoi ,

You are looking for the association label to be specific. 

If you retrieve the deal using the 'read' endpoint, you can retrieve the associated objects as well, for example;

 

https://api.hubapi.com/crm/v3/objects/deals/{dealId}?associations=contacts

 

will return something like;

 

"associations": {
        "contacts": {
            "results": [
                {
                    "id": "<ID>",
                    "type": "label"
                },
            ]
        }
}

 

 You can retrieve the association label from the "type" in this result.



Learn more about HubSpot by following me on LinkedIn or YouTube

Did my answer solve your issue? Help the community by marking it as the solution.


View solution in original post

6 Replies 6
Egoi
Contributor | Partner
Contributor | Partner

Retrieve deal association tags using HubSpot API

SOLVE

Got it, this should be the endpoint I was looking for:

/crm/v4/objects/{objectType}/{objectId}/associations/{toObjectType}

 

Thanks for your time!

0 Upvotes
Egoi
Contributor | Partner
Contributor | Partner

Retrieve deal association tags using HubSpot API

SOLVE

@SteveHTM @Teun 

Thanks for your time!

 

Indeed i´m not looking for object associations, but as @SteveHTM mentioned label associations. I can retrieve them with no problem through API, the problem is that I´m not able to find for a deal for example, and check if it has any association label.

For objects associations there is no problem as you can retrieve this information through the request, but not for labels, at least I´m not able to find this information in the documentation. I would need some kind of:

"associations": {
		"labels": {
			"results": [
				{
					"id": "6029651",
					"type": "deal_to_contact"
				}
			]
		}
	}

 

in the response, so that I can do another request to the API and find to which label is associated 6029651 id.

0 Upvotes
SteveHTM
Key Advisor | Partner
Key Advisor | Partner

Retrieve deal association tags using HubSpot API

SOLVE

I don't know what object association you are retrieving, but I would have thought that a call like:

GET/crm/v4/objects/deal/{dealId}/associations/{toObjectType}

would get you the data you want? 

 

Steve

Steve Christian

HTM Solutions

https://info.htmsolutions.biz/meetings/stevec2

mobilePhone
+1 6195183009
emailAddress
stevec@htmsolutions.biz
website
www.htmsolutions.biz
address
San Diego, CA
Create Your Own Free Signature
0 Upvotes
SteveHTM
Key Advisor | Partner
Key Advisor | Partner

Retrieve deal association tags using HubSpot API

SOLVE

@Egoi - I may be missing something, but I think you will be required to make a second API call using a Deal ID (and that of the assoicated object) to retrieve association information.

 

The documentation for this is at: https://developers.hubspot.com/docs/api/crm/associations

 

Best of luck!

 

Steve

Steve Christian

HTM Solutions

https://info.htmsolutions.biz/meetings/stevec2

mobilePhone
+1 6195183009
emailAddress
stevec@htmsolutions.biz
website
www.htmsolutions.biz
address
San Diego, CA
Create Your Own Free Signature
0 Upvotes
Egoi
Contributor | Partner
Contributor | Partner

Retrieve deal association tags using HubSpot API

SOLVE

Hi @SteveHTM,

 

Thanks for your reply. Already checked assocciations documentation but I don't see the option to retrieve associations tags related to deals.

0 Upvotes
Teun
Solution
Recognized Expert | Elite Partner
Recognized Expert | Elite Partner

Retrieve deal association tags using HubSpot API

SOLVE

Hi @Egoi ,

You are looking for the association label to be specific. 

If you retrieve the deal using the 'read' endpoint, you can retrieve the associated objects as well, for example;

 

https://api.hubapi.com/crm/v3/objects/deals/{dealId}?associations=contacts

 

will return something like;

 

"associations": {
        "contacts": {
            "results": [
                {
                    "id": "<ID>",
                    "type": "label"
                },
            ]
        }
}

 

 You can retrieve the association label from the "type" in this result.



Learn more about HubSpot by following me on LinkedIn or YouTube

Did my answer solve your issue? Help the community by marking it as the solution.