# Get YouTube channel insights

Fetches YouTube channel insights.

```http
GET https://api.pozy.ai/v1/analytics/youtube/channel-insights
```

- Area: Analytics / Analytics
- Auth: Authorization: Bearer pz_live_...

## Query parameters

- `accountId` (string, required)
- `metrics` (string)
- `fromDate` (string (date))
- `toDate` (string (date))
- `since` (string (date))
- `until` (string (date))
- `metricType` (string): one of time_series, total_value

## Example request

```bash
curl -X GET "https://api.pozy.ai/v1/analytics/youtube/channel-insights?accountId=696e0b682d0a31188e7a2ba9" \
  -H "Authorization: Bearer $POZY_API_KEY"
```

```ts
const res = await fetch("https://api.pozy.ai/v1/analytics/youtube/channel-insights?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/analytics/youtube/channel-insights",
    headers={"Authorization": f"Bearer {os.environ['POZY_API_KEY']}"},
    params={
        "accountId": "696e0b682d0a31188e7a2ba9",
    },
    timeout=30,
)
resp.raise_for_status()
print(resp.json())
```

## Response 200

- `success`, boolean
- `accountId`, string
- `platform`, string: One of `facebook`, `instagram`, `youtube`, `linkedin`, `tiktok`
- `dateRange`, object
  - `since`, string (date)
  - `until`, string (date)
- `metricType`, string: One of `time_series`, `total_value`
- `breakdown`, string
- `metrics`, map of object: Keys are free-form; each value has these fields
  - `total`, number
  - `values`, array of object
    - `date`, string (date)
    - `value`, number
  - `breakdowns`, array of object
    - `dimension`, string
    - `value`, number
  - `unit`, string: One of `micro_amount`, `unspecified`
  - `currency`, string: Can be null
- `unavailableMetrics`, array of object
  - `metric`, string
  - `reason`, string: One of `not_enrolled`, `permission_missing`, `unsupported_metric`, `no_data`, `unreadable_value`, `mixed_currency`, `upstream_error`
  - `message`, string
- `dataDelay`, string

```json
{
  "success": true,
  "accountId": "696e0b682d0a31188e7a2ba9",
  "platform": "facebook",
  "dateRange": {
    "since": "2026-10-01",
    "until": "2026-10-01"
  },
  "metricType": "time_series",
  "breakdown": "string",
  "metrics": {
    "key": {
      "total": 12.5,
      "values": [
        {
          "date": "2026-10-02T09:00:00.000Z",
          "value": 12.5
        }
      ],
      "breakdowns": [
        {
          "dimension": "string",
          "value": 12.5
        }
      ],
      "unit": "micro_amount",
      "currency": "USD"
    }
  },
  "unavailableMetrics": [
    {
      "metric": "string",
      "reason": "not_enrolled",
      "message": "Hello from Pozy"
    }
  ],
  "dataDelay": "string"
}
```
