--- title: Runs | FLORA API description: Start generation and technique runs, then poll for status and outputs. --- Runs are asynchronous workflow executions. Create a run, keep the returned run ID or poll URL, then poll until the run reaches `completed` or `failed`. ## Create a technique run The slug-based technique run endpoint is the most common path: Terminal window ``` curl -X POST https://app.flora.ai/api/v1/techniques/cctv-cam/runs \ -H "Authorization: Bearer sk_live_XXXX" \ -H "Content-Type: application/json" \ -d '{ "inputs": [ { "id": "input_image", "type": "imageUrl", "value": "https://example.com/photo.png" } ], "mode": "async", "idempotency_key": "request-123" }' ``` Response: ``` { "runId": "run_...", "status": "pending", "progress": 0, "pollUrl": "https://app.flora.ai/api/v1/techniques/cctv-cam/runs/run_..." } ``` ## Poll a technique run Terminal window ``` curl https://app.flora.ai/api/v1/techniques/cctv-cam/runs/run_XXXX \ -H "Authorization: Bearer sk_live_XXXX" ``` Poll every 2–5 seconds. Stop when `status` is `completed` or `failed`. ## Start a general generation run Some workflows use the top-level generation endpoint: Terminal window ``` curl -X POST https://app.flora.ai/api/v1/runs/generation \ -H "Authorization: Bearer sk_live_XXXX" \ -H "Content-Type: application/json" \ -d '{ "type": "image", "prompt": "A small blue flower on a white background", "workspace_id": "ws_XXXX", "project_id": "proj_XXXX" }' ``` The response includes a run identifier such as `run_id`, `runId`, or `id`, and may include a `workflow_run_id`. ## Start a top-level technique run If you already have a technique ID from `GET /api/v1/techniques/{slug}`, you can also start a run through the top-level technique endpoint: Terminal window ``` curl -X POST https://app.flora.ai/api/v1/runs/technique \ -H "Authorization: Bearer sk_live_XXXX" \ -H "Content-Type: application/json" \ -d '{ "technique_id": "tech_XXXX", "workspace_id": "ws_XXXX", "inputs": { "input_image": "https://example.com/photo.png" } }' ``` ## Run statuses | Status | Meaning | | ----------- | ------------------------------------- | | `pending` | The run is queued | | `running` | Work is in progress; check `progress` | | `completed` | Outputs are ready | | `failed` | Check `errorCode` and `errorMessage` | ## Common endpoints | Method | Path | Description | | ------ | ---------------------------------------- | ------------------------------------- | | POST | `/api/v1/techniques/{slug}/runs` | Create a slug-based technique run | | GET | `/api/v1/techniques/{slug}/runs/{runId}` | Poll a slug-based technique run | | POST | `/api/v1/runs/generation` | Start a general generation run | | POST | `/api/v1/runs/technique` | Start a technique run by technique ID | ## Notes - Runs are asynchronous. Do not expect final outputs from the create response. - Use `idempotency_key` for slug-based technique runs when retrying after network errors. - Permission or credit constraints may return `403 forbidden` or `402 insufficient_credits`. - Output URLs are long-lived but not permanent. Download anything you need to keep.