Skip to content
Orqen Docs

API Reference

Usage and requests

Usage endpoints power the dashboard: token savings, request logs, billing estimates, and routing performance. Authenticate these requests with your Orqen API key. The /v1/account/... routes are the primary account API; the shorter /v1/usage/summary, /v1/usage/daily, and /v1/requests aliases are also supported for scripts.

Summary

curl https://api.orqen.app/v1/account/usage/summary \
  -H "Authorization: Bearer sk-orq-YOUR_KEY"

Daily usage

curl https://api.orqen.app/v1/account/usage/daily \
  -H "Authorization: Bearer sk-orq-YOUR_KEY"

Request log

curl "https://api.orqen.app/v1/account/requests?limit=50&offset=0" \
  -H "Authorization: Bearer sk-orq-YOUR_KEY"

Request detail

curl https://api.orqen.app/v1/account/requests/2ea9b5c8-... \
  -H "Authorization: Bearer sk-orq-YOUR_KEY"

Billing

curl https://api.orqen.app/v1/account/billing \
  -H "Authorization: Bearer sk-orq-YOUR_KEY"

Usage by API key

Returns request count and tokens saved per API key for the current billing period. Useful for attribution when you use multiple keys across different agents or environments.

curl https://api.orqen.app/v1/account/usage/by-key \
  -H "Authorization: Bearer sk-orq-YOUR_KEY"

Analytics

Dashboard routes use Supabase session auth; the same paths work with an Orqen API key under /v1/usage/analytics/... (no /account prefix).

curl "https://api.orqen.app/v1/account/usage/analytics/daily?days=30" \
  -H "Authorization: Bearer sk-orq-YOUR_KEY"

Sessions

curl https://api.orqen.app/v1/account/sessions \
  -H "Authorization: Bearer sk-orq-YOUR_KEY"

Stripe billing (dashboard)

Checkout and portal endpoints require a logged-in dashboard session (Supabase JWT), not an Orqen API key. The dashboard calls these from the browser after signup.

POST /v1/billing/create-checkout
POST /v1/billing/customer-portal
POST /v1/billing/sync-checkout
POST /v1/billing/sync-subscription

Savings estimate

estimated_tokens_saved counts tool-definition savings: (tools_in − tools_out) × tokens-per-tool estimate.compression_tokens_saved counts message/context compression only (dedup, tool-result trim, summarization, schema trim). Monthly totals and billing use the sum of both — they are stored separately so dashboards do not double-count. Provider savings use model pricing where available.