List sub-accounts

Overview

Get the accounts nested under this one, if the account has a hierarchy.

Use this to build an account switcher for a multi-brand customer.

You'll need a token.

Returns the child accounts: one level down only. Sending search or limit returns a short slice ordered by name (for autocomplete); sending neither returns the full list.

Prerequisites

Base URL

EnvironmentURL
Productionhttps://production-api.shoutaboutus.com
Developmenthttps://development-api.shoutaboutus.com

Endpoint

GET /api/v1/account/child-accounts

Authentication

Partner or Account token

  • The list is always the children of the company behind the token: for a Partner token its accounts (and sub-partners), for an Account token its locations.
  • Only direct children are returned, not the whole tree.
  • A user limited to some accounts sees only those.

Rate limit

This endpoint has no rate limit.

Request parameters

ParameterInTypeRequiredDescription
searchquerystringNoUp to 255 characters. Matches children whose name or client_account_id contains the text. Turns on the short, name-ordered slice.
limitqueryintegerNoHow many to return in the short slice, 10 to 50. Values below 10 are raised to 10; above 50 returns 422. Default 10. Turns on the short slice.

Request body

None.

Request payload

None.

Response body

data is an array of child companies.

FieldTypeDescription
data[]array of objectsThe child companies. [] when there are none or none match.
data[].valueintegerThe child company's id.
data[].labelstringThe child's name, followed by - and its client_account_id when one is set. A partner row is labelled with (Partner) instead.

Response payload

{
  "data": [
    {
      "value": 5995,
      "label": "Acme Coffee"
    },
    {
      "value": 5996,
      "label": "Acme Coffee - Circular Quay"
    }
  ]
}

Examples

Success payload

Every child of the account behind an Account token: see Response payload.

No child matches search:

{
  "data": []
}

Error payload

404 Company not found

{
  "message": "Not Found",
  "status": "error",
  "errors": "Company not found."
}

422 limit above 50

{
  "message": "The limit field must not be greater than 50.",
  "errors": {
    "limit": [
      "The limit field must not be greater than 50."
    ]
  }
}
StatusMeaning
200The child companies.
401The token is missing, expired or invalid.
404The user behind the token has no company.
422search is longer than 255 characters, or limit is above 50.
500Unexpected server error.

Example request

curl --request GET \
  --url "https://production-api.shoutaboutus.com/api/v1/account/child-accounts" \
  --header 'Authorization: Bearer <bearer-token>' \
  --header 'Accept: application/json'

Did this page help you?