Docs / Usage History
Usage History
Usage History
GET/v1/usage/history
- Auth
- client bearer (no quota check)
- Cache-Control
no-store- Source of truth
clients/openapi.jsonanddocs/API.md§12
The most recent UTC billing months for the calling key, newest first. Every month in the window is present even when it recorded nothing (zeros, never a gap), so a client can draw a continuous trend. history[0] describes the current month and agrees with GET /v1/usage.
months=Nbounded to1..12; default6. A non-integer,0, a negative number, a value above 12 or a whitespace-only value →400with adetailnaming the bound. There is no silent fallback: a malformedmonthsis a client bug, not a default.quota/unlimitedsit on the envelope and are the key's current contract; they are not copied into a past month, because the quota is not recorded per month and a historical quota would be an invention.by_endpointis per-endpoint raw traffic. A per-endpoint billable split is not reported:usage_itemsrecords the item, not the endpoint it arrived on.501for a legacy/dev bearer;no-store.
Description: docs/API.md §12
Parameters
| Name | In | Required | Type | Example | Notes |
|---|---|---|---|---|---|
months | query | no | string | number of billing months to return, 1-12 (default 6) |
Example request
curl -sS \
'https://vg.tempproject.online/v1/usage/history' \
-H "Authorization: Bearer $NEWS_KEY"import json
import os
import urllib.request
URL = "https://vg.tempproject.online/v1/usage/history"
KEY = os.environ["NEWS_KEY"]
def call() -> dict:
req = urllib.request.Request(URL, headers={
"Authorization": f"Bearer {KEY}",
})
with urllib.request.urlopen(req, timeout=15) as res:
print(res.status, res.headers.get("ETag"))
return json.loads(res.read().decode("utf-8"))
if __name__ == "__main__":
body = call()
print(json.dumps(body, indent=2, ensure_ascii=False)[:2000])const res = await fetch(
"https://vg.tempproject.online/v1/usage/history",
{
method: "GET",
headers: {
authorization: `Bearer ${process.env.NEWS_KEY}`,
},
},
);
if (!res.ok) throw new Error(`${res.status} ${await res.text()}`);
console.log(res.headers.get("etag"), await res.json());The requests are generated from the path template and the parameters in clients/openapi.json, so a new parameter appears here without an edit to this site.
Example response
{
"key_id": 1,
"customer": "vg",
"plan": "starter",
"quota": 45000,
"unlimited": false,
"current_month": "2026-11",
"months_requested": 3,
"months_returned": 3,
"history": [
{"month": "2026-11", "billable_items": 4, "requests": 9, "items_served": 15,
"by_endpoint": [{"endpoint": "/v1/items", "requests": 1, "items_served": 2},
{"endpoint": "/v1/feed/{locale}", "requests": 2, "items_served": 4},
{"endpoint": "/v1/digest/{locale}", "requests": 3, "items_served": 6},
{"endpoint": "/v1/search", "requests": 2, "items_served": 2},
{"endpoint": "/v1/items/{id}", "requests": 1, "items_served": 1}],
"resets_at": "2026-12-01T00:00:00.000000Z"},
{"month": "2026-10", "billable_items": 12, "requests": 31, "items_served": 44,
"by_endpoint": [{"endpoint": "/v1/items", "requests": 31, "items_served": 44}],
"resets_at": "2026-11-01T00:00:00.000000Z"},
{"month": "2026-09", "billable_items": 0, "requests": 0, "items_served": 0,
"by_endpoint": [], "resets_at": "2026-10-01T00:00:00.000000Z"}
]
}Response example in docs/API.md §12 (GET /v1/usage/history)
Failures
This operation can answer 200, 400, 401, 422, 429, 501. The full envelope for each status, with its body, is on Errors.