# Message Usage & Prices

Canonical: https://docs.bluehola.com/docs/billing-status/get-v1-usage-messages
OpenAPI: https://docs.bluehola.com/openapi.yaml

<div class="endpoint"><span class="endpoint-method endpoint-method--get">GET</span><code class="endpoint-path">/v1/usage/messages</code></div>

Returns your own message volume over a recent window, grouped by message type, billing category, destination country and unit price. This is the customer-side finance view: it answers "how many messages went where, and what did each one cost".

:::note[Authentication]

Send `Authorization: Bearer <API_KEY>` in the request headers, with scope `messages:read`. This endpoint requires a **customer-level** API Key: the customer entity in scope comes from the Key, never from a request field. BU and platform-level API Keys receive `403`.

:::

## Request

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

### Query parameters

| Parameter | Type | Required | Description |
| --- | --- | --- | --- |
| `days` | `7` \| `30` \| `90` | No | Window length; defaults to `30`. Any other value returns `400`. |

```bash
curl "https://api.bluehola.com/v1/usage/messages?days=30" \
  -H "Authorization: Bearer <API_KEY>"
```

## Response

| Status | Description |
| --- | --- |
| `200` | OK |
| `403` | The Key is not a customer-level Key, or it has no customer entity binding |
| `4xx` | Client error |

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

```json title="200 OK (example)"
{
  "generatedAt": "2026-11-23T03:00:00.000Z",
  "windowDays": 30,
  "rows": [
    {
      "type": "template",
      "category": "MARKETING",
      "country": "Brazil",
      "market": "Brazil",
      "currency": "USD",
      "unitPrice": "0.0625",
      "unitPriceMicros": 62500,
      "messageCount": 1200
    },
    {
      "type": "template",
      "category": "UTILITY",
      "country": "India",
      "market": "India",
      "currency": "USD",
      "unitPrice": "0.0014",
      "unitPriceMicros": 1400,
      "messageCount": 8400
    }
  ]
}
```

| Field | Type | Meaning |
| --- | --- | --- |
| `generatedAt` | string (`date-time`) | When the summary was generated. |
| `windowDays` | integer: `7`, `30` or `90` | The window actually used. |
| `rows` | array | One row per message type, billing category, destination country and unit price. |
| `rows[].type` | string | Message type: `text`, `template`, `image`, and so on. |
| `rows[].category` | string or `null` | Billing category (`MARKETING`, `UTILITY`, `AUTHENTICATION`, …). `null` for non-template messages. |
| `rows[].country` | string or `null` | Destination country resolved from the recipient number. `null` when it cannot be resolved. |
| `rows[].market` | string or `null` | The Meta billing market used for pricing. Some markets are regions, such as `Rest of Western Europe`, so this may differ from `country`. |
| `rows[].currency` | string | Pricing currency, for example `USD`. |
| `rows[].unitPrice` | string or `null` | The unit price charged for this message, as a decimal string. `"0"` for messages that were free. |
| `rows[].unitPriceMicros` | integer or `null` | The same price in micros (1 unit = 1,000,000 micros). |
| `rows[].messageCount` | integer | Number of messages in this group during the window. |

## Notes

#### What is counted

Only messages that have a pricing record are counted. A free message has no charge on the ledger, so counting from the ledger would silently drop entire categories of traffic; this view therefore counts priced messages, including those priced at `0`.

#### Why the same country and type can appear more than once

Volume-tier pricing can charge a different unit price for messages in the same country and category. Rows are grouped by the **actual unit price charged**, so merging them would produce an average that no message was actually billed at. Sum `messageCount` across rows if you only need the total volume.

#### Ownership

The customer entity is taken from the API Key. A customer Key sees only its own customer entity's messages, and a BU-level view is intentionally not available here — use the console for BU-wide reporting.
