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

# Generate or reuse a demo for a dynamic embed

Used by sdk.js with a publishable key. A live API key is also accepted for server-side integrations.

` POST /api/v1/embed/generate `

Generate or reuse a demo for a dynamic embed

Used by sdk.js with a publishable key. A live API key is also accepted for server-side integrations.

## Servers

- ` https://littledemo.com ` — Production

## Authentication

The operation accepts these alternatives. Schemes within one alternative are required together.

### Alternative 1

- ` bearerAuth `: ` http `

  - HTTP scheme: ` bearer `

  - Live API key, for example `Authorization: Bearer ld_live_...`.

### Alternative 2

- ` apiKeyAuth `: ` apiKey `

  - Credential: ` X-API-Key ` in ` header `

  - Live or publishable API key, for example `ld_live_...` or `ld_pub_...`.

## Request body (optional)

Content type: ` application/json `

- ` value `: type ` object `

  - ` project_id `: type ` string `

  - ` prompt `: type ` string `

    - minLength: ` 1 `

    - maxLength: ` 500 `

  - ` template `: type ` string ` — Optional recording template hint such as auto, guided-tour, pricing-focus, or proof-scroll.

  - ` section `: type ` string ` — Optional section hint for section-focused or auto-selected recordings.

    - minLength: ` 1 `

    - maxLength: ` 120 `

  - ` presentation `: type ` object ` — Optional presentation config override, including recordingTemplate.

  - ` context `: type ` object `

    - ` url `: type ` string `; format ` uri `

    - ` title `: type ` string `

      - maxLength: ` 200 `

    - ` headings `: type ` array `

      - ` array item `: type ` string `

        - maxLength: ` 200 `

    - ` description `: type ` string `

      - maxLength: ` 500 `

## Responses

### ` 200 ` — Existing demo reused

Content type: ` application/json `

- ` value `: type ` object `

  - Required fields: ` demoId `, ` status `, ` embedUrl `, ` cached `

  - ` demoId `: type ` string `

  - ` status `: type ` string `

  - ` embedUrl `: type ` string `

  - ` cached `: type ` boolean `

### ` 202 ` — Demo generation started

Content type: ` application/json `

- ` value `: type ` object `

  - Required fields: ` demoId `, ` status `, ` embedUrl `, ` cached `

  - ` demoId `: type ` string `

  - ` status `: type ` string `

  - ` embedUrl `: type ` string `

  - ` cached `: type ` boolean `

### ` 400 ` — Missing project_id or invalid request

Content type: ` application/json `

- ` value `: type ` object `

  - Required fields: ` error `

  - ` error `: type ` string `

### ` 401 ` — API key required

Content type: ` application/json `

- ` value `: type ` object `

  - Required fields: ` error `

  - ` error `: type ` string `

### ` 404 ` — Project not found

Content type: ` application/json `

- ` value `: type ` object `

  - Required fields: ` error `

  - ` error `: type ` string `

### ` 429 ` — Quota or rate limit exceeded

Content type: ` application/json `

- ` value `: type ` object `

  - Required fields: ` error `

  - ` error `: type ` string `

## Request examples

### cURL

```curl
curl -X POST 'https://littledemo.com/api/v1/embed/generate' \
  -H 'Authorization: Bearer YOUR_API_TOKEN' \
  -H 'Content-Type: application/json' \
  -d '{
  "project_id": "string",
  "prompt": "string",
  "template": "string",
  "section": "string",
  "presentation": {},
  "context": {
    "url": "https://example.com",
    "title": "string",
    "headings": [
      "string"
    ],
    "description": "string"
  }
}'
```

### JavaScript

```javascript
const response = await fetch('https://littledemo.com/api/v1/embed/generate', {
  method: 'POST',
  headers: {
      "Authorization": "Bearer YOUR_API_TOKEN",
      "Content-Type": "application/json"
  },
  body: JSON.stringify({
    "project_id": "string",
    "prompt": "string",
    "template": "string",
    "section": "string",
    "presentation": {},
    "context": {
      "url": "https://example.com",
      "title": "string",
      "headings": [
        "string"
      ],
      "description": "string"
    }
  })
});

const data = await response.json();
console.log(data);
```

### Python

```python
import requests

headers = {
    'Authorization': 'Bearer YOUR_API_TOKEN'
}

response = requests.post('https://littledemo.com/api/v1/embed/generate', headers=headers, json={
  "project_id": "string",
  "prompt": "string",
  "template": "string",
  "section": "string",
  "presentation": {},
  "context": {
    "url": "https://example.com",
    "title": "string",
    "headings": [
      "string"
    ],
    "description": "string"
  }
})
print(response.json())
```