I am working with the Deals API and I would like to know how to get the Company Name from a Deal?
Hi @ricky23,
The company property Name belongs to the company object and thus cannot be pulled directly from the Deals API.
When you get a deal, the Deals API returns the ID of any associated company in the associatedCompanyIds field.
To get the company name, you must then query the Companies API with the returned companyId.
For anybody looking for a solution using the v3 API… Once you get a Deal ID, you need to look up the associations using the following endpoint: Accounts Dashboard | HubSpot
From their you can lookup the Company info by the Company ID.
Why doensn’t HubSpot just allow it to be a property of the deal?
I’ve tried both the batch read api for deals and search api and neither return company id or any other associations.
Hi, I can’t seem to get associatedCompanyIds returned in my deals call nor do I see it in your documentation. Is this still active? I’m trying to find the companyId or companyName from a deal.
Hey, @kweckwerth @CMarl
Have you tried using the legacy Get a deal endpoint? This endpoint will return the IDs for the Associations you are after.
GET /deals/v1/deal/:dealId
Please note: legacy endpoints are stable and supported unless explicitly flagged for depreciation.
The GET /crm/v3/objects/deals/{dealId} endpoint does not return Associations.
Here’s a quick example using Postman:
I have Two Companies — Bob’s Burgers and Jimmy Pestos Pizza and one Deal — Bob and Jimmy
My Request
GET https://api.hubapi.com/deals/v1/deal/11145739059?includePropertyVersions=true
My Response
{
"portalId": 22245342,
"dealId": 11145739059,
"isDeleted": false,
"associations": {
"associatedVids": [],
"associatedCompanyIds": [
10202231595,
10202231613
],
"associatedDealIds": [],
"associatedTicketIds": []
}
Best,
Jaycee
Ok, thx. Will test it out now. I assumed using the latest version of the api is best but not sure why v3 has less info than v1. Having associations is a great feature and the only way I know to get the parent company from a deal.
I would also like to know how to do this in the v3 of the api. Seems a bit strange i need to go back to v1 to get associations …
I would also know how to do this with V3, it seems overly complex to retrieve the company associated with a deal