Skip to main content
API referenceBilling & Usage Export

Billing & Usage Export

This page has been cleared and is ready for updated Builder Studio documentation.

BuilderStudio meters usage in credits. You can read a workspace's balance and transactions programmatically, and export usage as a FOCUS v1.3 cost-and-usage dataset for ingestion into a FinOps tool. All billing reads require the read:billing scope on a workspace builder_ key.

What FOCUS is
FOCUS (FinOps Open Cost & Usage Specification) is a vendor-neutral schema for billing data. BuilderStudio emits its credit transactions in the FOCUS 1.3 column layout so the export drops into FOCUS-aware tooling without per-vendor mapping.

Credit balance and transactions

These read endpoints return live credit data for the key's workspace.

Method & pathReturns
GET /api/mcp/credits/balanceCurrent credit balance for the workspace.
GET /api/mcp/credits/transactions?limit=…Recent credit transactions (limit 1–200).
GET /api/mcp/billing/summaryBalance plus the most recent transactions in one response.
Read balancebash
curl https://<deployment>.convex.site/api/mcp/credits/balance \  -H "Authorization: Bearer builder_..." # -> { "workspaceId": "...", "balance": <credits>, ... }

FOCUS usage export

Two endpoints back the export. They are reachable on the BuilderStudio app origin at /api/billing/*; when you send a workspace builder_ key the app proxies the request to Convex, which derives the workspace from the key. (The same URLs also serve signed-in dashboard sessions, which must instead pass an explicit workspaceId query parameter.)

Method & pathPurpose
GET /api/billing/focus-export?from=…&to=…&format=…Export credit usage as FOCUS rows.
GET /api/billing/focus-metadata?from=…&to=…FOCUS dataset metadata (data generator, dataset instance, recency) for a range.

Query parameters

  • from, to — the date range. The window may span at most 365 days.
  • formatjsonl (default) or csv. Applies to focus-export only.
  • For dashboard-session requests, also pass workspaceId. API-key requests omit it — the workspace comes from the key.

Response

The export is returned as a file attachment: application/jsonl (focus-export.jsonl) or text/csv (focus-export.csv). Responses are sent with Cache-Control: no-store.

Export FOCUS usagebash
# JSONL (default)curl -L "https://<your-app-host>/api/billing/focus-export?from=1714521600000&to=1717200000000" \  -H "Authorization: Bearer builder_..." \  -o focus-export.jsonl # CSVcurl -L "https://<your-app-host>/api/billing/focus-export?from=...&to=...&format=csv" \  -H "Authorization: Bearer builder_..." \  -o focus-export.csv # Dataset metadatacurl "https://<your-app-host>/api/billing/focus-metadata?from=...&to=..." \  -H "Authorization: Bearer builder_..."
from / to are epoch milliseconds
Both bounds are Unix timestamps in milliseconds. Requests whose range exceeds 365 days are rejected. The FOCUS export endpoints are rate limited per caller (about 10 requests per minute).
Scope and related docs
Every endpoint on this page requires the read:billing scope — see Authentication. The full route catalog is in Endpoints.

Was this page helpful?