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

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

Example 2

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

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

Response

OK

Body

object | application/json
  • meta
    object

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

Response

OK

Body

object | application/json
  • data
    array[object]

  • meta
    object

Examples 1

Did you find what you were looking for?