> ## 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.

# Generate App

> Generate a brand-new app from a plain-language instruction when no existing
app fits (check `POST /v1/apps/discover` first). A headless LLM planner
assembles a validated workflow graph from the node catalog and auto-publishes
it as a private, immediately-runnable app. The result is a normal app: run it
via `POST /v1/apps/{appId}/runs` with the returned parameter keys.


Generate a brand-new app from a plain-language instruction when no existing app fits your goal. Check `POST /v1/apps/discover` first — if a suitable app already exists, run that instead.

A headless LLM planner reads your instruction, assembles a validated workflow graph from Lamina's node catalog, and auto-publishes it as a **private** app. The result is a normal app: run it immediately with `POST /v1/apps/{appId}/runs` using the returned parameter keys, and share it with `POST /v1/apps/{appId}/visibility`.

## One-shot generate + run

To build **and** execute in a single call — e.g. text → workflow → video — pass `run: true` with an `inputs` map keyed by the app's parameter `key`s (media as URLs, options as labels). The response then includes a `run` object with the `runId`; poll `GET /v1/runs/{runId}` for the result. The app is always created; if inputs are invalid or a required input is missing, `run.started` is `false` and `run.errors` lists the problems so you can fix them and run the app directly.

## On-brand generation

Generated apps are **brand-aware by default**. Before planning, Lamina resolves the workspace's brand DNA — voice, visual anchors, and guardrails — and the planner seeds the generation nodes so the app produces on-brand output without you hand-writing brand instructions into every run.

Pass `brandProfileId` to target a specific brand in a multi-brand workspace; omit it to use the workspace's active brand. If no brand is configured, generation proceeds brand-agnostic — brand context is an enhancement, never a requirement.

## Writing a good instruction

Describe **what the app produces**, **the inputs the user will supply**, and **the desired output**. The more concrete, the better the plan.

* Good: *"Product photo app: the user uploads a product image and types a background scene; output one 1:1 image."*
* Good: *"Voiceover app: the user pastes a script; output an audio voiceover."*

## Response

Returns the app schema — `appId`, `name`, `parameters[]` (the inputs to pass to a run), `outputs[]`, and a `runUrl`. Feed the parameter `key`s straight into `POST /v1/apps/{appId}/runs`.

If the planner cannot produce a valid app, the response is a `422` with `error` and `details[]` describing the unresolved problems.

## Provider

The `provider` field (`claude` or `openai`) overrides the server default for a single request — useful for A/B comparison. Omit it to use the configured default.


## OpenAPI

````yaml POST /v1/workflows/generate
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: Account
    description: Credit balance, rate limits, and health checks
  - name: Webhooks
    description: Webhook signature verification for secure callback handling
paths:
  /v1/workflows/generate:
    post:
      tags:
        - Discover
      summary: Generate App
      description: >
        Generate a brand-new app from a plain-language instruction when no
        existing

        app fits (check `POST /v1/apps/discover` first). A headless LLM planner

        assembles a validated workflow graph from the node catalog and
        auto-publishes

        it as a private, immediately-runnable app. The result is a normal app:
        run it

        via `POST /v1/apps/{appId}/runs` with the returned parameter keys.
      operationId: generateWorkflow
      requestBody:
        required: true
        content:
          application/json:
            schema:
              type: object
              required:
                - instruction
              properties:
                instruction:
                  type: string
                  description: >-
                    What the app should create, including the user inputs it
                    needs and the desired outputs.
                name:
                  type: string
                  description: Optional preferred app name.
                visibility:
                  type: string
                  enum:
                    - private
                    - shared
                    - public
                  default: private
                  description: App reach after creation.
                provider:
                  type: string
                  enum:
                    - claude
                    - openai
                  description: >-
                    Planner LLM provider. Defaults to the server setting
                    (claude).
                brandProfileId:
                  type: string
                  description: >
                    Bake a specific brand profile's voice, visual anchors, and
                    guardrails into the generated app so it produces on-brand
                    output. Omit to use the workspace's active brand.
                run:
                  type: boolean
                  default: false
                  description: >
                    One-shot: after generating the app, immediately start a run
                    using `inputs`. The response then includes a `run` object
                    with the runId — poll GET /v1/runs/{runId}.
                inputs:
                  type: object
                  description: >
                    Input values keyed by the generated app's parameter `key`
                    (media as URLs, options as labels). Used only when `run` is
                    true.
      responses:
        '201':
          description: App generated and published
          content:
            application/json:
              schema:
                type: object
                required:
                  - data
                properties:
                  data:
                    type: object
                    required:
                      - appId
                      - name
                      - runUrl
                    properties:
                      appId:
                        type: string
                        format: uuid
                      name:
                        type: string
                      description:
                        type: string
                        nullable: true
                      visibility:
                        type: string
                        enum:
                          - private
                          - shared
                          - public
                      runUrl:
                        type: string
                        description: Convenience path to run the generated app.
                      parameters:
                        type: array
                        items:
                          type: object
                      outputs:
                        type: array
                        items:
                          type: object
        '422':
          description: The planner could not produce a valid app from the instruction
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
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)
  securitySchemes:
    apiKey:
      type: apiKey
      in: header
      name: x-api-key
      description: 'Workspace API key. Prefix: `lma_`. Example: `lma_abc123...`'

````