Get workspace balance and usage
Get workspace balance and usage with the FLORA API: GET /workspaces/{workspaceId}/usage.
Returns, in USD, the balance the credential's user may see in a workspace and, when they may see workspace usage, what the workspace was charged over an inclusive UTC day range (default: the last 30 days; at most 31 days, ending no later than today). On a plan that includes usage reporting, a user with billing permissions for the workspace gets the workspace balance and workspace totals (balance_scope workspace). Anyone else gets only their own allowance and any member limit on them (balance_scope caller), and spend is unavailable with reason entitlement_missing (the plan lacks usage reporting) or permission_missing (the user lacks billing permissions), never zero. available_cost is current, not limited to the period, and does not guarantee that a run will be admitted. Totals only: no pool breakdown and no per-member, per-model, or per-run detail. An API key needs billing permission on the workspace; an OAuth token works for any workspace its user is a member of. Other workspaces return 403.
GET https://app.flora.ai/api/v1/workspaces/{workspaceId}/usageAuth: API key as a bearer token,
Authorization: Bearer $FLORA_API_KEY. See Authentication.TypeScript SDK:
client.workspaces.getUsage().Operation ID:
getWorkspaceUsage.
Example
curl -X GET 'https://app.flora.ai/api/v1/workspaces/ws_abc123/usage' \
-H "Authorization: Bearer $FLORA_API_KEY"import { FloraClient } from '@flora-ai/flora';
const client = new FloraClient({ apiKey: process.env['FLORA_API_KEY'] });
const workspace = await client.workspaces.getUsage({
workspaceId: 'ws_abc123',
});
console.log(workspace);Path parameters
workspaceId
string
Yes
Workspace identifier. Pattern: ^ws_\S+$. Example: ws_abc123.
Query parameters
start_date
string
No
First UTC day to include (YYYY-MM-DD), at most 30 days before end_date. Defaults to 29 days before end_date. Pattern: ^\d{4}-\d{2}-\d{2}$. Example: 2026-08-01.
end_date
string
No
Last UTC day to include (YYYY-MM-DD), no later than today. Defaults to today (UTC). Pattern: ^\d{4}-\d{2}-\d{2}$. Example: 2026-08-01.
Responses
200: Workspace usage returned.
workspace_id
string
Yes
Workspace identifier. Pattern: ^ws_\S+$. Example: ws_abc123.
currency
string
Yes
Currency of every cost in this response. Always USD.
balance_scope
string
Yes
Whose balance available_cost is, decided by the workspace's plan and the current role of the credential's user. workspace: the plan includes usage reporting and the user holds billing permissions for the workspace, directly or through an organization role. caller: anyone else, including billing admins on a plan without usage reporting. One of: caller, workspace.
available_cost
number
Yes
USD that can still be spent now, read at request time and not limited to any period. For balance_scope workspace: what the credit pool the workspace draws from can still fund (included, prepaid, and remaining enabled overage usage), before any per-member limit; an organization's workspaces may share that pool. For balance_scope caller: the credential's user's own allowance from that pool, held to any spending limit or cap on that user, so it equals the pool's amount when none applies. Workspace-level spending caps are not reflected, and it does not guarantee that a run will be admitted: other spend and concurrent runs change it. At least 0.
member_limit
object
No
The member spending limit that binds the credential's user, set on their workspace or organization membership, whichever leaves less room. Present only for balance_scope caller, and only when such a limit is set.
member_limit.limit_cost
number
Yes
The limit in USD. At least 0.
member_limit.period
string
Yes
month: the limit resets each monthly usage cycle. all_time: it never resets. One of: month, all_time.
spend
object
Yes
Workspace totals over the requested range, given only to a balance_scope workspace caller. When status is unavailable, reason says why, and no totals or period are given. See the spend shapes below.
Errors
Every error has the same body: error.code, error.message, and error.fields on validation errors. See Errors for how to recover from each code.
400
invalid_json, input_validation_error
The body isn't valid JSON, or an input failed validation (fields lists each one).
401
unauthorized, invalid_api_key
The API key is missing, invalid or revoked.
402
insufficient_credits
The workspace balance is too low for this request.
403
forbidden, paid_plan_required
The key can't do this, or the workspace plan doesn't include it.
404
not_found
The resource doesn't exist or isn't visible to this key.
409
idempotency_duplicate, revision_conflict
Duplicate Idempotency-Key or a stale base_revision.
429
rate_limited
Too many requests. Back off and retry.
500
unknown_error, internal_error
Something failed on FLORA's side. Retry with backoff.
503
temporarily_unavailable
Authorization is temporarily unavailable. Retry later.
Last updated
Was this helpful?