# Preview scene frames

URL: https://clippie.ai/developers/docs/preview-scene

Checks your scene file and draws the frames you ask for (up to 12 a call), so you can look at each shot against the words said over it. Returns the pictures, compile and type errors with line numbers, and the engine's notes per frame (who is in frame and how large, BLOCKED when something hides a face, NO FACE IN FRAME). Send `code` to preview new code; leave it out to wait for a preview that is still drawing. Look at the middle frame of every shot, fix, preview the changed shots again. Free within the project, which has 60 previews and renders in all (project.requestsLeft is what remains).

## At a glance

| Property | Value |
| --- | --- |
| REST | `POST https://api.clippie.ai/v1/scene-projects/:projectId/preview` |
| MCP tool | `preview_scene` |
| Scope | `create` |
| Cost | Spends nothing. Needs the `create` scope. |
| Limit bucket | `preview` (see [Rate limits](https://clippie.ai/developers/docs.md#rate-limits)) |

## Parameters

| Name | In | Type | Required | Default | Description |
| --- | --- | --- | --- | --- | --- |
| `projectId` | path | string | Yes |  | The scene project (sceneProjectId from create_scene_project). 1-80 chars. |
| `code` | body | string | No |  | The whole scene file (TypeScript, up to 100 KB): it imports only "../scene" and "./words.json" and ends with `export default episode<P>({ ... })`. Leave out to use the file sent last. Up to 100000 chars. |
| `frames` | body | array of integer | No | `[]` | Frame numbers to draw (30 a second; a word's frame is in the project's word list). Needed with code. Up to 12 items. |
| `waitSeconds` | body | integer | No | `45` | Wait up to this long for the frames. 0-50. |

## Example

curl:

```bash
curl https://api.clippie.ai/v1/scene-projects/PROJECT_ID/preview \
  -H "Authorization: Bearer $CLIPPIE_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{}'
```

preview-scene.mjs:

```js
const auth = { Authorization: `Bearer ${process.env.CLIPPIE_API_KEY}` };

const res = await fetch('https://api.clippie.ai/v1/scene-projects/PROJECT_ID/preview', {
  method: 'POST',
  headers: { ...auth, 'Content-Type': 'application/json' },
  body: JSON.stringify({}),
});
if (!res.ok) throw new Error((await res.json()).error.message);
console.log(await res.json());
```

## Response

`200` with JSON. The full response schema is in the [OpenAPI spec](https://api.clippie.ai/v1/openapi.json).

## From an MCP client

Your AI calls `preview_scene` with the same fields as JSON arguments. See [MCP server](https://clippie.ai/developers/docs.md#mcp) to connect one.

tools/call:

```json
{
  "name": "preview_scene",
  "arguments": {
    "projectId": "PROJECT_ID"
  }
}
```
