For the complete documentation index, see llms.txt. This page is also available as Markdown.

Start an organization usage CSV export

Start an organization usage CSV export with the FLORA API: POST /organizations/{organizationId}/usage-exports.

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.

POST https://app.flora.ai/api/v1/organizations/{organizationId}/usage-exports
  • Auth: API key as a bearer token, Authorization: Bearer $FLORA_API_KEY. See Authentication.

  • TypeScript SDK: client.organizations.usageExports.create().

  • Operation ID: createOrganizationUsageExport.

Example

curl -X POST 'https://app.flora.ai/api/v1/organizations/org_abc123/usage-exports' \
  -H "Authorization: Bearer $FLORA_API_KEY" \
  -H 'Content-Type: application/json' \
  -d '{
  "start_date": "2026-08-01",
  "end_date": "2026-08-01"
}'
import { FloraClient } from '@flora-ai/flora';

const client = new FloraClient({ apiKey: process.env['FLORA_API_KEY'] });

const usageExport = await client.organizations.usageExports.create({
  organizationId: 'org_abc123',
  start_date: '2026-08-01',
  end_date: '2026-08-01',
});
console.log(usageExport);

Path parameters

Name
Type
Required
Description

organizationId

string

Yes

Organization identifier. Pattern: ^org_\S+$. Example: org_abc123.

Request body

Required.

Field
Type
Required
Description

start_date

string

Yes

First UTC day to include (YYYY-MM-DD). Pattern: ^\d{4}-\d{2}-\d{2}$. Example: 2026-08-01.

end_date

string

Yes

Last UTC day to include (YYYY-MM-DD). Pattern: ^\d{4}-\d{2}-\d{2}$. Example: 2026-08-01.

Responses

201: Export queued.

Field
Type
Required
Description

export_id

string

Yes

Usage export identifier. Pattern: ^export_\S+$. Example: export_abc123.

organization_id

string

Yes

Organization identifier. Pattern: ^org_\S+$. Example: org_abc123.

status

string

Yes

queued and running exports have no files yet; poll until completed or failed. One of: queued, running, completed, failed.

start_date

string

Yes

UTC calendar day in YYYY-MM-DD form. Pattern: ^\d{4}-\d{2}-\d{2}$. Example: 2026-08-01.

end_date

string

Yes

UTC calendar day in YYYY-MM-DD form. Pattern: ^\d{4}-\d{2}-\d{2}$. Example: 2026-08-01.

workspace_count

integer

Yes

Workspaces included in the export. At least 0.

row_count

integer or null

Yes

Total data rows across all parts; null until completed. At least 0.

error

string or null

Yes

Failure reason when status is failed

created_at

integer

Yes

When the export was requested (ms since epoch)

completed_at

integer or null

Yes

When the export finished (ms since epoch); null while in progress

files

array of objects

Yes

CSV parts to download; empty until the export completes

files[].part

integer

Yes

1-based part number; large exports are split. At least 0.

files[].filename

string

Yes

CSV filename

files[].download_url

string (uri)

Yes

Direct download URL for this CSV part

files[].row_count

integer

Yes

Data rows in this part. At least 0.

files[].byte_size

integer

Yes

Size of this part in bytes. At least 0.

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.

Status
Code
Meaning

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?