I am using company api as
https://api.hubapi.com/crm/v3/properties/companies
This gives me basic info of the comapnies. How do i get the primary contact associated with the company? I looked into properties= option but didn’t find any property that indicates the contact details associated the company.
Hi Vikram,
Try reading through the endpoint documentation here: Accounts Dashboard | HubSpot
“List associations of a company by type” will get you the records associated with that company.
GET /crm/v3/objects/companies/{companyId}/associations/{toObjectType}
“Associate a company with another object” will allow you to make the association to a contact.
PUT /crm/v3/objects/companies/{companyId}/associations/{toObjectType}/{toObjectId}/{associationType}
so even the fundamental info about a company like primary contact needs association calls?
Further, trying out like: https://api.hubapi.com/crm/v3/objects/companies/2220312904/associations/contacts
gives me result:
{
“results”: [
{
“id”: “101”,
“type”: “company_to_contact”
},
{
“id”: “401”,
“type”: “company_to_contact”
},
{
“id”: “3152”,
“type”: “company_to_contact”
}
]
}
Now, it seems i need to make one more call to get contact. So, 2 additional calls just to get contact. Further, 3 are returned and i don’t know which one is main. Do i need to make call to each of these to find the info?
Did you resolve the best way to get the primary contact for a company? I’m following down this same path now and it would be great if the company object had a “primary contact id” at least.
If we’re both talking about a Company to Contact Record within HubSpot then yes.
However, you could also create your own custom company properties that include the primary contact’s information i.e. firstname, email, phone, etc.
After you create those, you fill them out over the API, a workflow, or the UI when you create the company record. There are several ways to accomplish what you’re looking for.
but none is out of the box. Correct?
And in case i go with out of the box then what i described in terms of number of calls required is correct as well?
As far as I know there is no “eager loading” of the contact from a company record. Maybe something exists but I doubt it.
Via the HubSpot API, you could make an API request to the company to get the contact ID, then another to get the contact details.
Hope that helps.
Exactly my same question!