# editor.media.add

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

> Adds a Library item or a file to the open project, on the timeline or only into its media.

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

The file is read in the background, so the answer comes at once. Without `at_ms`, it goes at the end of the main track. Without a project open, a new one is made.

## Parameters

| Name | Type | Required | Description |
|---|---|---|---|
| `item` | `string` | no | A Library item's id or title. |
| `file` | `string` | no | A file's path, instead of `item`. |
| `at_ms` | `number` | no | A moment on the canvas's timeline. Default: the playhead. |
| `track` | `number` | no | A track's index. |
| `keep` | `boolean` | no | Only into the media, not on the timeline. |
| `canvas` | `string` | no | A canvas's id or name, shown first. Default: the canvas shown. |

## Result

| Name | Type | Required | Description |
|---|---|---|---|
| `adding` | `string` | no | The item's title or the file's path. |

## Errors

Invalid params (-32602) without `item` or `file`. Not found (-32004) for a file or Library item that isn't there.

## Events

- `editor.changed`

## From an AI agent

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

## Example

```json
{ "jsonrpc": "2.0", "id": 1, "method": "editor.media.add", "params": { "file": "/Users/sam/Movies/intro.mp4", "keep": true } }
```

Result:

```json
{ "adding": "/Users/sam/Movies/intro.mp4" }
```

## Related

- [editor.media.list](https://docs.lightair.app/developers/remote-api/editor.media.list.md)
- [editor.clip.add](https://docs.lightair.app/developers/remote-api/editor.clip.add.md)
