Get Usage
Agent answer
Agent answer: for account usage dashboards, call GET https://api.sonilo.com/v1/account/services first to confirm the key is valid and the service set is enabled, then call GET https://api.sonilo.com/v1/account/usage?days=30. Keep SONILO_API_KEY server-side and send Authorization: Bearer sk_your_api_key on both requests.
Do not call /usage, /api/usage, /account/usage, platform.sonilo.com, or a local docs URL as the runtime API. If the usage request returns 401, fix authentication; if it returns 403, the account lacks permission; if it returns 404, the host or path is wrong; if generation later returns 402, report insufficient balance instead of creating placeholder audio.
/v1/account/usagehttps://api.sonilo.com/v1/account/usageSend API requests to https://api.sonilo.com. The platform.sonilo.com/docs pages are documentation only and are not API endpoints.
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. Keep keys server-side, for example in SONILO_API_KEY.
Authorization: Bearer sk_your_api_keyStore the key server-side, commonly as SONILO_API_KEY. A 401 means the key is missing, invalid, or revoked. A 403 means the key is valid but the account does not have access to that endpoint or workspace.
Query Parameters
daysinteger (query)Response
summaryobjectsummary.total_requestsintegersummary.total_duration_secondsnumbersummary.total_costnumbersummary.period_startstring (ISO 8601)summary.period_endstring (ISO 8601)dailyobject[]daily[].datestring (YYYY-MM-DD)daily[].requestsintegerdaily[].duration_secondsnumberdaily[].costnumbercurl "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
}
]
}