Get workspace balance and usage
import { FloraClient } from '@flora-ai/flora';
const client = new FloraClient({ apiKey: process.env['FLORA_API_KEY'] });
const workspace = await client.workspaces.getUsage({ workspaceId: '<workspaceId>',});console.log(workspace);curl -X GET 'https://app.flora.ai/api/v1/workspaces/<workspaceId>/usage' \ -H 'Authorization: Bearer $FLORA_API_KEY'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.
Error responses use the standard error body.
Authorizations
Section titled “Authorizations ”Parameters
Section titled “ Parameters ”Path Parameters
Section titled “Path Parameters ”Workspace identifier
Workspace identifier
Query Parameters
Section titled “Query Parameters ”First UTC day to include (YYYY-MM-DD), at most 30 days before end_date. Defaults to 29 days before end_date.
First UTC day to include (YYYY-MM-DD), at most 30 days before end_date. Defaults to 29 days before end_date.
Last UTC day to include (YYYY-MM-DD), no later than today. Defaults to today (UTC).
Last UTC day to include (YYYY-MM-DD), no later than today. Defaults to today (UTC).
Responses
Section titled “ Responses ”Workspace usage returned.
object
Workspace identifier
Currency of every cost in this response
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.
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.
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.
object
The limit in USD
Month: the limit resets each monthly usage cycle. all_time: it never resets.
object
The totals cover every run charged in the workspace, by any member or agent.
Inclusive UTC day range the totals cover
object
UTC calendar day in YYYY-MM-DD form
UTC calendar day in YYYY-MM-DD form
USD charged in the workspace in the period; the same figure as the in-app Usage tab for the same range.
Sum of the classified run categories in runs_by_category. Spend on runs whose output modality cannot be classified appears only in total_cost.
Charged runs in the period, by classified output modality. Runs whose modality cannot be classified are not counted.
object
Text generation runs
Image generation runs
Video generation runs
Audio generation runs
Technique runs
object
Entitlement_missing: the workspace’s plan does not include usage reporting. permission_missing: the plan includes it, but the credential’s user holds no billing permissions for the workspace. summary_unavailable: the totals could not be computed; retry, or request a shorter range.
Example
{ "workspace_id": "ws_abc123", "currency": "USD", "balance_scope": "caller", "member_limit": { "period": "month" }, "spend": { "status": "available", "scope": "workspace", "period": { "start_date": "2026-08-01", "end_date": "2026-08-01" } }}