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

# Demos API

Generate, poll, update, refresh, restyle, and delete demos.

## Create a demo

```bash
curl -X POST https://littledemo.com/api/v1/demos \
  -H "Authorization: Bearer ld_live_xxx" \
  -H "Content-Type: application/json" \
  -d '{
    "project_id": "proj_abc123",
    "prompt": "Show creating a workspace and inviting a teammate",
    "format": "mp4",
    "duration_target": "10s",
    "presentation": {
      "recordingTemplate": { "id": "auto" }
    }
  }'
```

## Response

```json
{
  "id": "demo_abc123",
  "status": "pending",
  "jobId": "job_abc123",
  "pollUrl": "/api/v1/demos/demo_abc123",
  "wsUrl": "/api/ws/demo_abc123"
}
```

## Upload a local recording

```bash
curl -X POST "https://littledemo.com/api/v1/demos/local-upload?project_id=proj_abc123&prompt=Show%20the%20checkout%20flow&title=Checkout%20flow&duration_ms=12000&format=mp4" \
  -H "Authorization: Bearer ld_live_xxx" \
  -H "Content-Type: video/mp4" \
  --data-binary @demo.mp4
```

Local uploads accept `video/mp4` and `video/webm` bodies up to 100 MB. WebM uploads require the Starter plan or higher — the Free plan accepts MP4 only. They count as generated demos for quota and become `ready` immediately.

After uploading, attach a poster and animated preview with `POST /api/v1/demos/:id/local-assets?type=thumbnail|gif` (raw `image/png` or `image/gif` body, 5 MB / 25 MB caps). Only uploaded demos accept local assets — generated demos receive them from the recording pipeline.

Uploaded demos cannot be refreshed or restyled. Re-record locally and upload a new video when the source recording changes.

```json
{
  "id": "demo_abc123",
  "status": "ready",
  "jobId": "job_abc123",
  "shareUrl": "https://littledemo.com/d/demo_abc123",
  "embedUrl": "https://littledemo.com/embed/demo_abc123",
  "videoUrl": "https://littledemo.com/api/v1/demos/demo_abc123/video"
}
```

## Poll status

```bash
curl https://littledemo.com/api/v1/demos/demo_abc123 \
  -H "Authorization: Bearer ld_live_xxx"
```

## Refresh

```bash
curl -X POST https://littledemo.com/api/v1/demos/demo_abc123/refresh \
  -H "Authorization: Bearer ld_live_xxx"
```

Refresh re-runs generated demos only. Uploaded demos return a validation error.

## Restyle

```bash
curl -X POST https://littledemo.com/api/v1/demos/demo_abc123/restyle \
  -H "Authorization: Bearer ld_live_xxx" \
  -H "Content-Type: application/json" \
  -d '{
    "presentation": {
      "background": "midnight",
      "recordingTemplate": { "id": "cinematic" }
    }
  }'
```

Restyle is for presentation changes. Create a new demo when the story changes.