I can't see Deal associations through API

SOLVE
Highlighted
Occasional Contributor

Hello,

 

I'm trying to map 'owner' information to each deal.

 

I simply copy & pasted python code from API document page, and added "'associations' : True" to get associations data as below.

 

upload.PNG

 

But I got nothing but 'None' for associations as a result.

When I exported deals data in spreadsheet format, I could see some relevant fields such as deal owner.

Why I can't extract associations through API in this case..?

Am I missing to set something here?

 

Thank you so much.

 

Reply
0 Upvotes
1 Accepted solution

Accepted Solutions
HubSpot Moderator

Welcome, @Noob.

 

Happy to clarify.

 

The Get all deals endpoint will return associations if you append includeAssociations=true to the request URL. associations=true is invalid.

 

Here's the example I used:

https://api.hubspot.com/deals/v1/deal/paged?includeAssociations=true

 

I should also note that the deal owner is not stored as an association, but in the deal property hubspot_owner_id. Owners are referenced by ID, so you will need to use this Owners API endpoint to match them with their names or email addresses.

 

Thus, if you want to retrieve the deal owner and associations to contacts, companies, and tickets, use:

https://api.hubspot.com/deals/v1/deal/paged?includeAssociations=true&properties=hubspot_owner_id

Isaac Takushi

HubSpot Developer Support
2 Replies 2
Occasional Contributor

When I connected 'recently created deals' API, I could fully see the associations information.

 

Is it that Hubspot does not support associations information for 'get all deals' API?

Reply
0 Upvotes
HubSpot Moderator

Welcome, @Noob.

 

Happy to clarify.

 

The Get all deals endpoint will return associations if you append includeAssociations=true to the request URL. associations=true is invalid.

 

Here's the example I used:

https://api.hubspot.com/deals/v1/deal/paged?includeAssociations=true

 

I should also note that the deal owner is not stored as an association, but in the deal property hubspot_owner_id. Owners are referenced by ID, so you will need to use this Owners API endpoint to match them with their names or email addresses.

 

Thus, if you want to retrieve the deal owner and associations to contacts, companies, and tickets, use:

https://api.hubspot.com/deals/v1/deal/paged?includeAssociations=true&properties=hubspot_owner_id

Isaac Takushi

HubSpot Developer Support