APIs & Integrations

jsmallwood
Member

Parent Child relationships for Companies in the API

Is it possible to access the set of related companies via the API? I’m specifically looking to access the information described here: https://www.hubspot.com/product-updates/introducing-parent-child-relationships-in-hubspot-crm

I’ve tried looking at the documentation and it is not obvious.

0 Upvotes
22 Replies 22
Derek_Gervais
HubSpot Alumni
HubSpot Alumni

Parent Child relationships for Companies in the API

Hi all,

After a quick search, it appears that there was no existing topic in the HubSpot Ideas Forum. In general, the Ideas Forum is the best place to rally support and get your product feedback seen by HubSpotters. I went ahead and created a topic for this idea; I would encourage everyone to give it kudos and post your use case to support this idea!

0 Upvotes
bsjut
Contributor | Platinum Partner
Contributor | Platinum Partner

Parent Child relationships for Companies in the API

added my +1 on the idea. I think for us it would be most important to use it to allow in external systems some rollup reporting

SteveR
Member

Parent Child relationships for Companies in the API

+1 we need this functionality also for new enterprise deployment.

0 Upvotes
Not applicable

Parent Child relationships for Companies in the API

@Derek_Gervais Is there an update on documentation for this?

0 Upvotes
FloifyEric
Member

Parent Child relationships for Companies in the API

Over a year since this feature released and still no documented API endpoints???

0 Upvotes
im-bart
Member

Parent Child relationships for Companies in the API

This is something my business needs as well, would be highly appreciated if this can be added as documented endpoints as soon as possible.

0 Upvotes
jcjones1515
Member

Parent Child relationships for Companies in the API

Would like to add my vote to having this available in the API. I still don’t see this in the API docs. @Derek_Gervais can you provide an update before I go with the undocumented endpoint?

Thanks,

Jason

0 Upvotes
Derek_Gervais
HubSpot Alumni
HubSpot Alumni

Parent Child relationships for Companies in the API

Hi all,

I wanted to provide some more context on this topic: Any endpoints that aren’t listed on https://developers.hubspot.com/ are considered internal endpoints and are subject to be changed or removed at any point without notice. The specific endpoints mentioned here were not intended to be used outside of the HubSpot app, and it’s not something we currently have a public endpoint for.

0 Upvotes
Derek_Gervais
HubSpot Alumni
HubSpot Alumni

Parent Child relationships for Companies in the API

Hi @jsmallwood,

Can you click the ‘Submit feedback’ button on the relevant developer document? I’d be more than happy to take a look at revising/updating the documentation.

0 Upvotes
jsmallwood
Member

Parent Child relationships for Companies in the API

I provided feed back on the Company Overview page.

Not applicable

Parent Child relationships for Companies in the API

Hi jsmallwood!!

You can get the ids of the children like this:

GET https://api.hubapi.com/companies/v2/families/{parent_company_id}/children/with-total?hapikey=xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx

For example:

GET https://api.hubapi.com/companies/v2/families/263964841/children/with-total?hapikey=xxxxxxxx-xxxx-xxx...

{
“results”: [
** 512031457,**
** 512033679,**
** 512097152**
** ],**
“hasMore”: false,
“offset”: 512097152,
“total”: 3,
“exceededTotalLimit”: false
}

And you can get the id of the parent company including the property ‘hs_parent_company_id’ at the request of the companies:

For example:

GET https://api.hubapi.com/companies/v2/companies/paged?properties=hs_parent_company_id&limit=10&hapikey=xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx

.................
.................
.................
},
{
  "portalId": xxxxxxx,
  "companyId": 246966882,
  "isDeleted": false,
  "properties": {
    **"hs_parent_company_id": {**

** “value”: “454819377”**,
“timestamp”: 1495099113145,
“source”: “COMPANY_FAMILIES”,
“sourceId”: “CompanyFamilyManager”,
“versions”: [
{
“name”: “hs_parent_company_id”,
“value”: “454819377”,
“timestamp”: 1495099113145,
“sourceId”: “CompanyFamilyManager”,
“source”: “COMPANY_FAMILIES”,
“sourceVid”: [

          ]
        }
      ]
    }
  },
  "additionalDomains": [
    
  ],
  "stateChanges": [
    
  ],
  "mergeAudits": [
    
  ]
},
{
.................
.................
.................

regards

0 Upvotes
jsmallwood
Member

Parent Child relationships for Companies in the API

Any idea when the documentation will be updated? I’m concerned someone has found functionality in the API that may not be fully baked.

0 Upvotes
Not applicable

Parent Child relationships for Companies in the API

Hi, I was able to add a relationship between companies with a PUT to this URL:

https://api.hubspot.com/companies/v2/families/{parent_id}/associations?childCompanyId={child_id}&por...

Maybe you could use a GET request to a similar URL to get the associations info.

Raúl

chris_p_lukes
Contributor | Elite Partner
Contributor | Elite Partner

Parent Child relationships for Companies in the API

Did you need to include anything in the Body/Headers of the PUT request? It seems like all needed info (Portal ID & IDs of the two companies) is already included in the url, but I’m having trouble getting this to work.

I was able to get a response to puntouan’s GET request (below) simply by entering it in the address bar of my browser

0 Upvotes
Not applicable

Parent Child relationships for Companies in the API

All the info is in the URL, but you have to use your API key or OAuth token to make the PUT request.

And as @Derek_Gervais wrote, have in mind that your code can’t rely on this kind of undocumented calls, it’s just meant for getting or inserting data programmatically at a certain moment (e.g. migrating data from another CRM system).

Hope they add it to the official API someday!

0 Upvotes
maxbailey
Participant

Parent Child relationships for Companies in the API

Amazing - works! thanks for sharing the endpoint @raulmj83

0 Upvotes
3PETE
HubSpot Employee
HubSpot Employee

Parent Child relationships for Companies in the API

@jsmallwood We are currently working on release of an API that will cover all of this. As this is a new feature that came out this quarter we are still working on some of the surrounding support to the new relationship.

0 Upvotes
sonnyjordan
Participant

Parent Child relationships for Companies in the API

hi @pmanca, any update on this feature?

maxbailey
Participant

Parent Child relationships for Companies in the API

@pmanca Is there any estimated release date at this point?

0 Upvotes
3PETE
HubSpot Employee
HubSpot Employee

Parent Child relationships for Companies in the API

@Max_Bailey I don’t have a time-table yet on when these endpoints will be made public and supported through our Open APIs

0 Upvotes