# Runs

## Start a technique run

**post** `/techniques/{techniqueId}/runs`

Starts a run for a specific technique using the backward-compatible nested route. Mutating public API requests support an optional Idempotency-Key header for client retries; duplicate keys within two hours return idempotency_duplicate.

### Path Parameters

- `techniqueId: string`

  Technique identifier or slug

### Body Parameters

- `inputs: array of object { id, type, value }`

  Technique inputs

  - `id: string`

    Technique input identifier

  - `type: "text" or "imageUrl" or "videoUrl"`

    Technique input type

    - `"text"`

    - `"imageUrl"`

    - `"videoUrl"`

  - `value: string`

    Technique input value

- `mode: "async" or "stream"`

  Technique run execution mode

  - `"async"`

  - `"stream"`

- `callback_url: optional string`

  HTTPS callback URL for asynchronous run completion notifications

- `idempotency_key: optional string`

  Idempotency key for safely retrying requests

### Returns

- `created_at: number`

- `progress: number`

- `run_id: string`

  Run identifier

- `status: "pending" or "running" or "completed" or "failed"`

  - `"pending"`

  - `"running"`

  - `"completed"`

  - `"failed"`

- `charged_cost: optional number`

  Cost charged in USD

- `completed_at: optional number`

- `error_code: optional string`

  Machine-readable run error code

- `error_message: optional string`

  Human-readable run error message

- `outputs: optional array of object { output_id, type, url }`

  - `output_id: string`

    Run output identifier

  - `type: "imageUrl" or "videoUrl" or "audioUrl" or 2 more`

    Run output media type

    - `"imageUrl"`

    - `"videoUrl"`

    - `"audioUrl"`

    - `"text"`

    - `"documentUrl"`

  - `url: string`

    Run output URL or text content

- `poll_url: optional string`

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

- `started_at: optional number`

### Example

```http
curl https://app.flora.ai/api/v1/techniques/$TECHNIQUE_ID/runs \
    -H 'Content-Type: application/json' \
    -H "Authorization: Bearer $FLORA_API_KEY" \
    -d '{
          "inputs": [
            {
              "id": "id",
              "type": "text",
              "value": "value"
            }
          ],
          "mode": "async"
        }'
```

#### Response

```json
{
  "created_at": 0,
  "progress": 0,
  "run_id": "run_abc123",
  "status": "pending",
  "charged_cost": 0,
  "completed_at": 0,
  "error_code": "provider_error",
  "error_message": "The provider failed to complete the generation.",
  "outputs": [
    {
      "output_id": "output_1",
      "type": "imageUrl",
      "url": "https://media.flora.ai/output.png"
    }
  ],
  "poll_url": "https://example.com",
  "started_at": 0
}
```

## List technique run history

**get** `/technique-runs`

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

### Query Parameters

- `cursor: optional string`

  Opaque cursor for fetching the next page

- `limit: optional number`

  Maximum number of results to return

- `project_id: optional string`

  Project identifier

- `status: optional "pending" or "running" or "completed" or "failed"`

  Run status filter

  - `"pending"`

  - `"running"`

  - `"completed"`

  - `"failed"`

- `technique_id: optional string`

  Technique identifier

- `workspace_id: optional string`

  Workspace identifier

### Returns

- `meta: object { next_cursor, total_estimate }`

  - `next_cursor: string`

    Opaque cursor for fetching the next page

  - `total_estimate: optional number`

    Estimated total matching items

- `technique_runs: array of object { created_at, progress, project_id, 12 more }`

  - `created_at: number`

  - `progress: number`

  - `project_id: string`

    Project identifier

  - `run_id: string`

    Run identifier

  - `status: "pending" or "running" or "completed" or "failed"`

    - `"pending"`

    - `"running"`

    - `"completed"`

    - `"failed"`

  - `technique: object { name, technique_id }`

    - `name: string`

      Technique name

    - `technique_id: string`

      Technique identifier

  - `technique_run_id: string`

    Run identifier

  - `workspace_id: string`

    Workspace identifier

  - `charged_cost: optional number`

    Cost charged in USD

  - `completed_at: optional number`

  - `error_code: optional string`

    Machine-readable run error code

  - `error_message: optional string`

    Human-readable run error message

  - `outputs: optional array of object { output_id, type, url }`

    - `output_id: string`

      Run output identifier

    - `type: "imageUrl" or "videoUrl" or "audioUrl" or 2 more`

      Run output media type

      - `"imageUrl"`

      - `"videoUrl"`

      - `"audioUrl"`

      - `"text"`

      - `"documentUrl"`

    - `url: string`

      Run output URL or text content

  - `poll_url: optional string`

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

  - `started_at: optional number`

### Example

```http
curl https://app.flora.ai/api/v1/technique-runs \
    -H "Authorization: Bearer $FLORA_API_KEY"
```

#### Response

```json
{
  "meta": {
    "next_cursor": "eyJvZmZzZXQiOjIwfQ",
    "total_estimate": 0
  },
  "technique_runs": [
    {
      "created_at": 0,
      "progress": 0,
      "project_id": "prj_abc123",
      "run_id": "run_abc123",
      "status": "pending",
      "technique": {
        "name": "name",
        "technique_id": "tech_abcd1234"
      },
      "technique_run_id": "run_abc123",
      "workspace_id": "ws_abc123",
      "charged_cost": 0,
      "completed_at": 0,
      "error_code": "provider_error",
      "error_message": "The provider failed to complete the generation.",
      "outputs": [
        {
          "output_id": "output_1",
          "type": "imageUrl",
          "url": "https://media.flora.ai/output.png"
        }
      ],
      "poll_url": "https://example.com",
      "started_at": 0
    }
  ]
}
```

