OverviewProductsPlatformsAPI ReferenceResources
Accounts & Ops

Get manager account hierarchy

GEThttps://zernio.com/api/v1/ads/accounts/hierarchy

Shows the Google Ads manager (MCC) and client account tree for a connection, including pending invitations and link status.

PlatformsGoogle

Authentication

AuthorizationBearer tokenRequired

API key authentication: send your Zernio API key in the Authorization header, prefixed with Bearer.

Query parameters

accountIdstringRequired

Google ads SocialAccount id.

adAccountIdstring

Only return the tree rooted at this customer id (digits only). It must be an account the Google user accesses directly. Omit to list every tree.

customerIdDeprecatedstring

Alias of adAccountId, kept for consistency with the other Google Ads account endpoints.

Responses

Success· the request worked

Errors· the request failed

How it behaves

How the tree is built

It starts from every customer the Google user behind the connection can access directly and walks each tree to any depth with customer_client. It then reads each manager's own client links, so every client carries its direct parent, the managerLinkId and the link status.

  • Invitations a manager sent that the client has not accepted yet appear as clients with linkStatus: PENDING (Google returns no name or currency for them).
  • Refused, canceled and ended links are history and are omitted.
  • A directly accessible account that is also nested in another tree appears only once, inside that tree.

Response fields

  • managerLinks (on a root): the managers linked to that account, including invitations it can still accept with PATCH /v1/ads/accounts/manager-links.
  • directCustomers: every account the Google user accesses directly (the ones this connection can accept or decline invitations for) with their pending invitations, including accounts that are also nested in a tree.
  • unavailable: customers Google refuses to read (for example a cancelled account), with Google's reason, instead of failing the call.
  • truncated: true when more exist than the limit. Up to 50 roots and 50 managers per root are read.
  • cachedAt and stale: the response is cached for 10 minutes per connection.

When the connection is scoped to specific ad accounts, client accounts outside that scope are hidden (managers stay visible).

GET/v1/ads/accounts/hierarchy
import Zernio from '@zernio/node';const zernio = new Zernio({ apiKey: process.env.ZERNIO_API_KEY });const { data } = await zernio.adaccounts.getAdAccountHierarchy({  query: {    accountId: 'account_abc123',  },});console.log(data);
{  "accountId": "string",  "roots": [    {      "customerId": "string",      "name": "string",      "currency": "string",      "timeZone": "string",      "manager": true,      "testAccount": true,      "status": "string",      "managerLinks": [        {          "managerCustomerId": "string",          "managerLinkId": "string",          "status": "ACTIVE"        }      ],      "clients": [        {          "customerId": "string",          "name": "string",          "currency": "string",          "timeZone": "string",          "manager": true,          "testAccount": true,          "hidden": true,          "level": 0,          "status": "string",          "parentCustomerId": "string",          "managerLinkId": "string",          "linkStatus": "ACTIVE"        }      ]    }  ],  "directCustomers": [    {      "customerId": "string",      "manager": true,      "pendingInvitations": [        {          "managerCustomerId": "string",          "managerLinkId": "string"        }      ]    }  ],  "unavailable": [    {      "customerId": "string",      "reason": "string"    }  ],  "truncated": true,  "cachedAt": "2019-08-24T14:15:22Z",  "stale": true}
OpenAPI specification
Was this page helpful?