> For the complete documentation index, see [llms.txt](https://docs.flora.ai/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.flora.ai/api/reference/organizations/createorganizationusageexport.md).

# 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.

```http
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](https://docs.flora.ai/api/platform/authentication.md).
* **TypeScript SDK:** `client.organizations.usageExports.create()`.
* **Operation ID:** `createOrganizationUsageExport`.

## Example

{% tabs %}
{% tab title="cURL" %}

```bash
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"
}'
```

{% endtab %}

{% tab title="TypeScript SDK" %}

```typescript
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);
```

{% endtab %}
{% endtabs %}

## 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](https://docs.flora.ai/api/platform/errors.md) 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.                              |


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation by asking a question.

Perform an HTTP GET request on the following URL with the `ask` and `goal` query parameters:

```
GET https://docs.flora.ai/api/reference/organizations/createorganizationusageexport.md?ask=<question>&goal=<user_goal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is what the user is ultimately trying to achieve, the reason they need the answer. Sharing it helps GitBook give you a better, more relevant answer. A goal is most helpful when it describes the outcome the user wants rather than restating the question. For example, with `ask=how do I create an API token`, a goal like `automate deployments from our CI pipeline` lets GitBook tailor the answer to that use case.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
