Docs menu

Get Usage

Returns a summary and daily breakdown of your API usage over a configurable lookback window.

GET/v1/account/usage
curl "https://api.sonilo.com/v1/account/usage?days=30" \
  -H "Authorization: Bearer sk_your_api_key"
{
  "summary": {
    "total_requests": 142,
    "total_duration_seconds": 8520.0,
    "total_cost": 8520.0,
    "period_start": "2026-04-04T00:00:00Z",
    "period_end": "2026-05-04T00:00:00Z"
  },
  "daily": [
    {
      "date": "2026-05-03",
      "requests": 12,
      "duration_seconds": 720.0,
      "cost": 720.0
    }
  ]
}

Authorization

Authenticate via Bearer token. Generate keys at the API Keys page and pass them in the Authorization header on every request.

Authorization: Bearer sk_your_api_key

Query Parameters

daysinteger (query)
Number of days to look back. Min: 1, max: 365. Default: 30.

Response

summaryobject
Aggregate totals for the requested window. Contains total_requests, total_duration_seconds, total_cost, period_start, period_end.
summary.total_requestsinteger
Number of API requests counted in the window.
summary.total_duration_secondsnumber
Total billed duration across all requests, in seconds.
summary.total_costnumber
Total cost across all requests for the window, in account currency units.
summary.period_startstring (ISO 8601)
Inclusive start of the window, UTC.
summary.period_endstring (ISO 8601)
Exclusive end of the window, UTC.
dailyobject[]
Per-day breakdown over the window. Each entry contains date, requests, duration_seconds, cost.
daily[].datestring (YYYY-MM-DD)
UTC date for the bucket.
daily[].requestsinteger
Number of requests on that date.
daily[].duration_secondsnumber
Billed duration for that date, in seconds.
daily[].costnumber
Cost for that date, in account currency units.