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

# Attach a thumbnail or GIF to an uploaded demo

Uploads a locally generated PNG thumbnail or animated GIF for a demo created via local-upload, enabling social unfurls and the /thumb and /gif shortcut URLs. Generated demos receive these assets from the recording pipeline and reject this endpoint.

` POST /api/v1/demos/{id}/local-assets `

Attach a thumbnail or GIF to an uploaded demo

Uploads a locally generated PNG thumbnail or animated GIF for a demo created via local-upload, enabling social unfurls and the /thumb and /gif shortcut URLs. Generated demos receive these assets from the recording pipeline and reject this endpoint.

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

- ` cookieAuth `: ` apiKey `

  - Credential: ` better-auth.session_token ` in ` cookie `

  - Dashboard session cookie.

## Parameters

### ` id ` (path, required)

- ` value `: type ` string `

### ` type ` (query, required)

- ` value `: type ` string `

  - enum: ` ["thumbnail","gif"] `

## Request body (optional)

Content type: ` image/png `

- ` value `: type ` string `; format ` binary `

## Responses

### ` 201 ` — Asset attached

Content type: ` application/json `

- ` value `: type ` object `

  - Required fields: ` id `, ` type `, ` url `

  - ` id `: type ` string `

  - ` type `: type ` string `

    - enum: ` ["thumbnail","gif"] `

  - ` url `: type ` string ` — Public shortcut URL (/thumb/:id.png or /gif/:id.gif).

### ` 400 ` — Validation error or demo is not an uploaded demo

Content type: ` application/json `

- ` value `: type ` object `

  - Required fields: ` error `

  - ` error `: type ` string `

### ` 401 ` — Unauthorized

Content type: ` application/json `

- ` value `: type ` object `

  - Required fields: ` error `

  - ` error `: type ` string `

### ` 403 ` — Publishable keys cannot upload assets

Content type: ` application/json `

- ` value `: type ` object `

  - Required fields: ` error `

  - ` error `: type ` string `

### ` 404 ` — Demo not found

Content type: ` application/json `

- ` value `: type ` object `

  - Required fields: ` error `

  - ` error `: type ` string `

### ` 411 ` — Content-Length required

Content type: ` application/json `

- ` value `: type ` object `

  - Required fields: ` error `

  - ` error `: type ` string `

### ` 413 ` — Asset too large (5 MB thumbnail / 25 MB GIF)

Content type: ` application/json `

- ` value `: type ` object `

  - Required fields: ` error `

  - ` error `: type ` string `

### ` 415 ` — Wrong media type or body is not a valid PNG/GIF

Content type: ` application/json `

- ` value `: type ` object `

  - Required fields: ` error `

  - ` error `: type ` string `

### ` 429 ` — 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/demos/string/local-assets?type=thumbnail' \
  -H 'Authorization: Bearer YOUR_API_TOKEN' \
  -H 'Content-Type: application/json' \
  -d '"string"'
```

### JavaScript

```javascript
const response = await fetch('https://littledemo.com/api/v1/demos/string/local-assets?type=thumbnail', {
  method: 'POST',
  headers: {
      "Authorization": "Bearer YOUR_API_TOKEN",
      "Content-Type": "application/json"
  },
  body: JSON.stringify("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/demos/string/local-assets?type=thumbnail', headers=headers, json="string")
print(response.json())
```