Server to Server Management APIs
Account Hierarchies

Account Hierarchies

Get Company Subsidiaries

GET /companies/{companyId}/subsidiaries

Request

Returns all subsidiary accounts on lower hierarchy layers, based on the Company account specified.

Authentication

  • authToken in header

Parameters

  • companyId in path - integer
    required
    Unique numeric ID of the Company account.
  • offset in query0 - integer
    The number of results to skip before returning the first result. If left blank, this defaults to 0.
  • limit in query with default of 10 - integer
    Determines the number of records to return per page. If left blank, this defaults to 10.

example

curl --request GET \
--url 'https://api-b2b.bigcommerce.com/api/v3/io/companies/[companyId]/subsidiaries' \
--header 'Content-Type: application/json' \
--header 'authToken: {{token}}'

Response

OK

The subsidiaries array in the response includes nested subsidiaries arrays if a child account has its own subsidiaries.

The array also includes nested subsidiaries arrays for each Company with its own subsidiaries. For example, if the Company in question is above 2 layers of Account Hierarchy, its direct subsidiaries will also include subsidiaries arrays for their child accounts.

Body

object | application/json
  • data
    array[object]

  • meta
    object

Example 1

{
"data": [
{
"companyStatus": 1,
"companyId": 123,
"companyName": "Company"
},
{
"companyStatus": 1,
"companyId": 321,
"companyName": "Also Company"
}
],
"meta": {
"message": "SUCCESS",
"pagination": {
"totalCount": 10,
"limit": 10,
"offset": 0
}
}
}

Example 2

{
"data": [
{
"companyStatus": 1,
"companyId": 123,
"companyName": "Company",
"subsidiaries": [
{
"companyStatus": 3,
"companyId": 321,
"companyName": "Also Company"
}
]
}
],
"meta": {
"message": "SUCCESS",
"pagination": {
"totalCount": 10,
"limit": 10,
"offset": 0
}
}
}

Delete Company Subsidiary

DELETE /companies/{companyId}/subsidiaries/{childCompanyId}

Request

Removes the parent-child relationship between a specified subsidiary account and its parent Company.

If the deleted subsidiary has its own subsidiary companies, this request will create a separate hierarchy with the deleted subsidiary at the top.

Authentication

  • authToken in header

Parameters

  • companyId in path - integer
    required
    Unique numeric ID of the Company account.
  • childCompanyId in path - integer
    required
    The ID of a Company account assigned as a subsidiary to the Company in question.

example

curl --request DELETE \
--url 'https://api-b2b.bigcommerce.com/api/v3/io/companies/[companyId]/subsidiaries/[childCompanyId]' \
--header 'Content-Type: application/json' \
--header 'authToken: {{token}}'

Response

Success

Attach a Company as the Parent of a Current Company

POST /companies/{companyId}/parent

Request

Assigns the Company account as the parent of a specific Company. Note that you cannot assign a Company as the parent of another Company which is already in a higher hierarchy level.

For example, if you have a client with local, national, and regional branches, their Company Account Hierarchy might look like this:

- Americas
 |- North America
 | |- Canada
 | |- United States
 |- South America
 | |- Brazil

You cannot assign United States as a parent of North America, since the parent Company for United States is also a subsidiary of North America.

Authentication

  • authToken in header

Parameters

  • companyId in path - integer
    required
    Unique numeric ID of the Company account.

Body

object | application/json
  • parentCompanyId
    integer
    required

    Unique numeric ID of the parent Company account. This is a read-only field; do not set or modify its value in a POST or PUT request.
    Example: 654321

example

{
"parentCompanyId": 654321
}

Response

OK

Body

object | application/json
  • meta
    object

success

{
"data": [],
"meta": {
"message": "SUCCESS"
}
}

Get Company Hierarchy

GET /companies/{companyId}/hierarchy

Request

Returns all parent and child accounts in the hierarchy of a particular Company.

The default rate limit for this endpoint is 15 calls/min per store.

Authentication

  • authToken in header

Parameters

  • companyId in path - integer
    required
    Unique numeric ID of the Company account.
  • offset in query0 - integer
    The number of results to skip before returning the first result. If left blank, this defaults to 0.
  • limit in query with default of 10 - integer
    Determines the number of records to return per page. If left blank, this defaults to 10.

example

curl --request GET \
--url 'https://api-b2b.bigcommerce.com/api/v3/io/companies/[companyId]/hierarchy' \
--header 'Content-Type: application/json' \
--header 'authToken: {{token}}'

Response

OK

Body

object | application/json
  • data
    array[object]

  • meta
    object

Examples 1

{
"data": [
{
"companyId": 1,
"companyName": "Company A",
"companyStatus": 1,
"subsidiaries": [
{
"companyId": 2,
"companyName": "Company B",
"companyStatus": 1,
"subsidiaries": [
{
"companyId": 4,
"companyName": "Company D",
"companyStatus": 1,
"subsidiaries": [
{
"companyId": 5,
"companyName": "Company E",
"companyStatus": 1,
"subsidiaries": [
{
"companyId": 6,
Did you find what you were looking for?