# How to build your own video editor

> Build the part your users see and let cuttingfloor’s REST API be the engine. Each button in your editor is one call (split, trim, caption, add music, export), the server keeps every version of the timeline and renders the frames and the MP4, and timeline.get hands you the whole edit as JSON to draw.

Canonical: https://cuttingfloor.ai/guides/build-your-own-video-editor · Updated: 2026-11-28 · Index: https://cuttingfloor.ai/llms.txt

## How

1. **Draw the editor, keep the key on your server.** The player, the timeline and the buttons are yours. A thin backend holds the API key and forwards each action to POST /v1/<tool>; users upload straight to a media.upload URL.
2. **Map each button to one tool.** Split is clip.split, trim is clip.trim, a caption is caption.add, a fade is audio.fade, speed is clip.set_speed, and edit.batch applies many edits in one call. Each returns a new timeline_id: undo and redo move between ids, and timeline.history lists them.
3. **Draw the timeline and the preview.** timeline.get returns tracks and clips with times in frames, to draw as your timeline. render.frames gives pictures for the playhead and thumbnails; a short export with the mp4_h264_fast preset plays a range with sound.
4. **Export.** export.video renders the timeline as MP4, ProRes, GIF, WAV or MP3, and export.timeline writes FCPXML, OTIO, EDL, SRT or VTT. job.get waits for the render and gives the download link.

## What to type

```
Build me a web video editor on the cuttingfloor REST API (OpenAPI spec: https://api.cuttingfloor.ai/openapi.json), with the key in CUTTINGFLOOR_KEY on the server only. Upload a video, draw its timeline from timeline.get, add buttons for split, trim, captions from the transcript and music, show the frame under the playhead with render.frames, undo by going back to the previous timeline_id, and an Export button that shows the download link.
```

## Call it

### REST API in your app

Call cuttingfloor from your own product like any other web service: your backend sends POST https://api.cuttingfloor.ai/v1/<tool> with the arguments as JSON and gets the result back as JSON, with real HTTP status codes when a call is refused. Long work (imports, renders, exports) answers at once with a job_id that job.get waits on. The OpenAPI spec feeds code generators and API clients.

```
curl https://api.cuttingfloor.ai/v1/timeline.create \
  -H 'Authorization: Bearer cf_…' \
  -H 'Content-Type: application/json' \
  -d '{"name": "First edit", "sequence": {"width": 1080, "height": 1920, "fps": {"num": 30, "den": 1}}}'
```

### Code execution

An LLM writes code that calls the same API from a sandbox, and chains many edits in one run instead of spending a turn on each tool call. It reads only the tools it needs rather than loading every tool’s schema, and keeps big results in variables instead of its context. The sandbox only has to reach https://api.cuttingfloor.ai with your key.

```
import os, requests

API = "https://api.cuttingfloor.ai/v1"
KEY = os.environ["CUTTINGFLOOR_KEY"]

def cf(tool, **args):
    r = requests.post(f"{API}/{tool}", json=args,
        headers={"Authorization": f"Bearer {KEY}"})
    body = r.json()
    if not r.ok:
        raise RuntimeError(body.get("hint") or body["message"])
    return body

t = cf("timeline.create", name="First edit",
    sequence={"width": 1080, "height": 1920,
              "fps": {"num": 30, "den": 1}})
print(t["timeline_id"])
```

- [How to connect](https://cuttingfloor.ai/how-to-connect#builders)

## Do I have to build the rendering myself?

No. The server decodes, applies effects, mixes and renders, with FFmpeg and MLT inside its Docker image. Your editor sends edits and gets back pictures, sound and finished files.

## How does undo work?

Timelines never change: every edit returns a new timeline_id and the old ones stay valid, so undo is showing the previous id and redo is the next. timeline.history lists the versions and timeline.diff says what changed between two.

## Can an AI assistant in my editor make edits too?

Yes. The assistant’s model can write code that calls the same REST API in a sandbox (code execution), chaining many edits in one run, on the same timelines your buttons edit.

## How long are timelines and files kept?

On the hosted server, media and exports are kept 7 days, timelines 24 hours after last use. To keep a project longer, store the timeline.get document on your side and bring it back with timeline.load.

## What does it cost?

Editing is free: every import, edit, preview and export, as many times as you like. Each export gives a free review copy with a cuttingfloor watermark and a clean copy that spends credits once, when it is first opened or released with export.release, priced by the video’s length. A new account gets 3 credits when you activate it; after that, credit packs that never expire, on the pricing page.

## Is it open source?

Yes. cuttingfloor is open source and ships as one Docker image, the same server as the hosted one with the same REST API and OpenAPI spec. See Run it yourself (/self-host).
