# editor.canvases.add

Source: https://docs.lightair.app/developers/remote-api/editor.canvases.add

> Adds a canvas to the open project, empty or as a copy of another refitted to its size, and shows it.

JSON-RPC 2.0 method of Lightair's Remote API (ws://localhost:4455/rpc). Group: Editor. Script plugins need the `project.write` permission.

A copy without `size` is a duplicate at its own size, named "*Name* copy". Without `copy_of`, `size` is needed.

## Parameters

| Name | Type | Required | Description |
|---|---|---|---|
| `size` | `[number, number] | string` | no | [width, height], or `landscape`, `vertical`, `square`, `portrait`. |
| `name` | `string` | no | Its name. |
| `copy_of` | `string` | no | A canvas to copy, refitted to fill the new size. |

## Result

| Name | Type | Required | Description |
|---|---|---|---|
| `id` | `string` | no | The new canvas's id. |

## Errors

Invalid params (-32602) without `size` or `copy_of`. Not found (-32004) for an unknown canvas. A state error (-32005) when no Editor project is open, or the open one is read-only because a newer Lightair made it.

## Events

- `editor.changed`

## From an AI agent

The MCP server's `editor_canvases (action: add)` reaches this method.

## Example

```json
{ "jsonrpc": "2.0", "id": 1, "method": "editor.canvases.add", "params": { "copy_of": "Landscape", "size": "vertical" } }
```

Result:

```json
{ "id": "019ad3f0-0a1b-7c2d-8e3f-4a5b6c7d8e9f" }
```

## Related

- [editor.canvases.list](https://docs.lightair.app/developers/remote-api/editor.canvases.list.md)
- [editor.canvas.set](https://docs.lightair.app/developers/remote-api/editor.canvas.set.md)
