layahost
Menu · GET /v1/usage

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
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
curl "https://layahost.com/v1/usage?days=7" \
  -H "Authorization: Bearer $LAYAHOST_API_KEY"
Response · 200
{
  "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 }
  ]
}
FieldDescription
balance.microsPrepaid credit left, in millionths of a US dollar.
balance.decisions_leftHow many decisions that buys at the current price.
totalsRequests, billed decisions, failed requests and cost over the period.
dailyOne 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:

HeaderDescription
x-layahost-cost-microsWhat this request was billed, in micro-USD. 0 for free and failed requests.
x-layahost-balance-microsYour balance after this request.

To be warned before credit runs out, set a low-balance alert on the Billing page; you get one email when the balance falls under it.