# Get WABA Usage Analytics

Canonical: https://docs.bluehola.com/docs/assets-phone-numbers/get-v1-wabas-id-analytics
OpenAPI: https://docs.bluehola.com/openapi.yaml

<div class="endpoint"><span class="endpoint-method endpoint-method--get">GET</span><code class="endpoint-path">/v1/wabas/{id}/analytics</code></div>

Query this WABA's usage/cost analytics directly from Meta, as a cross-check against the local ledger usage view. The messaging and pricing fields are requested and reported independently: the response is { messaging: {ok, data|error}, pricing: {ok, data|error} }, so if one is rejected by Meta the other still returns data, with Meta's raw code/subcode in the error. Note that pricing's COST is not returned for WABAs sharing a Solution Partner credit line.

:::note[Authentication]

Send `Authorization: Bearer <API_KEY>` in the request headers, with the required scope `billing:read`. Which resources an API Key can reach is determined by its current authorization scope.

:::

## Request

Base URL: `https://api.bluehola.com`

### Parameters

| Name | In | Required | Type / constraints | Description |
| --- | --- | --- | --- | --- |
| `id` | path | Yes | string | The platform WABA ID, `waba_...` |
| `start` | query | Yes | unix timestamp | Start of the reporting period (seconds). **Required**; returns `400 VALIDATION_FAILED` if it cannot be parsed as a number |
| `end` | query | Yes | unix timestamp | End of the reporting period (seconds). **Required**; returns `400 VALIDATION_FAILED` if it cannot be parsed as a number |
| `granularity` | query | No | `HALF_HOUR` \| `DAY` \| `MONTH` | Defaults to `DAY`; other values do not error, they are always treated as `DAY` |
| `phoneNumbers` | query | No | string | A comma-separated list of **Meta phone number ids** (digits only, 1–32 characters per segment), to filter by number. Returns `400 VALIDATION_FAILED` if it contains any non-digit characters |

## Response

| Status | Description |
| --- | --- |
| `200` | OK |
| `4xx` | Client error |

For the common error envelope and how to handle it, see [Error Codes](../guides/error-codes.md).

## Notes

#### Parameter validation

- `start`/`end`: must parse to a finite unix timestamp; parsing failure is a straight 400.
- `granularity`: only `HALF_HOUR` and `MONTH` are strictly accepted as non-default values — any other value (including omitting it) **silently falls back to `DAY`**. The endpoint will not correct a typo for you; you need to confirm the value yourself.
- `phoneNumbers`: strictly validated as digits only (each number id up to 32 characters). These values are interpolated directly into the field-filter expression sent to the Meta Graph API (of the form `.phone_numbers(id1,id2)`); unsanitised input could in principle use `)` or `.` to break out of the filter and rewrite the whole expression — this validation is not an optional robustness check, it is an injection gate.

#### Meta authorization state

The service automatically selects whichever saved, usable Meta authorization it has. If that Business Portfolio has not completed Meta authorization, or its authorization has expired, this returns **409 rather than 404** — the problem is not "this WABA doesn't exist", it is that the platform currently cannot query Meta on the customer's behalf.
