Cabinhub News API v1.0.0

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.json and docs/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.

Description: docs/API.md §12

Parameters

NameInRequiredTypeExampleNotes
monthsquerynostringnumber of billing months to return, 1-12 (default 6)

Example request

curl
Shell
curl -sS \
  'https://vg.tempproject.online/v1/usage/history' \
  -H "Authorization: Bearer $NEWS_KEY"
Python, standard library only
Python
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])
TypeScript, Node 18+, no dependencies
TypeScript
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

Response body
JSON
{
  "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.