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

# Embeds API

Generate or reuse demos for dynamic embeds.

Dynamic embeds use:

```text
POST /api/v1/embed/generate
```

Use a publishable key for browser calls or a live key for server-side calls.

## Request

```bash
curl -X POST https://littledemo.com/api/v1/embed/generate \
  -H "X-API-Key: ld_pub_xxx" \
  -H "Content-Type: application/json" \
  -d '{
    "context": {
      "url": "https://docs.example.com/setup",
      "title": "Setup guide",
      "description": "Create your first workspace",
      "headings": ["Create a workspace", "Invite teammates"]
    },
    "prompt": "Show the setup flow",
    "template": "guided-tour",
    "section": "setup"
  }'
```

## Response

```json
{
  "demoId": "demo_abc123",
  "status": "pending",
  "embedUrl": "https://littledemo.com/embed/demo_abc123",
  "cached": false
}
```

If `cached` is `true`, a matching demo already existed.

## Signed runtime embeds

Trusted platforms can render a runtime iframe with:

```text
GET /api/v1/embed/runtime
```

This endpoint is designed for server-rendered components. Sign the URL with a project signing secret, include a base64url JSON `payload`, and put the signed URL in an iframe.

Common payload fields:

```json
{
  "url": "https://docs.example.com/setup",
  "prompt": "Show the setup flow",
  "template": "guided-tour",
  "autoplay": true,
  "loop": true
}
```

Use `demoId` instead of `url` when you want to render an existing demo.