# Canvas Export

Export one or more canvases from Tela, optionally including their test cases, applications, and files.

The export endpoint returns a **ZIP file** (not JSON). The `exportCanvas` function returns an `ArrayBuffer` that you save to disk.

## Function

```typescript
tela.exportCanvas(payload: ExportCanvasPayload): Promise<ArrayBuffer>
```

### Parameters

| Field | Type | Required | Description |
|---|---|---|---|
| `promptIds` | `string[]` | Yes | Array of canvas/prompt IDs to export |
| `includeTestCases` | `boolean` | No | Include test cases in the export |
| `includeApplications` | `boolean` | No | Include applications in the export |
| `includeFiles` | `boolean` | No | Include associated files in the export |

## Examples

### Export a single canvas

```bash
bun --preload ~/.claude/skills/tela-studio/preload.ts -e "
const buf = await tela.exportCanvas({
  promptIds: ['CANVAS_ID']
})
await Bun.write('export.zip', buf)
console.log('Saved export.zip (' + buf.byteLength + ' bytes)')
"
```

### Export multiple canvases with all data

```bash
bun --preload ~/.claude/skills/tela-studio/preload.ts -e "
const buf = await tela.exportCanvas({
  promptIds: ['CANVAS_ID_1', 'CANVAS_ID_2'],
  includeTestCases: true,
  includeApplications: true,
  includeFiles: true
})
await Bun.write('export.zip', buf)
console.log('Saved export.zip (' + buf.byteLength + ' bytes)')
"
```

## ZIP Contents

The exported ZIP contains:

```
manifest.json
prompts/<canvas-id>/
  prompt.json
  versions/<version-id>/
    version.json
    messages.json
test-cases/       # if includeTestCases: true
applications/     # if includeApplications: true
files/            # if includeFiles: true
```
