> ## Documentation Index
> Fetch the complete documentation index at: https://docs.routa.chat/llms.txt
> Use this file to discover all available pages before exploring further.

# Usage

> Query the metered usage of your project by metric, channel and period with GET /v1/usage.

Routa meters every billable and informational fact of your project in an immutable ledger. `GET /v1/usage` returns that usage **aggregated** over a period, so you can build reports, consumption alerts and cost checks.

> [!NOTE]
>
> Required scope: `usage:read`.

## Query usage

Give the period with `from` (inclusive) and `to` (exclusive), as UTC dates in `YYYY-MM-DD` format.

```bash cURL theme={null}
curl "https://api.routa.chat/v1/usage?from=2026-09-01&to=2026-10-01" \
  -H "Authorization: Bearer $ROUTA_API_KEY"
```

```ts Node.js theme={null}
const usage = await routa.usage.retrieve({
  from: '2026-09-01',
  to: '2026-10-01',
})

for (const row of usage.data) {
  console.log(row.metric, row.quantity, row.unit)
}
```

```json Response theme={null}
{
  "from_date": "2026-09-01",
  "to_date": "2026-10-01",
  "data": [
    {
      "metric": "message.sent",
      "channel_type": "whatsapp",
      "provider": "whatsapp_cloud",
      "quantity": 1840,
      "unit": "message"
    },
    {
      "metric": "message.received",
      "channel_type": "whatsapp",
      "provider": "whatsapp_cloud",
      "quantity": 412,
      "unit": "message"
    }
  ]
}
```

The response has **one row per combination** of `metric`, `channel_type` and `provider` over the whole period. The current day, still open, is read live and added in. There is no pagination: the size of the response is bounded by the number of metrics and channels, not by the volume sent.

> [!WARNING]
>
> The period can span **92 days** at most. A longer, reversed or badly formatted range returns `422 usage_range_invalid`.

## Metrics

| Metric | Unit | Measured when |
| - | - | - |
| `message.sent` | `message` | The provider accepts a message you sent. |
| `message.delivered` | `message` | Delivery is confirmed. |
| `message.received` | `message` | An inbound message is normalized. |
| `message.failed` | `message` | A message fails for good. |
| `conversation.opened` | `conversation` | The provider reports a new billable conversation. |
| `media.stored` | `byte-day` | Media storage (daily sweep). |
| `media.transferred` | `byte` | Media upload and download. |
| `webhook.delivered` | `delivery` | A webhook delivery succeeds. |
| `api.request` | `request` | API requests. |

The list of metrics is closed: new metrics can be added, but existing ones are never renamed.

> [!NOTE]
>
> Messages the business sends from the WhatsApp Business app, on a channel in coexistence mode, **do not count** as usage: neither their send metrics nor their delivery or failure metrics. The same applies to the history imported when the channel is connected. See [Messages sent from the WhatsApp Business app](https://docs.routa.chat/en/concepts/messages.md#messages-sent-from-the-whatsapp-business-app).

## How usage is recorded

* Billable usage is written **in the same transaction** as the state change that caused it. That is why it does not drift from what actually happened.
* Reprocessing an event does not count twice: each fact is recorded only once per metric.
* The dashboard shows the same usage, per project.

> [!NOTE]
>
> Usage is different from the **plan allowance**: the first measures what happened; the second decides whether you can send right now. See [Plans and allowance](https://docs.routa.chat/en/billing/plans-and-quota.md).


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.