Skip to content
FLORA DocsGo to app

List generation history

client.generations.list(GenerationListParams { cursor, limit, project_id, 2 more } query?, RequestOptionsoptions?): GenerationsCursorPage<GenerationListResponse { created_at, generation_id, progress, 12 more } >
GET/generations

Lists generation history for the authenticated caller, including pending, running, completed, and failed generations. Results are newest first and can be filtered by workspace_id, project_id, and status. Each item includes poll_url; use it to poll pending/running generations and to fetch completed or failed run details and outputs.

ParametersExpand Collapse
query: GenerationListParams { cursor, limit, project_id, 2 more }
cursor?: string

Opaque cursor for fetching the next page

limit?: number

Maximum number of results to return

minimum1
maximum100
project_id?: string

Project identifier

status?: "pending" | "running" | "completed" | "failed"

Run status filter

One of the following:
"pending"
"running"
"completed"
"failed"
workspace_id?: string

Workspace identifier

ReturnsExpand Collapse
GenerationListResponse { created_at, generation_id, progress, 12 more }
created_at: number
generation_id: string

Run identifier

progress: number
project_id: string

Project identifier

run_id: string

Run identifier

status: "pending" | "running" | "completed" | "failed"
One of the following:
"pending"
"running"
"completed"
"failed"
workspace_id: string

Workspace identifier

charged_cost?: number

Cost charged in USD

minimum0
completed_at?: number
error_code?: string

Machine-readable run error code

error_message?: string

Human-readable run error message

model?: Model { model_id }
model_id: string | null

Model identifier

minLength1
outputs?: Array<Output>
output_id: string

Run output identifier

type: "imageUrl" | "videoUrl" | "audioUrl" | 2 more

Run output media type

One of the following:
"imageUrl"
"videoUrl"
"audioUrl"
"text"
"documentUrl"
url: string

Run output URL or text content

minLength1
poll_url?: string

URL to poll pending/running runs or fetch completed/failed run details.

formaturi
started_at?: number

List generation history

import FLORA from '@flora-ai/flora';

const client = new FLORA({
  apiKey: process.env['FLORA_API_KEY'], // This is the default and can be omitted
});

// Automatically fetches more pages as needed.
for await (const generationListResponse of client.generations.list()) {
  console.log(generationListResponse.generation_id);
}
{
  "generations": [
    {
      "created_at": 0,
      "generation_id": "run_abc123",
      "progress": 0,
      "project_id": "prj_abc123",
      "run_id": "run_abc123",
      "status": "pending",
      "workspace_id": "ws_abc123",
      "charged_cost": 0,
      "completed_at": 0,
      "error_code": "provider_error",
      "error_message": "The provider failed to complete the generation.",
      "model": {
        "model_id": "t2i-flux-2-pro"
      },
      "outputs": [
        {
          "output_id": "output_1",
          "type": "imageUrl",
          "url": "https://media.flora.ai/output.png"
        }
      ],
      "poll_url": "https://example.com",
      "started_at": 0
    }
  ],
  "meta": {
    "next_cursor": "eyJvZmZzZXQiOjIwfQ",
    "total_estimate": 0
  }
}
{
  "error": {
    "code": "input_validation_error",
    "message": "prompt: Required",
    "fields": [
      {
        "field": "prompt",
        "message": "Required"
      }
    ]
  }
}
{
  "error": {
    "code": "unauthorized",
    "message": "Invalid API key."
  }
}
{
  "error": {
    "code": "insufficient_credits",
    "message": "Insufficient credits."
  }
}
{
  "error": {
    "code": "forbidden",
    "message": "Forbidden."
  }
}
{
  "error": {
    "code": "not_found",
    "message": "Not found."
  }
}
{
  "error": {
    "code": "idempotency_duplicate",
    "message": "Duplicate idempotency key."
  }
}
{
  "error": {
    "code": "rate_limited",
    "message": "Rate limit exceeded."
  }
}
{
  "error": {
    "code": "unknown_error",
    "message": "An unknown error occurred."
  }
}
Returns Examples
{
  "generations": [
    {
      "created_at": 0,
      "generation_id": "run_abc123",
      "progress": 0,
      "project_id": "prj_abc123",
      "run_id": "run_abc123",
      "status": "pending",
      "workspace_id": "ws_abc123",
      "charged_cost": 0,
      "completed_at": 0,
      "error_code": "provider_error",
      "error_message": "The provider failed to complete the generation.",
      "model": {
        "model_id": "t2i-flux-2-pro"
      },
      "outputs": [
        {
          "output_id": "output_1",
          "type": "imageUrl",
          "url": "https://media.flora.ai/output.png"
        }
      ],
      "poll_url": "https://example.com",
      "started_at": 0
    }
  ],
  "meta": {
    "next_cursor": "eyJvZmZzZXQiOjIwfQ",
    "total_estimate": 0
  }
}
{
  "error": {
    "code": "input_validation_error",
    "message": "prompt: Required",
    "fields": [
      {
        "field": "prompt",
        "message": "Required"
      }
    ]
  }
}
{
  "error": {
    "code": "unauthorized",
    "message": "Invalid API key."
  }
}
{
  "error": {
    "code": "insufficient_credits",
    "message": "Insufficient credits."
  }
}
{
  "error": {
    "code": "forbidden",
    "message": "Forbidden."
  }
}
{
  "error": {
    "code": "not_found",
    "message": "Not found."
  }
}
{
  "error": {
    "code": "idempotency_duplicate",
    "message": "Duplicate idempotency key."
  }
}
{
  "error": {
    "code": "rate_limited",
    "message": "Rate limit exceeded."
  }
}
{
  "error": {
    "code": "unknown_error",
    "message": "An unknown error occurred."
  }
}