Docs

Usage API

Authenticate with a bearer API key from the dashboard. Events persist to Postgres. A daily cron rolls the previous UTC day when CRON_SECRET is set.

POST /api/v1/usage

curl -X POST "$APP_URL/api/v1/usage" \
  -H "Authorization: Bearer um_live_..." \
  -H "Content-Type: application/json" \
  -H "Idempotency-Key: evt_123" \
  -d '{
    "meter": "api_calls",
    "quantity": 12,
    "timestamp": "2026-09-05T13:00:00Z"
  }'

Body

  • meter — slug of a meter you created (default: api_calls, seats).
  • quantity — positive number.
  • timestamp — optional ISO-8601. Defaults to now.
  • idempotency_key — optional. Same tenant + key returns the original event.

GET /api/health

Returns process health, whether DATABASE_URL pings, and whether Stripe keys are present. No secrets.

GET /api/cron/aggregate

Authorize with Authorization: Bearer $CRON_SECRET. Sums yesterday (UTC). When Stripe is configured, tries invoice items or usage records. Without Stripe keys this is a ledger write only.