> ## Documentation Index
> Fetch the complete documentation index at: https://docs.uselamina.ai/llms.txt
> Use this file to discover all available pages before exploring further.

# Refine Run

> Iterative refinement: provide natural-language feedback on a completed run's
outputs. An LLM identifies which workflow nodes need prompt changes, re-executes
them, and returns updated outputs with a summary of what changed.

Only works on runs in `completed` status. The refinement happens in-place on
the same run — no new run ID is created.

**Example:** After generating a product image, send `"Make the background
brighter and add more contrast"` to refine the output without re-running
the entire workflow.


Iterative refinement for completed runs. Provide natural-language feedback and the engine re-executes only the nodes that need to change.

The feedback agent uses an LLM to analyze which workflow nodes (image generation, video editing, etc.) need prompt modifications to address the feedback, rewrites only those prompts, and re-executes the affected subgraph.

Use this for quality feedback loops: generate content, review it, then refine without starting over.


## OpenAPI

````yaml POST /v1/runs/{runId}/feedback
openapi: 3.1.0
info:
  title: Lamina Apps API
  version: 1.0.0
  description: >
    Professional creative content production for AI agents. Create brand-aligned
    images, videos, and designs from natural-language briefs using 30+
    specialized AI pipelines.


    Unlike raw model APIs (DALL-E, Flux, Kling), Lamina automatically applies
    brand guidelines, selects the optimal multi-model pipeline, scores output
    quality, and delivers permanent CDN-hosted URLs with composability metadata
    for chaining.


    ## Authentication

    All endpoints require an API key passed via one of these headers:

    - `x-api-key: lma_your_key` (recommended)

    - `Authorization: Bearer lma_your_key`


    API keys are workspace-scoped. Create them in **Settings -> API Keys**.


    ## Quick Start (One-Call Path)

    `POST /v1/create` with `{ "brief": "product photo of sneakers", "sync": true
    }` — returns completed output inline with CDN URL.


    ## Quick Start (Advanced)

    1. `GET /v1/apps` -- browse 30+ specialized creative apps

    2. `GET /v1/apps/{appId}` -- inspect input parameters

    3. `POST /v1/apps/{appId}/runs?webhook=<url>` -- run with your inputs

    4. Receive results via webhook, poll `GET /v1/runs/{runId}`, or stream via
    `GET /v1/runs/{runId}/stream`


    ## Rate Limits

    All `/v1/*` endpoints are currently limited to 100 requests per minute per
    IP.

    On `429`, read the `RateLimit-*` and `Retry-After` headers before retrying.


    ## How Inputs Work

    When running an app, provide inputs as a JSON object keyed by parameter
    **name** (from the app details response).


    - **text** parameters: send a string value (e.g. a prompt or description)

    - **options** parameters: send the **label** of the option (e.g.
    `"Caucasian"`), not an internal value

    - **url** parameters: send a publicly accessible URL to an image or video


    Every parameter is returned with `required: true`. Parameters with a
    `default` can safely be omitted -- the app will use the default value.


    ## Endpoint Groups

    | Group | Purpose |

    |-------|---------|

    | **Apps** | Discover and inspect available content creation apps |

    | **Runs** | Run workflows, track progress, and retrieve results |

    | **Assets** | Browse generated images, videos, and text from past
    executions |

    | **Intelligence** | Brand context, performance prediction, recommendations,
    and trends |

    | **Publishing** | Publish content to connected social channels |

    | **Content** | One-call agent operations: create, score, brief, batch |

    | **Account** | Credit balance and rate limit visibility |

    | **Templates** | Content creation templates and strategies |

    | **Webhooks** | Webhook signature verification |
servers:
  - url: https://app.uselamina.ai
    description: Production
security:
  - apiKey: []
