# Get usage

Adds up the audio your workspace transcribed, by day or by month and by key.

`GET /v1/usage` on `https://api.eu.vatis.tech`

## Headers

| header | values | default | meaning |
|---|---|---|---|
| `Authorization` | `Bearer <api key>` | required | Your API key ([Authentication and API keys](https://platform.vatis.tech/docs/authentication)). An Admin key gets the whole workspace, a Member key its own work. |

## Query parameters

| parameter | values | default | meaning |
|---|---|---|---|
| `from` | a UTC day, `YYYY-MM-DD` | the first day of this month | The first day, included. |
| `to` | a UTC day, `YYYY-MM-DD` | today | The last day, included. |
| `group` | `day`, `month` | `day` | One period per day, or per month. |

## Response fields

| field | when | meaning |
|---|---|---|
| `from` |  | The range and grouping as applied, with `to` and `group`. |
| `scope` |  | `all`: the whole workspace, every key listed (an Admin key). `key`: a Member key's own work. |
| `totals` |  | `batch`, `realtime` and `peak_realtime_sessions` over the range. |
| `periods` |  | Only the days (or months) with usage, oldest first. `period` is `YYYY-MM-DD`, or `YYYY-MM` by month. |
| `keys` |  | Each key's totals over the range, by `key_id` and `name`, revoked keys too. |
| `count` |  | Batch jobs, or live sessions, that ended in the range. |
| `failed` |  | Of those, the ones that failed. Their audio is not in `audio_s`. |
| `audio_s` |  | Seconds of audio of the ones that did not fail, rounded to 0.1 s. |
| `speakers_audio_s` |  | The part of `audio_s` sent with `diarize=true`. |
| `peak_realtime_sessions` |  | The most live sessions open at once in the workspace that day or month, a two-channel session counting 2. `null` for a Member key: the peak is the whole workspace's. |

## Responses

`200`: The usage.

```json
{
  "from": "2026-11-01",
  "to": "2026-11-30",
  "group": "day",
  "scope": "all",
  "totals": {
    "batch": {
      "count": 3,
      "failed": 0,
      "audio_s": 512.3,
      "speakers_audio_s": 120
    },
    "realtime": {
      "count": 12,
      "failed": 1,
      "audio_s": 3605.1,
      "speakers_audio_s": 0
    },
    "peak_realtime_sessions": 3
  },
  "periods": [
    {
      "period": "2026-11-12",
      "batch": {
        "count": 3,
        "failed": 0,
        "audio_s": 512.3,
        "speakers_audio_s": 120
      },
      "realtime": {
        "count": 12,
        "failed": 1,
        "audio_s": 3605.1,
        "speakers_audio_s": 0
      },
      "peak_realtime_sessions": 3
    }
  ],
  "keys": [
    {
      "key_id": "key_3f9c1a2b7d4e",
      "name": "crm-backend",
      "batch": {
        "count": 3,
        "failed": 0,
        "audio_s": 512.3,
        "speakers_audio_s": 120
      },
      "realtime": {
        "count": 12,
        "failed": 1,
        "audio_s": 3605.1,
        "speakers_audio_s": 0
      }
    }
  ]
}
```

`400` `invalid_parameter`: A date that is not `YYYY-MM-DD`, `from` after `to`, a range too long, another `group`, or another query parameter. The `param` names it.

```json
{
  "error": {
    "code": "invalid_parameter",
    "message": "'from' must not be after 'to'.",
    "param": "from",
    "request_id": "req_bf2fed760ba5437ba0933a57"
  }
}
```

`401` `unauthorized`: No key, or a wrong, revoked or expired one.

```json
{
  "error": {
    "code": "unauthorized",
    "message": "Invalid, revoked or expired key.",
    "param": null,
    "request_id": "req_bf2fed760ba5437ba0933a57"
  }
}
```

`503` `unavailable`: The service is busy for a moment. Send the request again after the seconds of the `Retry-After` header.

## Notes

- **The range** is at most 366 days by day and 3660 days by month.
- What counts, and when: [What counts](https://platform.vatis.tech/docs/usage#what-counts). The audio counted here is what your workspace's credit pays for, by the second.
