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.
Credit balance and transactions
These read endpoints return live credit data for the key's workspace.
| Method & path | Returns |
|---|---|
GET /api/mcp/credits/balance | Current credit balance for the workspace. |
GET /api/mcp/credits/transactions?limit=… | Recent credit transactions (limit 1–200). |
GET /api/mcp/billing/summary | Balance plus the most recent transactions in one response. |
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 & path | Purpose |
|---|---|
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.format—jsonl(default) orcsv. Applies tofocus-exportonly.- 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.
# 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_..."read:billing scope — see Authentication. The full route catalog is in Endpoints.Was this page helpful?