> ## 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.

# Migrate from api.video

> Move an api.video library to Rendermate: download each video, make it a document with a link, and replace player, HLS and thumbnail URLs, private videos, upload tokens, captions and webhooks, step by step.

An api.video video is a file you uploaded, encoded and delivered from the URLs in its `assets`. In
Rendermate, a video plays from a [document](https://rendermate.com/docs/documents.md) through a link: the document holds the
video as a `media` node, and the link gives it a page, an embed, HLS playback, thumbnails and
storyboards. This guide moves an api.video library over in the order you'd do it: the files first,
then playback, then uploads and events.

***

## (1) How do I get my videos out of api.video?

Import each video's MP4 into your workspace. A video's `assets.mp4` is its MP4 when the video has
`mp4Support`; turn it on with `PATCH /videos/{videoId}` and `{"mp4Support": true}` for videos
that don't have it. Then import the file with `import_asset` (`POST /v1/imports`), named after the
video:

```bash theme={null}
curl https://api.rendermate.com/v1/imports \
  -H "Authorization: Bearer $RENDERMATE_API_KEY" \
  --json '{ "url": "'$MP4_URL'", "name": "library/'$VIDEO_ID'.mp4" }'
```

For a private video, read the video again with `GET /videos/{videoId}` for a fresh private token in
its URLs just before you import. An import takes files up to 5 GB; call `get_import` until its
status is `succeeded`. To move a whole library, page through `GET /videos` with `currentPage` and
`pageSize`, and do this for each video.

***

## (2) How do I make each video playable?

Create a document that plays the file from start to end, then make a link to it.

### (A) Let your coding agent move the library

Connect your agent to `https://api.rendermate.com/mcp` ([Claude Code](https://rendermate.com/docs/mcp/claude-code.md),
[Cursor](https://rendermate.com/docs/mcp/cursor.md)) with your api.video key in its environment. It lists your videos, imports
each file, and calls `create_document` and `create_link` for it, following the steps below.

### (B) Create the documents with the API

Create a document with `create_document` (`POST /v1/documents`), with the video's `title` as its
`name`, then commit its nodes with `edit_document` (`POST /v1/documents/{id}/versions`).
[How do I edit a document?](https://rendermate.com/docs/documents.md#how-do-i-edit-a-document) shows the request. In the same
edit, set the `canvas`'s `width`, `height`, `duration` and `frameRate` from the video's
`encoding.metadata` in `GET /videos/{videoId}/status`, and add one `media` node that runs the whole
video:

```jsx theme={null}
export const assets = {
  media: [{id: "video", source: {type: "uri", uri: "asset://library/VIDEO_ID.mp4"}}],
};

// Inside <timeline>:
<media
  id="video"
  common={{start: 0, duration: 63.48, order: "a0"}}
  assetId="video"
  destination={{x: 0, y: 0, width: 1920, height: 1080}}
  fit="contain"
  sampling={{filter: "linear", mipmap: "linear"}}
/>
```

The video plays its own sound. Then call `create_link`
(`POST /v1/documents/{id}/links`): the link works as soon as it's made, and its segments render as
they're first watched.

### How do api.video's videos map?

| api.video | | Rendermate |
| - | - | - |
| A video (`videoId`) | → | A document with the video as a `media` node, and a link to it |
| `title` | → | The document's `name`, or the link's `name` |
| `tags`, `metadata` | → | Your own record of the document's `id` |
| `public: true` | → | A link without a password |
| `public: false` and private tokens | → | A link with a `password` or `expires_at`, or the signed URLs `get_link_playback` answers |
| `clip` with `startTimecode` and `endTimecode` | → | The `media` node's `sourceIn` and `common.duration`, in seconds |
| A `watermark` with `top`, `left`, `width`, `height` and `opacity` | → | A `<media>` node from `assets.images` on top, with the same pixels and `common.opacity` |
| A player theme (`playerId`) | → | The link's `autoplay` and `controls` |
| `DELETE /videos/{videoId}` | → | `revoke_link`, and `delete_asset` for the file |

***

## (3) How do I replace player and HLS URLs?

Read a link's URLs from `get_link` and `get_link_playback`, and put them where your code used a
video's `assets`:

| api.video | | Rendermate |
| - | - | - |
| `assets.iframe`, `embed.api.video/vod/{videoId}` | → | The link's `embed_url` |
| `assets.player` | → | The link's `url`, a page that plays the video |
| `assets.hls` | → | `get_link_playback`'s `playlist_url`, signed until its `expires_at` |
| `assets.thumbnail` | → | `poster_url`, with `time`, `width` and `height` in its query |
| `PATCH /videos/{videoId}/thumbnail` with a `timecode` | → | `poster_url` with `time` set to those seconds |
| `assets.mp4` | → | `create_export`'s `download_url` (step 5) |
| A private session (`avh`) | → | A link with a password: viewers unlock it once on its page |
| A custom domain | → | [Custom domains](https://rendermate.com/docs/custom-domains.md) for the link's pages |

The api.video player SDK, hls.js and native players play any HLS playlist, so `playlist_url` works
in them as it is; ask `get_link_playback` again for new URLs before `expires_at`. A link also has a
`storyboard_url` for scrubbing previews, and `poster_url` with `thumbnail.jpg` changed to
`animated.gif` gives a few seconds as a GIF.

***

## (4) How do I replace upload tokens?

| api.video | | Rendermate |
| - | - | - |
| `POST /upload-tokens` with `ttl` | → | `create_upload_token` (`POST /v1/upload-tokens`) with `expires_in`, 60 to 86400 seconds, and a `prefix` such as `uploads/u_42/` |
| `POST /upload?token=…` | → | `PUT /v1/assets/{name}` with the token |
| `Content-Range` chunks | → | Parts: files over 100 MiB upload in parts, each to its own URL |
| `POST /videos` with a `source` URL | → | `import_asset` (`POST /v1/imports`) |

An upload token only records assets whose names start with its prefix, up to its `max_size`, so a
browser uploads without ever holding your API key. Your code creates the document and link when
the `asset.created` webhook arrives.

***

## (5) How do I move captions, summaries and downloads?

| api.video | | Rendermate |
| - | - | - |
| `transcript: true` and generated captions | → | A transcription model, such as `assemblyai/universal-2`, then `text` nodes in the document |
| `POST /videos/{videoId}/captions/{language}` with a WebVTT file | → | A `text` node per cue, from its start to its end |
| `language` | → | The transcription model's `language` param, detected when absent |
| `mp4Support` and `assets.mp4` | → | `create_export` (`POST /v1/exports`), then `get_export`'s `download_url` |

Call a model through `create_generation` (`POST /v1/generations`), at the provider's own price. A
transcript has every word with its start and end time; write each line as a `text` node starting
at its first word, and commit it as a new version of the video's document. A link that follows
`latest` plays the captioned version once you commit it. [Models](https://rendermate.com/docs/models.md) lists every model.

### How do webhooks map?

| api.video | | Rendermate |
| - | - | - |
| `POST /webhooks` with `events` and `url` | → | [Webhooks](https://rendermate.com/docs/webhooks.md), set up in the dashboard |
| `video.encoding.quality.completed` | → | `asset.created` for the file; links play once they're made |
| `video.caption.generated` | → | `generation.succeeded` for the transcript |
| `X-Api-Video-Signature` | → | The signature [Webhooks](https://rendermate.com/docs/webhooks.md) shows how to verify |

***

## (6) How do I switch over?

### (A) All at once

For a small library, move every video, check a few links on the devices you support, then switch
your code from `assets` URLs to link URLs in one release.

### (B) Newest videos first

For a large library, keep playing older videos from api.video while new ones go to Rendermate:

1. Send new uploads to an upload token, and create a document and a link for each.
2. Move older videos in batches, newest first, and store each video's link ID next to its
   `videoId`.
3. Switch each page to the link's URLs once its video has moved.
4. Delete the videos from api.video when nothing plays them anymore.

***

## Next steps

* [Documents](https://rendermate.com/docs/documents.md): edit a video, add text and captions, and keep every version.
* [Custom domains](https://rendermate.com/docs/custom-domains.md): serve link pages on your own domain.
* [Webhooks](https://rendermate.com/docs/webhooks.md): verify and handle `asset.created` and `export.succeeded`.


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