# Read the usage

> The hours and the cost of each VM of the tenant, and the totals.

`GET /v1/tenants/{tenant}/usage`

```bash curl
curl -X GET "https://api.shako.dev/v1/tenants/acme/usage?since=1793491200" \
  -H "Authorization: Bearer $SHAKO_API_KEY"
```

```python Python
import os

import requests

response = requests.get(
    "https://api.shako.dev/v1/tenants/acme/usage?since=1793491200",
    headers={"Authorization": f"Bearer {os.environ['SHAKO_API_KEY']}"},
)
response.raise_for_status()
print(response.json())
```

```javascript JavaScript
const response = await fetch("https://api.shako.dev/v1/tenants/acme/usage?since=1793491200", {
  method: "GET",
  headers: { Authorization: `Bearer ${process.env.SHAKO_API_KEY}` },
});
if (!response.ok) throw new Error(await response.text());
console.log(await response.json());
```

```json 200 (excerpt)
{
  "total_awake_hours": 12.5,
  "total_cost": 0.12
}
```

Authenticate with `Authorization: Bearer <API key>` on `https://api.shako.dev`. Role: contributor or owner.

## Path parameters

**tenant** `string` *required*

The tenant's name, from GET /v1/tenants.

## Query parameters

**since** `integer, 0 to 4294967296` (default: all the usage)

The start of the usage, as a Unix time in seconds.

**days** `boolean` (default: false)

true: also the usage of each VM on each day.

**utc_offset** `integer, -840 to 840` (default: 0)

The clock of the days and the months, in minutes east of UTC, for example 60 for UTC+1.

## Response

200 with [the usage object](https://shako.dev/api/objects/usage.md).

## Behavior

A deleted VM stays in the usage, with the state deleted.

The errors: https://shako.dev/api/errors.md. All the endpoints of Billing: https://shako.dev/api/billing.md.
