Get Cost History

Changed on

Return cost history for chart visualization.

Two response modes share one endpoint:

  • GET /costs/history?hours=24&granularity=hour (web GUI sparkline) - returns a flat [{ts, usd}] array bucketed from cost-tracker usages over the last hours window.
  • GET /costs/history or ?envelope=1 (legacy/CLI) - returns the original {history, trend, burn_rate_*, history_days} envelope built from .sdd/metrics/cost_history.jsonl daily snapshots, narrowed to the caller's tenant the same way /costs/alerts is.

The sparkline branch lets the GUI feed recharts directly without unwrapping a .history field.

get/api/v1/costs/history

Request

  • The document declares no server URL.
  • Auth
    none declared

Query parameters

hoursinteger nullable
granularitystring
envelopeinteger

Response

Successful Response

unknown required

Changes

    • info

      added the new optional query request parameter envelope

    • info

      added the new optional query request parameter granularity

    • info

      added the new optional query request parameter hours

    • info

      added the non-success response with the status