> ## Documentation Index
> Fetch the complete documentation index at: https://rendermate.com/docs/llms.txt
> Use this file to discover all available pages before exploring further.

# Documents

> The Rendermate document: a whole video written as JSX, read and edited over the API and MCP.

A Rendermate document describes a whole video: its canvas, the media it uses and every node drawn
or played over time. You read and write it as JSX, one `<timeline>` element whose children are the
nodes. Rendermate renders it to frames, previews, links and MP4 or M4A exports. Documents are versioned:
each edit is a commit that makes a new version, and every version stays readable.

## What does a document look like?

A document is `export default (<timeline …>…</timeline>);`. This one is 2 seconds of 1080p: a red
background with a white dot in the middle.

```jsx theme={null}
export default (
  <timeline
    canvas={{
      alphaMode: "premultiplied",
      colorSpace: "srgb",
      duration: 2,
      frameRate: {denominator: 1, numerator: 30},
      height: 1080,
      ticksPerSecond: 1000,
      width: 1920,
    }}
    schemaVersion={15}
  >
    <shape
      id="background"
      common={{duration: 2, order: "a0", start: 0}}
      geometry={{
        type: "roundedRect",
        rect: {
          bottomLeft: {x: 0, y: 0},
          bottomRight: {x: 0, y: 0},
          rect: {height: 1080, width: 1920, x: 0, y: 0},
          topLeft: {x: 0, y: 0},
          topRight: {x: 0, y: 0},
        },
      }}
      paint={{source: {type: "solid", color: "#ff0000"}, style: "fill"}}
    />
    <shape
      id="dot"
      common={{duration: 2, order: "a1", start: 0}}
      geometry={{type: "circle", center: {x: 960, y: 540}, radius: 100}}
      paint={{source: {type: "solid", color: "#ffffff"}, style: "fill"}}
    />
  </timeline>
);
```

Every document the API returns starts with a comment that explains its notation, so an agent that
reads one has the guide with it.

## How is JSX written in a document?

* **Elements are nodes.** The tag is the node's type, the attributes its fields, and the children
  its children. Every node has an `id` that is unique in the document.
* **Times are seconds**, such as `start: 1.5`. `Doc.ticks(n)` is a time that no number of seconds
  would round to.
* **Colours** are `"#rrggbb"` or `"#rrggbbaa"`, or `Doc.rgb(r, g, b)` and `Doc.rgba(r, g, b, a)`
  of fractions from 0 to 1.
* **Keyframes** are `Doc.keys([seconds, value, easing, id], …)`.
* **Shared animated values** are `const name = value;` before `export default`, read by their name.
* **Arithmetic** on numbers is worked out as it's read: `width={(1920 - 2 * 80) / 3}`.
* **Visibility conditions:** `{a > b && <shape … />}` draws the node while the condition holds.
* **Cut values:** a document as the API returns it shortens long strings to `Doc.cut("start",
  length)` and long arrays with `...Doc.more(n)`. Leave them where they are when you edit, and the
  stored value stays.

## Top level

| Attribute | Required | What it is |
| - | - | - |
| `schemaVersion` | yes | The format version the document is written in, such as `15`. |
| `canvas` | yes | The output: size, frame rate, timebase and length. |
| `assets` | no | The media, fonts and other resources the nodes use, each with an `id`. |
| `curves` | no | Animated values that several nodes share. |
| `markers` | no | Chapters and named moments of the whole video. |

The `<timeline>` element's children are its nodes.

## Canvas and time

`canvas` sets the output's `width` and `height` in pixels, its `frameRate` as a fraction
(`{numerator: 30, denominator: 1}`) and its `duration` in seconds. Times are stored as whole ticks,
and `ticksPerSecond` sets how many make a second; it can't change after a document is created.

## Nodes

Each node has an `id` that is unique in the document, and `common`: its `start`, its `duration` and
its `order` among its siblings. A node shows from `start` for `duration` seconds. Node types
include:

* `media`, `audio`: video and audio from an asset, trimmed and retimed.
* `text`: paragraphs of styled text.
* `shape`, `fill`, `paint`: geometry and paint, such as a rounded rectangle filled with a color or
  gradient.
* `picture`, `svg`, `lottie`, `raster`: still images, vector art and animations.
* `group`, `view`, `fitBox`, `sequence`, `repeat`, `composition`: nodes that hold other nodes,
  lay them out or play them one after another.
* `effect`, `camera`, `light`, `model`, `particles`: effects, 3D and particles.

Nodes can carry masks, effects, transforms, opacity and blend modes, and animate their values with
keyframes.

## Can a document have only sound?

