Workspaces
List the FLORA workspaces your API key can reach, and check a workspace's balance and recent spend in US dollars.
Workspaces are the top-level containers for projects, assets, Techniques, runs and billing. Most API calls that create or list something need a workspace_id, and every run is billed to a workspace.
List workspaces
curl https://app.flora.ai/api/v1/workspaces \
-H "Authorization: Bearer $FLORA_API_KEY"import { FloraClient } from "@flora-ai/flora"
const client = new FloraClient()
const { workspaces } = await client.workspaces.list()Response:
{
"workspaces": [
{
"workspace_id": "ws_abc123",
"name": "My Workspace",
"role": "admin",
"organization_id": "org_abc123",
"organization_name": "Example Studio",
"app_url": "https://app.flora.ai/projects?workspace=jd7abc123"
}
]
}app_url opens FLORA in that workspace. It is stable, so you can share it, but the person opening it must be a member.
The list holds every workspace where your key has read permission. Use a workspace_id in later requests, such as listing projects or creating assets. If you get more than one and your code doesn't know which to use, don't guess: make it a setting, or ask the person running the script which workspace should pay.
Check balance and spend
GET /workspaces/{workspaceId}/usage returns, in US dollars, the balance you can draw on and, if you're allowed to see it, what the workspace was charged over a period (default: the last 30 days; at most 31 days):
The response has available_cost, balance_scope, member_limit and spend. With billing permission on a plan that includes usage reporting, balance_scope is workspace and you get the workspace's balance and totals. Otherwise it's caller: you get only your own allowance and any member limit, and spend says why it's unavailable (entitlement_missing or permission_missing) instead of reporting zero. available_cost is current and doesn't guarantee a run will be admitted. An API key needs billing permission on the workspace.
For totals across many workspaces, see Organization usage.
Find a member by email
GET /workspaces/{workspaceId}/members?email= returns only the member with that email address, or an empty list when nobody with that address belongs to the workspace. Use it to check whether someone is already a member before you share work with them. At Gmail and Googlemail, dots before the @ are ignored. With email, cursor and limit are ignored and meta.next_cursor is null.
Common endpoints
Notes
API keys carry per-workspace read, write and billing permissions chosen in Settings → API Keys. See Authentication.
Keep
workspace_idin your server-side configuration next to your API key.Don't expose API keys or workspace IDs in front-end code.
For how workspaces work in the app, see Workspaces.
Last updated
Was this helpful?