APIs & Integrations

jkirby
Member

Is there any way to create a parent-child relationship for companies using the API?

SOLVE

Hi HubSpot API-ers,

 

I am getting up to speed on the Companies API and see how to create companies as well as populating custom properties.

 

I stumbled on a possible gotcha and wanted to confirm - is it truly impossible to set hs_parent_company_id? Grabbing a list of properties using the properties API, I see it's listed readOnlyValue = true. Just hoping there might be another way of approaching this issue - if you have 100,000 companies in your on-prem database and many of them have children, it seems like a gap you can't set that programmatically and represent that in HubSpot.

Any ideas / feedback is appreciated!

 

Thanks

JK

0 Upvotes
1 Accepted solution
WendyGoh
Solution
HubSpot Employee
HubSpot Employee

Is there any way to create a parent-child relationship for companies using the API?

SOLVE

Hey @jkirby,

 

When looking to create association between Parent company to child company, this is definitely possible by using Associate CRM objects and you can learn more about the definitionId here - CRM associations overview

 

For example, if you're looking to add company ID 456 as the child company of company ID 123, you can do so by using the following PUT body:

{
  "fromObjectId": 123,
  "toObjectId": 456,
  "category": "HUBSPOT_DEFINED",
  "definitionId": 13
}

where company 123 is the parent company of company 456.

 

Hope this helps to shed some lights and do let me know if there's any questions that you'd like me to further clarify on!

View solution in original post

0 Upvotes
2 Replies 2
WendyGoh
Solution
HubSpot Employee
HubSpot Employee

Is there any way to create a parent-child relationship for companies using the API?

SOLVE

Hey @jkirby,

 

When looking to create association between Parent company to child company, this is definitely possible by using Associate CRM objects and you can learn more about the definitionId here - CRM associations overview

 

For example, if you're looking to add company ID 456 as the child company of company ID 123, you can do so by using the following PUT body:

{
  "fromObjectId": 123,
  "toObjectId": 456,
  "category": "HUBSPOT_DEFINED",
  "definitionId": 13
}

where company 123 is the parent company of company 456.

 

Hope this helps to shed some lights and do let me know if there's any questions that you'd like me to further clarify on!

0 Upvotes
jkirby
Member

Is there any way to create a parent-child relationship for companies using the API?

SOLVE

Thanks Wendy - this is a huge help and a relief that this is possible.

 

Much appreciated!

 

JK

0 Upvotes