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

# The Creative Engine

> Lamina's core mental model: apps as creative schemas, executions as content operations, intelligence as editorial brain, distribution as delivery layer.

## What Is The Creative Engine

Lamina is an agentic creative API for generating videos, movies, and images for products, brands, social, and ads. Instead of calling models directly, you call **apps** — packaged multi-node workflows that may internally chain image generation, video generation, LLM reasoning, compositing, upscaling, and audio synthesis. Each app has a typed input schema. You send inputs, the API handles orchestration, brand context injection, and output delivery.

The engine sits between your application and the models. Your code never needs to know which providers run behind an app, how nodes are wired, or where outputs are hosted. You work with five primitives, and the engine handles everything else.

## The Five Primitives

| Primitive        | What It Is                                       | CMS Analogy                        |
| ---------------- | ------------------------------------------------ | ---------------------------------- |
| **App**          | A packaged workflow with a typed input schema    | Content type / document schema     |
| **Execution**    | One async run of an app that produces outputs    | Document creation / mutation       |
| **Intelligence** | Brand context, predictions, recommendations      | Editorial strategy / content rules |
| **Template**     | Pre-configured starting point for a content type | Content template / blueprint       |
| **Channel**      | A connected publishing destination               | Frontend / delivery endpoint       |

**Apps** define what you can create. **Executions** are the act of creating. **Intelligence** makes the output smarter. **Templates** accelerate setup. **Channels** deliver the result.

This is the full content lifecycle through one API: discover, create, evaluate, distribute.

## Two Ways To Create

### One call: let the engine decide

```bash theme={null}
curl -X POST \
  -H "x-api-key: lma_your_api_key" \
  -H "Content-Type: application/json" \
  -d '{
    "brief": "A premium hero shot of a leather handbag on marble, warm studio lighting",
    "contentType": "product_image"
  }' \
  https://app.uselamina.ai/v1/content/create
```

One call. The engine resolves brand context, selects the best-fit app, maps inputs, and starts the execution. You get back a run ID and collect results the same way as any other execution.

This is the path for agents and automation — go from intent to asset without manual orchestration.

### Step by step: you pick the app

```bash theme={null}
# 1. Discover
curl -H "x-api-key: lma_your_api_key" \
  https://app.uselamina.ai/v1/apps

# 2. Inspect
curl -H "x-api-key: lma_your_api_key" \
  https://app.uselamina.ai/v1/apps/{appId}

# 3. Execute
curl -X POST \
  -H "x-api-key: lma_your_api_key" \
  -H "Content-Type: application/json" \
  -d '{
    "inputs": {
      "Front": "https://example.com/front.jpg",
      "Location": "Studio"
    }
  }' \
  "https://app.uselamina.ai/v1/apps/{appId}/runs?webhook=https://your-server.com/callback"
```

You choose the app, inspect its schema, provide exact inputs. Full control over every parameter.

Both paths produce the same execution object, the same output structure, and the same delivery options. The difference is who does the thinking — your code or the engine.

## The Execution Lifecycle

Every creation in Lamina — whether started via `content/create` or `apps/{appId}/runs` — follows the same lifecycle:

<Steps>
  <Step title="Queued">
    The execution is accepted and waiting for capacity. You receive a run ID immediately.
  </Step>

  <Step title="Running">
    The workflow nodes are executing. For multi-step apps, individual nodes complete in sequence or parallel.
  </Step>

  <Step title="Completed or Failed">
    Terminal state. Outputs resolve from `pending` placeholders to concrete `image`, `video`, or `text` values.
  </Step>
</Steps>

Four ways to get results:

| Method            | When to use                                                                         |
| ----------------- | ----------------------------------------------------------------------------------- |
| **Wait endpoint** | Simplest. `GET /v1/runs/{id}/wait` blocks until done. Best for agents.              |
| **SSE stream**    | Real-time progress. `GET /v1/runs/{id}/stream` sends events as nodes complete.      |
| **Webhook**       | Production workloads. Pass `?webhook=<url>` at execution time. Signed with ED25519. |
| **Polling**       | Fallback. Poll `GET /v1/runs/{id}` every 3-5 seconds.                               |

See [Handle Long-Running Executions](/guides/handle-long-running-executions) for implementation patterns.

## Intelligence Layer

The intelligence endpoints are the editorial brain of the engine. They make creation smarter over time.

| Endpoint                               | What it provides                                                   |
| -------------------------------------- | ------------------------------------------------------------------ |
| `GET /v1/intelligence/brand-context`   | Brand DNA, visual guidelines, tone, creative constraints           |
| `POST /v1/intelligence/predict`        | Performance prediction before you publish                          |
| `GET /v1/intelligence/recommendations` | Actionable content suggestions based on brand and performance data |
| `GET /v1/intelligence/trends`          | Trend signals for your categories                                  |

When you use `POST /v1/content/create`, the engine queries brand context automatically and injects it into the execution. When you use the step-by-step path, you can fetch brand context yourself and use it to inform your input choices.

Intelligence is what separates a creative engine from a model proxy. The engine knows your brand, predicts what will perform, and recommends what to create next.

## Distribution Layer

Channels are connected publishing destinations — social accounts, CDN endpoints, storage targets.

| Endpoint                             | What it does                                    |
| ------------------------------------ | ----------------------------------------------- |
| `GET /v1/publishing/channels`        | List connected social accounts and destinations |
| `POST /v1/publishing/publish`        | Publish content to one or more channels         |
| `POST /v1/publishing/transfer-asset` | Transfer assets to external CDN or storage      |
| `GET /v1/publishing/history`         | View publish history and job status             |

The pattern is the same as a headless CMS delivering to frontends: your content is created once, stored as structured data, and delivered to any channel from one API. No per-channel integration work on your side.

## What This Means For Agents

The Creative Engine is designed for programmatic consumption. If you are building an agent — whether with Claude, GPT, LangChain, or your own orchestrator — the API gives you:

* **Schema-first discovery.** Every app has a typed input contract you can inspect at runtime. No guessing.
* **Async-native execution.** Executions return immediately. Results arrive via webhook, SSE, wait endpoint, or polling.
* **Intelligence grounding.** Brand context and performance data are API-accessible. Your agent can make informed creative decisions, not blind ones.
* **One-call creation.** `POST /v1/content/create` goes from a text brief to a finished asset without manual app selection or input mapping.
* **Structured outputs.** Every result is typed (`image`, `video`, `text`) with a stable schema. Parse once, handle every app.

If you are building an agent, start with [Create Content](/api-reference/create-content). If you are building a product integration, start with [Quick Start](/quick-start).
