create_document
Create a document: a video edit with versions, like a git repository. Starts empty (10 seconds of 1920x1080 at 30 fps), or from a whole document written as JSX: export default (<timeline canvas={{...}} schemaVersion={...}>...</timeline>), where each node is an element whose tag is its type, with an id, its fields as attributes and its children inside. Times are seconds, colours “#rrggbb”, and Doc.keys([seconds, value, easing], …) is a keyframe curve. The JSX get_document returns starts with a comment that explains the whole notation (https://rendermate.com/docs/documents). Write the document out whole, without Doc.cut or Doc.more. edit_document’s description shows how to write each kind of node and asset. To start from scratch, create the document empty, then edit it with jsx: the whole document, keeping the canvas get_document returned.
REST: POST /v1/documents
A UUID that makes the create safe to send again: sent again with the same one, it answers with the document it made instead of making another. The
Idempotency-Key header does the same.The whole document to start from, written as JSX (https://rendermate.com/docs/documents):
export default (<timeline canvas={{…}}>…</timeline>). When absent, the document starts empty: 10 seconds of 1920×1080 at 30 fps.create_preview
A live preview page of a version or alias of a document, for showing a person. A version’s preview never changes; an alias’s follows it as it moves. The URL works for 12 hours.
REST: POST /v1/documents/{document_id}/previews
delete_alias
Remove an alias from a document. The versions stay; links that follow the alias stop playing.
REST: DELETE /v1/documents/{document_id}/aliases/{alias} · destructive, idempotent
delete_document
Delete a document with its whole history, aliases and links. Its links stop playing. This can’t be undone.
REST: DELETE /v1/documents/{document_id} · destructive, idempotent
edit_document
Change a document by committing an edit on base_version, which makes a new version. Give edits, exact replacements in the JSX get_document returned for base_version: each old_text must occur exactly once, spaces and line breaks included (copy it from that JSX, and include the node’s id=”…” to make it unique), and they apply in order. Or give jsx, the whole edited document: do that to add the first nodes to an empty document, whose <timeline ... /> closes itself. Long strings and arrays the JSX cut (Doc.cut, …Doc.more) stay as they are when left in place. If another commit landed after base_version, this fails with version.conflict: read the document again and redo the edit. How to write what most videos need (https://rendermate.com/docs/documents has the rest): - Every node has an id="...", unique and without /, and common={{start: 0, duration: 3, order: "a1"}}: its window in seconds, which may not reach past the canvas’s duration, and its paint order among its siblings ("a0" is under "a1"). - Files are declared before export default, each with an id that nodes use and a workspace asset, uploaded with upload_asset or imported with import_asset first: export const assets = {fonts: [{id: "inter", family: "Inter", weight: 700, style: "normal", source: {type: "uri", uri: "asset://brand/Inter-Bold.ttf"}}], images: [{id: "logo", source: {type: "uri", uri: "asset://brand/logo.png"}}], media: [{id: "intro", source: {type: "uri", uri: "asset://launch/intro.mp4"}}]}; - Text needs a font: a .ttf or .otf asset declared in fonts. <text id="title" common={{start: 0, duration: 3, order: "a3"}} content={{type: "paragraph", text: "Hello world", position: {x: 120, y: 860}, width: 1680, align: "left", style: {fontId: "inter", fontSize: 96, color: "#ffffff"}}} /> - A background colour: <fill id="bg" common={{order: "a0"}} paint={{style: "fill", source: {type: "solid", color: "#10233f"}}} /> - A shape: <shape id="dot" common={{start: 0, duration: 3, order: "a2"}} geometry={{type: "circle", center: {x: 960, y: 540}, radius: 100}} paint={{style: "fill", source: {type: "solid", color: "#ffd84d"}}} />. geometry can also be {type: "rect", rect: {x, y, width, height}} or {type: "oval", rect: {...}}. - A video, or an image from images: <media id="clip" common={{start: 0, duration: 4, order: "a1"}} assetId="intro" destination={{x: 0, y: 0, width: 1920, height: 1080}} fit="cover" sampling={{filter: "linear", mipmap: "linear"}} sourceIn={1} />. fit="contain" fits it inside destination; sourceIn is where in the file it starts, in seconds. - Sound: <audio id="music" common={{start: 0, duration: 6}} assetId="intro" gain={0.3} /> - Animation: a number becomes keyframes, Doc.keys([seconds, value], ...) timed from the node’s start, such as opacity: Doc.keys([0, 0], [0.5, 1]) in common or radius: Doc.keys([0, 20], [3, 120]). - A field the format doesn’t have is refused with jsx.unreadable, whose message says what that place takes.
REST: POST /v1/documents/{document_id}/versions
The version the edit was made on, as get_document returned it: the edit is committed only if that’s still the newest version.
A UUID that makes the commit safe to send again: sent again with the same one, it answers with the version it made instead of making another. The
Idempotency-Key header does the same.Why the document changes, in one line, like a git commit message: “Shorten the intro to 4 seconds”, not “update document”.
fork_document
Copy a document at one version into a new document with its own history, for a variant, an experiment, or a new video from a template. The original doesn’t change.
REST: POST /v1/documents/{document_id}/fork
get_document
Read a document at one version (the latest by default) as JSX, with the version number. The JSX starts with a comment that explains its notation. Read it before editing: edit_document needs that version as its base_version, and its edits replace text in this JSX.
REST: GET /v1/documents/{document_id} · read-only
get_frame
Look at a document: a still image of one moment of a version, rendered as it will play. Use it to check an edit. It’s a render, so it costs credits the first time; the same frame again is free. Each frame is also saved as an asset in the workspace’s renders/ folder.
REST: POST /v1/documents/{document_id}/frames
The moment to show, in seconds from the start. It shows the frame the moment falls in, and a moment past the end shows the last frame.
The image’s width in pixels; the video’s when neither width nor height is given. With only one of them, the other follows the video’s aspect ratio; with both, the image is the largest that fits in them.
list_documents
List the workspace’s documents, newest first, with each one’s latest version.
REST: GET /v1/documents · read-only
list_versions
List a document’s versions, newest first: each one’s number, author, message and time, like git log.
REST: GET /v1/documents/{document_id}/versions · read-only
purge_document
Delete a document’s stored renders, of every version, and clear the CDN’s cached copies of the video, thumbnails, storyboards and GIFs of every link to it, within a minute. The next view renders them again, billed as new renders, except video and audio segments whose content is unchanged and still stored, which are reused. Finished exports of the document stop downloading (404): export again for a new download.
REST: POST /v1/documents/{document_id}/purge · destructive, idempotent
set_alias
Point an alias of a document at a version, creating the alias or moving it. Links that follow the alias play the new version from then on.
REST: PUT /v1/documents/{document_id}/aliases/{alias} · idempotent