# Get manager account hierarchy

Fetches a manager account hierarchy. Works with Google Ads.

```http
GET https://api.pozy.ai/v1/ads/accounts/hierarchy
```

- Area: Ads / Ad Accounts
- Auth: Authorization: Bearer pz_live_...

## Query parameters

- `accountId` (string, required)
- `adAccountId` (string)
- `customerId` (string)

## Example request

```bash
curl -X GET "https://api.pozy.ai/v1/ads/accounts/hierarchy?accountId=696e0b682d0a31188e7a2ba9" \
  -H "Authorization: Bearer $POZY_API_KEY"
```

```ts
const res = await fetch("https://api.pozy.ai/v1/ads/accounts/hierarchy?accountId=696e0b682d0a31188e7a2ba9", {
  headers: { Authorization: `Bearer ${process.env.POZY_API_KEY}` },
});
const data = await res.json();
if (!res.ok) throw new Error(data?.error ?? `Request failed with status ${res.status}`);
console.log(data);
```

```python
import os
import requests

resp = requests.get(
    "https://api.pozy.ai/v1/ads/accounts/hierarchy",
    headers={"Authorization": f"Bearer {os.environ['POZY_API_KEY']}"},
    params={
        "accountId": "696e0b682d0a31188e7a2ba9",
    },
    timeout=30,
)
resp.raise_for_status()
print(resp.json())
```

## Response 200

- `accountId`, string
- `roots`, array of object
  - `customerId`, string
  - `name`, string: Can be null
  - `currency`, string: Can be null
  - `timeZone`, string: Can be null
  - `manager`, boolean
  - `testAccount`, boolean
  - `status`, string: Can be null
  - `managerLinks`, array of object
    - `managerCustomerId`, string
    - `managerLinkId`, string
    - `status`, string: One of `ACTIVE`, `PENDING`
  - `clients`, array of object
    - `customerId`, string
    - `name`, string: Can be null
    - `currency`, string: Can be null
    - `timeZone`, string: Can be null
    - `manager`, boolean
    - `testAccount`, boolean
    - `hidden`, boolean
    - `level`, integer
    - `status`, string: Can be null
    - `parentCustomerId`, string: Can be null
    - `managerLinkId`, string: Can be null
    - `linkStatus`, string: One of `ACTIVE`, `PENDING`. Can be null
- `directCustomers`, array of object
  - `customerId`, string
  - `manager`, boolean
  - `pendingInvitations`, array of object
    - `managerCustomerId`, string
    - `managerLinkId`, string
- `unavailable`, array of object
  - `customerId`, string
  - `reason`, string
- `truncated`, boolean
- `cachedAt`, string (date-time): Can be null
- `stale`, boolean

```json
{
  "accountId": "696e0b682d0a31188e7a2ba9",
  "roots": [
    {
      "customerId": "691909ff82eb5ed7c816716d",
      "name": "Acme",
      "currency": "USD",
      "timeZone": "America/New_York",
      "manager": true,
      "testAccount": true,
      "status": "active",
      "managerLinks": [
        {
          "managerCustomerId": "6d00a12c8c36af8967d368bc",
          "managerLinkId": "6083e4956af6ca4aa26c607c",
          "status": "ACTIVE"
        }
      ],
      "clients": [
        {
          "customerId": "691909ff82eb5ed7c816716d",
          "name": "Acme",
          "currency": "USD",
          "timeZone": "America/New_York",
          "manager": true,
          "testAccount": true,
          "hidden": true,
          "level": 1,
          "status": "active",
          "parentCustomerId": "65c55e40b26b6e2a3dd836d1",
          "managerLinkId": "6083e4956af6ca4aa26c607c",
          "linkStatus": "ACTIVE"
        }
      ]
    }
  ],
  "directCustomers": [
    {
      "customerId": "691909ff82eb5ed7c816716d",
      "manager": true,
      "pendingInvitations": [
        {
          "managerCustomerId": "6d00a12c8c36af8967d368bc",
          "managerLinkId": "6083e4956af6ca4aa26c607c"
        }
      ]
    }
  ],
  "unavailable": [
    {
      "customerId": "691909ff82eb5ed7c816716d",
      "reason": "string"
    }
  ],
  "truncated": true,
  "cachedAt": "2026-10-02T09:00:00.000Z",
  "stale": true
}
```
