API

REST API

Authenticated JSON endpoints under /api. All routes expect a Supabase session cookie unless noted otherwise.

Endpoints

  • GET /api/dashboard/metrics — consumption aggregates
  • GET /api/providers — list provider connections (masked)
  • POST /api/providers — create connection
  • PATCH /api/providers/[id] — update name or secret
  • DELETE /api/providers/[id] — remove connection
  • POST /api/usage/ingest — batch usage events (details)
  • PATCH /api/settings/budget — monthly budget USD

Errors

401 Unauthorized

No valid session — sign in and retry with cookies.

503

Database object missing or misconfigured; run migrations and check Supabase (Supabase setup).

Example: fetch metrics

const res = await fetch("/api/dashboard/metrics", {
  credentials: "include",
})
const data = await res.json()