# GET /v1/usage

Your balance and usage, for scripts and monitoring. Calling it is free. Every other response also carries what it cost and what is left, in two headers.

Endpoint

```http
GET https://layahost.com/v1/usage?days=30
```

`days` is optional: 1 to 90, default 30. Usage covers the whole account, across all its keys.

GET /v1/usage

```bash
curl "https://layahost.com/v1/usage?days=7" \
  -H "Authorization: Bearer $LAYAHOST_API_KEY"
```

Response · 200

```json
{
  "balance": {
    "micros": 17396635,
    "usd": 17.396635,
    "decisions_left": 3479327
  },
  "price_per_decision_micros": 5,
  "period": { "from": "2026-09-19", "to": "2026-09-25", "days": 7 },
  "totals": {
    "requests": 1840,
    "decisions": 2905,
    "errors": 12,
    "cost_micros": 14525,
    "cost_usd": 0.014525
  },
  "daily": [
    { "date": "2026-09-19", "requests": 0, "decisions": 0, "cost_micros": 0 },
    { "date": "2026-09-20", "requests": 310, "decisions": 520, "cost_micros": 2600 }
  ]
}
```

| Field | Description |
| --- | --- |
| `balance.micros` | Prepaid credit left, in millionths of a US dollar. |
| `balance.decisions_left` | How many decisions that buys at the current price. |
| `totals` | Requests, billed decisions, failed requests and cost over the period. |
| `daily` | One row per day, oldest first, including days with no usage. Dates are UTC. |

## Cost and balance headers

Every authenticated response, including batches and errors, has:

| Header | Description |
| --- | --- |
| `x-layahost-cost-micros` | What this request was billed, in micro-USD. `0` for free and failed requests. |
| `x-layahost-balance-micros` | Your balance after this request. |

To be warned before credit runs out, set a low-balance alert on the [Billing](https://layahost.com/billing) page; you get one email when the balance falls under it.
