Platform usage and revenue over a period (admin only).
GET
/api/admin/usage
const url = 'https://api.tradr.cloud/api/admin/usage';const options = {method: 'GET'};
try { const response = await fetch(url, options); const data = await response.json(); console.log(data);} catch (error) { console.error(error);}curl --request GET \ --url https://api.tradr.cloud/api/admin/usageAdmin-gated (403 ADMIN_REQUIRED). from/to are optional ISO 8601 datetimes; the default window is the trailing 30 days ending now. from > to and ranges over 366 days are a 400 VALIDATION_ERROR. Returns period, totals (token/credit integer strings; providerCost is null when zero covered rows — pre-0013 rows have no recorded raw cost, see providerCostCoverage), the UTC-day series, topUsers (max 50 by billed credits), and the reversal-attributed revenue { credited, reversed, net }. Empty/future ranges return well-formed zeros (REQ-4.6).
Parameters
Section titled “Parameters”Query Parameters
Section titled “Query Parameters”from
string format: date-time
to
string format: date-time
Responses
Section titled “Responses”AdminUsage — period
VALIDATION_ERROR — malformed datetimes
Not authenticated.
ADMIN_REQUIRED — authenticated but not an admin.
Admin rate limit reached (60 / 60 s per user).