tags:
  - name: Create
    description: Create content from briefs, run specific apps, and use templates
  - name: Discover
    description: Find and inspect available apps and their input schemas
  - name: Track
    description: Monitor execution progress, retrieve results, and browse generated assets
  - name: Intelligence
    description: >-
      Brand context, performance prediction, content recommendations, and trend
      signals
  - name: Distribute
    description: Publish content to social channels and transfer assets to CDN
  - name: Score
    description: Evaluate content quality, brand alignment, and engagement potential
  - name: Compose
    description: >-
      Turn a script into a narrated, multi-shot video — pick a format (never a
      model), preview cost, and render
  - name: Account
    description: Credit balance, rate limits, and health checks
  - name: Webhooks
    description: Webhook signature verification for secure callback handling
paths:
  /v1/runs/{runId}/feedback:
    post:
      tags:
        - Track
      summary: Refine Run with Feedback
      description: >
        Iterative refinement: provide natural-language feedback on a completed
        run's

        outputs. An LLM identifies which workflow nodes need prompt changes,
        re-executes

        them, and returns updated outputs with a summary of what changed.


        Only works on runs in `completed` status. The refinement happens
        in-place on

        the same run — no new run ID is created.


        **Example:** After generating a product image, send `"Make the
        background

        brighter and add more contrast"` to refine the output without re-running

        the entire workflow.
      operationId: refineRun
      parameters:
        - name: runId
          in: path
          required: true
          schema:
            type: string
            format: uuid
          description: The run to refine.
      requestBody:
        required: true
        content:
          application/json:
            schema:
              type: object
              properties:
                feedback:
                  type: string
                  description: >-
                    Natural-language feedback describing what to change in the
                    outputs.
              required:
                - feedback
            example:
              feedback: >-
                Make the background brighter and increase contrast on the
                product
      responses:
        '200':
          description: Refinement result with updated outputs
          content:
            application/json:
              schema:
                type: object
                properties:
                  data:
                    type: object
                    properties:
                      runId:
                        type: string
                        format: uuid
                      status:
                        type: string
                        enum:
                          - completed
                          - failed
                      summary:
                        type: string
                        description: LLM-generated description of what was changed.
                      refinedNodes:
                        type: array
                        items:
                          type: object
                          properties:
                            nodeId:
                              type: string
                            reason:
                              type: string
                        description: Which nodes were re-executed and why.
                      outputs:
                        type: array
                        items:
                          type: object
                          properties:
                            id:
                              type: string
                            label:
                              type: string
                            type:
                              type: string
                            value:
                              type: string
                        description: Full updated output set after refinement.
                      errorMessage:
                        type: string
                        nullable: true
              example:
                data:
                  runId: 99ebc7c6-24f3-4fc2-9d53-2e3f49f3bec1
                  status: completed
                  summary: Brightened the background and increased product contrast
                  refinedNodes:
                    - nodeId: designer-a
                      reason: Background brightness and contrast adjustment
                  outputs:
                    - id: designer-a
                      label: Product Hero
                      type: image
                      value: https://cdn.uselamina.ai/outputs/refined-hero.png
                  errorMessage: null
        '400':
          description: Run is not in completed state
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
        '401':
          $ref: '#/components/responses/Unauthorized'
        '404':
          $ref: '#/components/responses/NotFound'
components:
  schemas:
    Error:
      type: object
      description: Standard error response
      required:
        - error
      properties:
        error:
          type: string
          description: Human-readable error message
        details:
          type: array
          items:
            type: string
          description: Additional validation error details (present on 400 responses)
  responses:
    Unauthorized:
      description: Missing or invalid API key
      content:
        application/json:
          schema:
            type: object
            properties:
              error:
                type: string
          example:
            error: Invalid API key
    NotFound:
      description: Resource not found
      content:
        application/json:
          schema:
            type: object
            properties:
              error:
                type: string
          example:
            error: App not found
  securitySchemes:
    apiKey:
      type: apiKey
      in: header
      name: x-api-key
      description: 'Workspace API key. Prefix: `lma_`. Example: `lma_abc123...`'

````