> 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.md).

# FLORA API documentation

Call FLORA from your own code: authenticate with an API key, install the TypeScript SDK, make your first request, and find every API guide.

The FLORA API lets your own code do what you do on the canvas: run Techniques, start one-off generations, upload assets, and read projects, models and usage. Use it for scripts, back-end jobs and integrations; if you want an AI client such as Claude, ChatGPT or Cursor to drive FLORA for you, [FLORA MCP](/mcp.md) is the easier path.

## Base URL

```
https://app.flora.ai/api/v1
```

Every endpoint takes and returns JSON, except direct file uploads, which use `multipart/form-data`.

## Authentication

Create an API key in **Settings → API Keys** in FLORA and send it as a bearer token on every request:

```http
Authorization: Bearer ak_XXXX
```

Keys are shown once, carry per-workspace read, write and billing permissions, and must stay on your server. See [Authentication](/api/platform/authentication.md) for creating, rotating and revoking keys.

{% hint style="info" %}
API keys are available on workspaces whose plan includes API access. If **API Keys** is missing from Settings or asks you to upgrade, see [How FLORA pricing works](/plans-and-billing/pricing.md).
{% endhint %}

## Install the SDK

```bash
npm install @flora-ai/flora@^0.21.1
export FLORA_API_KEY="ak_XXXX"
```

The examples in these docs need `@flora-ai/flora` 0.21 or later. The SDK is a typed wrapper around the REST API. The [TypeScript quickstart](/api/quickstarts/typescript.md) has the details, and the [CLI quickstart](/api/quickstarts/cli.md) covers the terminal.

## Your first request

List your workspaces and the image models you can use, with each model's base price in US dollars:

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

```ts
import { FloraClient } from "@flora-ai/flora"

const client = new FloraClient() // reads FLORA_API_KEY

const { workspaces } = await client.workspaces.list()
console.log(workspaces.map((w) => `${w.workspace_id}  ${w.name}`))

const { models } = await client.models.list({ type: "image" })
console.log(models.map((m) => `${m.model_id}  $${m.estimated_cost_usd}`))
```

{% endtab %}

{% tab title="curl" %}

```bash
curl https://app.flora.ai/api/v1/workspaces \
  -H "Authorization: Bearer $FLORA_API_KEY"

curl "https://app.flora.ai/api/v1/models?type=image" \
  -H "Authorization: Bearer $FLORA_API_KEY"
```

{% endtab %}
{% endtabs %}

Nothing here costs money. To run something, follow the [TypeScript quickstart](/api/quickstarts/typescript.md) or [start a generation](/api/guides/generations.md).

## Public ID prefixes

The API uses prefixed public IDs. Pass them exactly as returned; an ID with the wrong prefix fails with `input_validation_error`.

| Resource     | Prefix                    | Where to get it                        |
| ------------ | ------------------------- | -------------------------------------- |
| Workspace    | `ws_`                     | `GET /workspaces`                      |
| Project      | `prj_`                    | `GET /projects?workspace_id=ws_...`    |
| Technique    | `tech_` (or use the slug) | `GET /techniques`                      |
| Run          | `run_`                    | Run and generation responses           |
| Asset        | `asset_`                  | Asset responses                        |
| Organization | `org_`                    | `organization_id` on `GET /workspaces` |
| LoRA Style   | `sty_`                    | `POST /loras/train`                    |

## Money

Prices and charges come back in US dollars. A Technique's `run_cost`, a run's `charged_cost`, a model's `estimated_cost_usd` and a generation quote's `estimated_cost` are all dollar amounts (`0.04` means $0.04). If a workspace can't cover a run, the API returns `402 insufficient_credits`; see [Errors](/api/platform/errors.md).

## Documentation map

**Quickstarts**

* [TypeScript](/api/quickstarts/typescript.md): install the SDK and run your first Technique.
* [CLI](/api/quickstarts/cli.md): run a Technique from the terminal.

**Platform**

* [Authentication](/api/platform/authentication.md): create, scope, rotate and revoke API keys.
* [Errors](/api/platform/errors.md): every error code and how to recover.
* [Idempotency](/api/platform/idempotency.md): retry requests without starting duplicate runs.
* [Webhooks](/api/platform/webhooks.md): get a signed callback when a run finishes.

**Resources**

* [Assets](/api/guides/assets.md): upload, retrieve, retry and attach media.
* [Feedback](/api/guides/feedback.md): report bugs and missing capabilities.
* [Generations](/api/guides/generations.md): run a single model without a Technique.
* [Train and use LoRA Styles](/api/guides/loras.md): train a Style and generate with it.
* [Models](/api/guides/models.md): list model IDs and prices.
* [Organization usage](/api/guides/organizations.md): read or export spend across workspaces.
* [Projects](/api/guides/projects.md): create, list and read projects.
* [Techniques](/api/guides/techniques.md): read a Technique's inputs and start runs.
* [Workspaces](/api/guides/workspaces.md): list the workspaces your key can reach.

**Recipes**

* [Generate a grid](/api/recipes/generate-a-grid.md): run a Technique several times and lay out the results.
* [Iterate on outputs](/api/recipes/iterate-on-outputs.md): feed favorite outputs back in as references.
* [Upload an asset](/api/recipes/upload-an-asset.md): turn a local file into a FLORA URL for a run.
* [Batch from a CSV](/api/recipes/batch-from-csv.md): process a spreadsheet with retries and backoff.

**Reference**

* [FLORA API reference](/api/reference.md): every endpoint, parameter and response.

## Get help

Email <support@florafauna.ai> with the `Flora-Request-Id` response header, the endpoint and method, the error code and message, and the approximate time (UTC). See [Errors](/api/platform/errors.md#contacting-support).


---

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