Yes: a document whose nodes are all `audio` or `tone` nodes, alone or inside `group`, `view`,
`fitBox`, `sequence`, `repeat` or `composition` nodes, has only sound. Its canvas still sets its
length and timebase, but nothing is drawn on it. Each version is judged on its own nodes: one node
that draws, anywhere, gives the version a picture.

A version that has only sound:

* plays as audio on its links, whose HLS playlist has an audio stream (AAC, 48 kHz stereo) and no
  video streams;
* exports as an M4A file (`format` `m4a`, the default for it);
* has no frames, thumbnails, storyboards or animated GIFs: asking for one returns 422
  [`document.audio_only`](https://rendermate.com/docs/errors#document.audio_only).

Any version's sound alone exports as an M4A too, with `format` `m4a`.

## Assets

`assets` lists what the nodes use by kind, such as `media`, `images`, `fonts` and `svgs`, each with
an `id` that nodes refer to. A document refers to a file in its workspace as `asset://<name>`; put
files in the workspace first, with the API, the CLI or the MCP server's `upload_asset` and
`import_asset`.

## Can a document load media from a URL?

No: every file a document uses (video, audio, images, fonts and the rest) is a file in its
workspace, with the source `{type: "uri", uri: "asset://<name>"}`. A source that is an
`https://` or other URL, an inline `data:` URI, or any other kind of source is refused with
[`document.media_not_asset`](https://rendermate.com/docs/errors#document.media_not_asset). To use a file on the web, import it
into the workspace with `import_asset` (`POST /v1/imports`); to use a file you have, upload it with
`upload_asset`. Then refer to it as `asset://<name>`.
A name the workspace doesn't have is refused with
[`document.asset_not_found`](https://rendermate.com/docs/errors#document.asset_not_found).

## What happens to a version when I replace an asset?

Nothing: each version keeps the content its assets had when it was committed, and always renders
that, even after the asset is replaced or deleted. Commit a new version to use the asset's new
content.

## How do I create a document?

`POST /v1/documents` (MCP: `create_document`) with the whole document as `jsx`. Without `jsx`, the
document starts empty: 10 seconds of 1920×1080 at 30 fps.

```bash theme={null}
curl https://api.rendermate.com/v1/documents \
  -H "Authorization: Bearer $RENDERMATE_API_KEY" \
  --json '{ "name": "Q3 update", "jsx": "export default (<timeline …>…</timeline>);" }'
```

## How do I edit a document?

Read it with `GET /v1/documents/{id}` (MCP: `get_document`), which returns its `jsx` and its
`version`. Then commit an edit on that version with `POST /v1/documents/{id}/versions` (MCP:
`edit_document`), giving `base_version`, a `message` saying why in one line, and either:

* `edits`: replacements in the JSX you read, made in order. Each `old_text` must occur exactly once
  in the JSX as the edits before it left it; include the node's `id="…"` to make it unique.
* `jsx`: the whole edited document. Every node it keeps keeps its `id`.

```json theme={null}
{
  "base_version": 3,
  "message": "Blue background, bigger dot",
  "edits": [
    { "old_text": "color: \"#ff0000\"", "new_text": "color: \"#1e40af\"" },
    { "old_text": "radius: 100", "new_text": "radius: 160" }
  ]
}
```

If another commit landed after `base_version`, the edit fails with `version.conflict`: read the
document again and redo the edit on its newest version. Send a `commit_id` to make the request safe
to retry.

## How do I see who changed a document, and read an older version?

`GET /v1/documents/{id}/versions` (MCP: `list_versions`) lists a document's history, newest
first, like `git log`. Each version has its `version` number, its `message`, `committed_at`, and
its `author`: the `id` and `name` of the API key or member who made it, `via` (`api`,
`dashboard` or `mcp`) and `client`, the program that sent it from its User-Agent, such as
`claude-code`.

```json theme={null}
{
  "version": 12,
  "message": "Shorten the intro",
  "committed_at": "2026-12-03T10:00:00Z",
  "author": {
    "id": "api_key_…",
    "name": "ci",
    "via": "mcp",
    "client": "claude-code"
  }
}
```

A page holds 50 versions, or up to 100 with `limit`. Pass the response's `next` as `before` for
the page of older versions; the last page has no `next`. Read any version with
`GET /v1/documents/{id}/versions/{version}`, or `get_document` with its `version`.

In the [dashboard](https://rendermate.com/dashboard), **documents** opens a document's history:
each version with its author and message, any version, and what changed between two.

## What happens when a document isn't valid?

Rendermate checks every version it makes. JSX that can't be read is refused with `jsx.unreadable`,
with the line and column. A document that reads but isn't valid is refused with `document.invalid`,
whose `diagnostics` list each problem with its `code`, `message`, and where known the `node_id`,
`asset_id` and `pointer` (a JSON Pointer such as `/canvas/width`). [Errors](https://rendermate.com/docs/errors.md) lists every
code.


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.