# Get billing usage for a month

> Source: https://truto.one/docs/api-reference/admin/billing/usage/

`GET /billing/usage`

Resource: **Billing**

## Query parameters

- **`team_id`** _(string, required)_
- **`period_start`** _(string)_
  First day of the month to report, as `YYYY-MM-01`.

## Response body

- **`period`** _(object)_
  - **`start`** _(string)_
  - **`end`** _(string)_
  - **`label`** _(string)_
- **`source`** _(string)_
  Allowed: `snapshot`, `live`
- **`counts`** _(object)_
  Measured counts for the period. A metric is `null` when it could not be measured for this period (API calls past VictoriaLogs retention) — never a zero that was not observed. This can happen on an invoiced month too, not only a skipped one; only the affected metric is null, not the whole response.
  - **`connector`** _(integer)_
  - **`active_connection`** _(integer)_
  - **`api_call`** _(integer)_
  - **`superquery_account`** _(integer)_
- **`lines`** _(array<object>)_
  The priced breakdown. Empty for a skip whose pricing itself is unreliable (a component past VictoriaLogs retention); populated for other skips (exempt, no Stripe customer, nothing to bill) so what the month *would* have cost is still visible, and always populated for an invoiced month.
  - **`key`** _(string)_
  - **`kind`** _(string)_
    Allowed: `base_fee`, `usage`, `fixed`
  - **`description`** _(string)_
  - **`quantity`** _(integer)_
    Units charged; for usage lines the number of blocks of `unit_size`.
  - **`unit_price_cents`** _(number)_
    Price per charged unit (per block for usage lines).
  - **`unit_size`** _(integer)_
    Usage lines only — units per block.
  - **`overage_quantity`** _(integer)_
    Usage lines only — measured minus included, before block rounding.
  - **`gross_amount_cents`** _(integer)_
    Amount before discount.
  - **`discount_percent`** _(number)_
  - **`discount_cents`** _(integer)_
  - **`amount_cents`** _(integer)_
    Net amount charged.
  - **`period_start`** _(string)_
  - **`period_end`** _(string)_
    Exclusive end (first day of the next period).
  - **`metric`** _(string)_
    Allowed: `connector`, `active_connection`, `api_call`, `superquery_account`
  - **`measured_quantity`** _(integer)_
  - **`included_quantity`** _(integer)_
- **`total_cents`** _(integer)_
  Net amount priced for the period. `null` only when the month's snapshot was *skipped* because a metric it needed could not be measured — never a zero that was not billed. An unmeasurable metric on an *invoiced* month does not null this out; it prices normally from what was measurable. On a skip whose priced metrics were all measurable, this is a real `0` (nothing was billed) even though `lines` above is still populated with what the period *would* have cost — the two intentionally disagree there, since one states what happened and the other what would have.

## Code examples

### curl

```bash
curl -X GET 'https://api.truto.one/billing/usage' \
  -H 'Authorization: Bearer <your_api_token>' \
  -H 'Content-Type: application/json'
```

### JavaScript

```javascript
const response = await fetch('https://api.truto.one/billing/usage', {
  method: 'GET',
  headers: {
    'Authorization': 'Bearer <your_api_token>',
    'Content-Type': 'application/json',
  },
});

const data = await response.json();
console.log(data);
```

### Python

```python
import requests

url = "https://api.truto.one/billing/usage"
headers = {
    "Authorization": "Bearer <your_api_token>",
    "Content-Type": "application/json",
}
params = {
}

response = requests.get(url, headers=headers, params=params)
print(response.json())
```