## Get a technique run

**get** `/techniques/{techniqueId}/runs/{runId}`

Returns status, progress, outputs, and error details for a technique run when it is accessible to the authenticated public API key.

### Path Parameters

- `techniqueId: string`

  Technique identifier or slug

- `runId: string`

  Run identifier

### Returns

- `created_at: number`

- `progress: number`

- `run_id: string`

  Run identifier

- `status: "pending" or "running" or "completed" or "failed"`

  - `"pending"`

  - `"running"`

  - `"completed"`

  - `"failed"`

- `charged_cost: optional number`

  Cost charged in USD

- `completed_at: optional number`

- `error_code: optional string`

  Machine-readable run error code

- `error_message: optional string`

  Human-readable run error message

- `outputs: optional array of object { output_id, type, url }`

  - `output_id: string`

    Run output identifier

  - `type: "imageUrl" or "videoUrl" or "audioUrl" or 2 more`

    Run output media type

    - `"imageUrl"`

    - `"videoUrl"`

    - `"audioUrl"`

    - `"text"`

    - `"documentUrl"`

  - `url: string`

    Run output URL or text content

- `poll_url: optional string`

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

- `started_at: optional number`

### Example

```http
curl https://app.flora.ai/api/v1/techniques/$TECHNIQUE_ID/runs/$RUN_ID \
    -H "Authorization: Bearer $FLORA_API_KEY"
```

#### Response

```json
{
  "created_at": 0,
  "progress": 0,
  "run_id": "run_abc123",
  "status": "pending",
  "charged_cost": 0,
  "completed_at": 0,
  "error_code": "provider_error",
  "error_message": "The provider failed to complete the generation.",
  "outputs": [
    {
      "output_id": "output_1",
      "type": "imageUrl",
      "url": "https://media.flora.ai/output.png"
    }
  ],
  "poll_url": "https://example.com",
  "started_at": 0
}
```

## Domain Types

### Run Create Response

- `RunCreateResponse object { created_at, progress, run_id, 8 more }`

  - `created_at: number`

  - `progress: number`

  - `run_id: string`

    Run identifier

  - `status: "pending" or "running" or "completed" or "failed"`

    - `"pending"`

    - `"running"`

    - `"completed"`

    - `"failed"`

  - `charged_cost: optional number`

    Cost charged in USD

  - `completed_at: optional number`

  - `error_code: optional string`

    Machine-readable run error code

  - `error_message: optional string`

    Human-readable run error message

  - `outputs: optional array of object { output_id, type, url }`

    - `output_id: string`

      Run output identifier

    - `type: "imageUrl" or "videoUrl" or "audioUrl" or 2 more`

      Run output media type

      - `"imageUrl"`

      - `"videoUrl"`

      - `"audioUrl"`

      - `"text"`

      - `"documentUrl"`

    - `url: string`

      Run output URL or text content

  - `poll_url: optional string`

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

  - `started_at: optional number`

### Run List Response

- `RunListResponse object { created_at, progress, project_id, 12 more }`

  - `created_at: number`

  - `progress: number`

  - `project_id: string`

    Project identifier

  - `run_id: string`

    Run identifier

  - `status: "pending" or "running" or "completed" or "failed"`

    - `"pending"`

    - `"running"`

    - `"completed"`

    - `"failed"`

  - `technique: object { name, technique_id }`

    - `name: string`

      Technique name

    - `technique_id: string`

      Technique identifier

  - `technique_run_id: string`

    Run identifier

  - `workspace_id: string`

    Workspace identifier

  - `charged_cost: optional number`

    Cost charged in USD

  - `completed_at: optional number`

  - `error_code: optional string`

    Machine-readable run error code

  - `error_message: optional string`

    Human-readable run error message

  - `outputs: optional array of object { output_id, type, url }`

    - `output_id: string`

      Run output identifier

    - `type: "imageUrl" or "videoUrl" or "audioUrl" or 2 more`

      Run output media type

      - `"imageUrl"`

      - `"videoUrl"`

      - `"audioUrl"`

      - `"text"`

      - `"documentUrl"`

    - `url: string`

      Run output URL or text content

  - `poll_url: optional string`

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

  - `started_at: optional number`

### Run Retrieve Response

- `RunRetrieveResponse object { created_at, progress, run_id, 8 more }`

  - `created_at: number`

  - `progress: number`

  - `run_id: string`

    Run identifier

  - `status: "pending" or "running" or "completed" or "failed"`

    - `"pending"`

    - `"running"`

    - `"completed"`

    - `"failed"`

  - `charged_cost: optional number`

    Cost charged in USD

  - `completed_at: optional number`

  - `error_code: optional string`

    Machine-readable run error code

  - `error_message: optional string`

    Human-readable run error message

  - `outputs: optional array of object { output_id, type, url }`

    - `output_id: string`

      Run output identifier

    - `type: "imageUrl" or "videoUrl" or "audioUrl" or 2 more`

      Run output media type

      - `"imageUrl"`

      - `"videoUrl"`

      - `"audioUrl"`

      - `"text"`

      - `"documentUrl"`

    - `url: string`

      Run output URL or text content

  - `poll_url: optional string`

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

  - `started_at: optional number`
