# object.add

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

> Adds an object to a scene: a new source of a kind you name, or an existing source shown again.

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

Without `x`, `y`, `width` and `height` the object is centred and fitted inside each canvas (never made larger than its own size), in front of the others. Given ones apply to every canvas, in canvas pixels. Without `scene`, it goes into the scene being edited.

| `kind` | `settings` |
|---|---|
| `text` | `text` |
| `image` | `file` (a path, needed) |
| `video` | `local_file` (a path, needed), `looping` (on by default) |
| `color` | `color` (0xAARRGGBB as a number), `width`, `height` (the canvas's by default) |
| `browser` | `url` (needed), `width`, `height` (1920 × 1080 by default), `css` |
| `display`, `window`, `app` | `display`, `window` or `app`: a value from [capture.targets](/developers/remote-api/capture.targets); a display defaults to the main one |
| `camera` | `device` from capture.targets (the first camera by default) |
| `microphone` | `device`: adds a sound source and its track, with no object |
| `timer` | `seconds` (a 300-second countdown by default) |
| `phone_camera` | none: a Phone camera layer, paired from Lightair Live |
| `widget` | `widget`: one of Lightair's widgets (`scoreboard`, `lower-third`, `captions`, …); or `package` (an installed package's id) and `widget` (its widget's name or folder, from [packages.list](/developers/remote-api/packages.list)) |

Any other kind is taken as a source kind id, with its settings as given.

## Parameters

| Name | Type | Required | Description |
|---|---|---|---|
| `kind` | `string` | no | What to add (the table). Needed unless `source` is given. |
| `source` | `string` | no | An existing source's id or name, to show it again. |
| `scene` | `string` | no | The scene's id or name. |
| `name` | `string` | no | The object's name. |
| `settings` | `object` | no | The new source's settings. |
| `x` | `number` | no | Left edge, canvas pixels. |
| `y` | `number` | no | Top edge, canvas pixels. |
| `width` | `number` | no | Width, canvas pixels. |
| `height` | `number` | no | Height, canvas pixels. |

## Result

| Name | Type | Required | Description |
|---|---|---|---|
| `scene` | `string` | no | The scene's id. |
| `object` | `string` | no | The new object's id. |
| `source` | `string` | no | Its source's id. |
| `track` | `string | null` | no | The mixer track made for its sound, if it has any. |
| `name` | `string` | no | Its name. |

## Errors

Invalid params (-32602) without `kind` or `source`, or without a setting the kind needs. Not found (-32004) for an unknown scene, source or package widget. A state error (-32005) for a camera when no camera is found.

## Events

- `workspace.changed`

## From an AI agent

The MCP server's `add_object` reaches this method.

## Example

```json
{ "jsonrpc": "2.0", "id": 1, "method": "object.add", "params": { "kind": "text", "settings": { "text": "Back soon" }, "scene": "Break" } }
```

Result:

```json
{ "scene": "019ad3f2-6c1e-7a40-9b52-3f1d2e8c4a10", "object": "019ad3f4-1a2b-7c3d-8e4f-5a6b7c8d9e0f", "source": "019ad3f4-2b3c-7d4e-9f50-6b7c8d9e0f1a", "track": null, "name": "Back soon" }
```

## Related

- [capture.targets](https://docs.lightair.app/developers/remote-api/capture.targets.md)
- [object.update](https://docs.lightair.app/developers/remote-api/object.update.md)
- [audio.add](https://docs.lightair.app/developers/remote-api/audio.add.md)
