APIs & Integrations

ASawant
Member

How to I get the company id in the deals data

SOLVE

I am currently using the following endpoints to pull Companies and Deals data:

 

https://api.hubapi.com/crm/v3/objects/companies
https://api.hubapi.com/crm/v3/objects/deals

 I am also using the corresponding endpoints to pull the properties for these two objects:

https://api.hubapi.com/crm/v3/properties/companies
https://api.hubapi.com/crm/v3/properties/deals

 When I review the data, I cannot seem to find a key that joins a deal with the company. 

 

Can someone please guide me on how to get this association. 

0 Upvotes
1 Accepted solution
webdew
Solution
Guide | Diamond Partner
Guide | Diamond Partner

How to I get the company id in the deals data

SOLVE

Hello,

If you want to get company id in deal data then use below api :
https://api.hubapi.com/deals/v1/deal/paged?hapikey=demo&includeAssociations=true&limit=2&properties=...

Get associatedCompanyIds from the response of deal data.
Response :
{
"deals": [
{
"portalId": 62515,
"dealId": 18039629,
"isDeleted": false,
"associations": {
"associatedVids": [
603883, 839904
],
"associatedCompanyIds": [
200890
],
"associatedDealIds": [

]
},
"properties": {
"dealname": {
"value": "Company",
"timestamp": 1457040864519,
"source": "API",
"sourceId": null,
"versions": [
{
"name": "dealname",
"value": "Company Name",
"timestamp": 1457040864519,
"source": "API",
"sourceVid": [

]
}
]
}
},
"imports": [

]
}
],
"hasMore": true,
"offset": 18040854
}

If you want to associate then use below link
Use below code for associated with deal or company as well :
https://legacydocs.hubspot.com/docs/methods/crm-associations/associate-objects

Hope this helps!


If we were able to answer your query, kindly help the community by marking it as a solution.

Thanks and Regards. 




View solution in original post

1 Reply 1
webdew
Solution
Guide | Diamond Partner
Guide | Diamond Partner

How to I get the company id in the deals data

SOLVE

Hello,

If you want to get company id in deal data then use below api :
https://api.hubapi.com/deals/v1/deal/paged?hapikey=demo&includeAssociations=true&limit=2&properties=...

Get associatedCompanyIds from the response of deal data.
Response :
{
"deals": [
{
"portalId": 62515,
"dealId": 18039629,
"isDeleted": false,
"associations": {
"associatedVids": [
603883, 839904
],
"associatedCompanyIds": [
200890
],
"associatedDealIds": [

]
},
"properties": {
"dealname": {
"value": "Company",
"timestamp": 1457040864519,
"source": "API",
"sourceId": null,
"versions": [
{
"name": "dealname",
"value": "Company Name",
"timestamp": 1457040864519,
"source": "API",
"sourceVid": [

]
}
]
}
},
"imports": [

]
}
],
"hasMore": true,
"offset": 18040854
}

If you want to associate then use below link
Use below code for associated with deal or company as well :
https://legacydocs.hubspot.com/docs/methods/crm-associations/associate-objects

Hope this helps!


If we were able to answer your query, kindly help the community by marking it as a solution.

Thanks and Regards.