Won · usage

What this key has spent, and what is left

usage answers "can I keep going?". It returns this key’s own lifetime cost, the workspace it belongs to over a window, what each store cost inside that window, and the prepaid balance that gates the next call.

Counts

One call. days sets the window for the workspace and store figures; the key’s own figure is lifetime and does not move with it.

u = mem.usage(days=7)
# {"window_days": 7, "key": {"requests": 26, "cost_cents": 1.19, …}, …}

if u["balance_cents"] <= 0:
    # top up before the next write
const u = await mem.usage(7);

if (u.balance_cents <= 0) {
  // top up before the next write
}
let u = mem.usage(7).await?;
let left = u["balance_cents"].as_f64().unwrap_or(0.0);
curl https://api.wontopos.com/api/v1/won/usage?days=7 \
  -H "X-API-Key: $WOS_KEY"
FieldWhat it means
keyThis key only — never a roster of the account’s other keys. since is always "lifetime".
workspaceThe workspace this key belongs to, over the requested window.
storesPer-store spend over the window, busiest first, at most 50 rows. other is the overflow bucket once an account meters more than 200 distinct stores in a day, not a real store.
balance_centsPrepaid balance left on the account. Negative means overdrawn.
expiring_soon_centsOf what is left, how much expires within 90 days.
daysWindow for the workspace and store figures. 1–365, default 7. Out of range is clamped rather than refused.

Free, like every Won call: no token charge, no per-request fee, and it skips the balance gate — an account at zero must still be able to find out why. Ten per minute for this endpoint, and 300 an hour shared across all Won calls on the account.