Skip to content
FLORA DocsGo to app

Start a technique run

client.techniques.runs.create(stringtechniqueID, RunCreateParams { inputs, mode, callback_url, idempotency_key } body, RequestOptionsoptions?): RunCreateResponse { created_at, progress, run_id, 8 more }
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.

ParametersExpand Collapse
techniqueID: string

Technique identifier or slug

body: RunCreateParams { inputs, mode, callback_url, idempotency_key }
inputs: Array<Input>

Technique inputs

id: string

Technique input identifier

type: "text" | "imageUrl" | "videoUrl"

Technique input type

One of the following:
"text"
"imageUrl"
"videoUrl"
value: string

Technique input value

mode: "async" | "stream"

Technique run execution mode

One of the following:
"async"
"stream"
callback_url?: string

HTTPS callback URL for asynchronous run completion notifications

formaturi
idempotency_key?: string

Idempotency key for safely retrying requests

ReturnsExpand Collapse
RunCreateResponse { created_at, progress, run_id, 8 more }
created_at: number
progress: number
run_id: string

Run identifier

status: "pending" | "running" | "completed" | "failed"
One of the following:
"pending"
"running"
"completed"
"failed"
charged_cost?: number
completed_at?: number
error_code?: string

Machine-readable run error code

error_message?: string

Human-readable run error message

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

formaturi
poll_url?: string
formaturi
started_at?: number

Start a technique run

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

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

const run = await client.techniques.runs.create('art-directors-critique', {
  inputs: [
    {
      id: 'id',
      type: 'text',
      value: 'value',
    },
  ],
  mode: 'async',
});

console.log(run.run_id);
{
  "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
}
{
  "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
{
  "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
}
{
  "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."
  }
}