Skip to content

Start an organization usage CSV export

POST
/organizations/{organizationId}/usage-exports
import { FloraClient } from '@flora-ai/flora';
const client = new FloraClient({ apiKey: process.env['FLORA_API_KEY'] });
const usageExport = await client.organizations.usageExports.create({
organizationId: '<organizationId>',
start_date: '2026-08-01',
end_date: '2026-08-01',
});
console.log(usageExport);

Queues a CSV export of every charged generation and technique run across the organization’s workspaces for an inclusive UTC day range of at most 366 days. Columns: Workspace, Date, Project ID, Project Name, User Email, Modality, Model, Media URL, Cost, Modifiers, Usage pool. The export builds in the background; poll GET /organizations/{organizationId}/usage-exports/{exportId} until status is completed, then download the listed files. A copy of the download link is also emailed to the credential’s user. One export per user may be in progress at a time; a second request within a few minutes returns rate_limited. Requires an organization with multiple workspaces enabled, and the credential’s user must hold billing permissions in that organization. An API key works for the organization that owns its workspace; an OAuth token works for any organization the user administers. Other organizations return 403.

Error responses use the standard error body.

organizationId
required

Organization identifier

string
/^org_\S+$/

Organization identifier

Media type application/json
object
start_date
required

First UTC day to include (YYYY-MM-DD)

string
/^\d{4}-\d{2}-\d{2}$/
end_date
required

Last UTC day to include (YYYY-MM-DD)

string
/^\d{4}-\d{2}-\d{2}$/

Export queued.

Media type application/json
object
export_id
required

Usage export identifier

string
/^export_\S+$/
organization_id
required

Organization identifier

string
/^org_\S+$/
status
required

Queued and running exports have no files yet; poll until completed or failed

string
Allowed values: queued running completed failed
start_date
required

UTC calendar day in YYYY-MM-DD form

string
/^\d{4}-\d{2}-\d{2}$/
end_date
required

UTC calendar day in YYYY-MM-DD form

string
/^\d{4}-\d{2}-\d{2}$/
workspace_count
required

Workspaces included in the export

integer
row_count
required
Any of:
integer
error
required
Any of:
string
created_at
required

When the export was requested (ms since epoch)

integer
completed_at
required
Any of:
integer
files
required

CSV parts to download; empty until the export completes

Array<object>
object
part
required

1-based part number; large exports are split

integer
filename
required

CSV filename

string
download_url
required

Direct download URL for this CSV part

string format: uri
row_count
required

Data rows in this part

integer
byte_size
required

Size of this part in bytes

integer
Example
{
"export_id": "export_abc123",
"organization_id": "org_abc123",
"status": "queued",
"start_date": "2026-08-01",
"end_date": "2026-08-01"
}