Skip to main content

apply_video_edits

Use apply_video_edits whenever you need two or more timeline edits. It takes up to 200 mixed operations across any clips in one video, validates the whole request, and applies it as a single editor revision — substantially faster than repeated single-edit calls. For one edit, the standalone tool is still the convenient choice.
All times are milliseconds on the clip’s playback timeline — the video as watched, with cuts applied. It is the same timeline as get_transcript, thumbnails, and previews, so nothing needs converting. A start at or past the end of the clip is rejected with a 400.
string
required
Video ID
object[]
required
1–200 operations, run in array order. Each one carries type, a unique operationId, a clipId, and the same fields as the standalone tool it mirrors.

Supported operations

  • Updates and removes take the target resource ID and the clipId; updates also take only the fields being changed (including transition on media and text overlays).
  • Zoom operations use zoomType for the zoom variant, because type selects the batch operation itself.
  • Cuts, transcript edits, clip settings, and generate_auto_layouts are not batchable.

How a batch runs

  • Results match by operationId. Adds return the created resource ID; updates and removes return the affected one.
  • Later operations can reference earlier adds. Pass an add’s operationId in place of the resource ID — for example, add a zoom and re-time it later in the same batch.
  • Validation is all-or-nothing. Schema, resource existence, timeline bounds, and cross-references are checked upfront. One invalid operation rejects the whole call with invalid_argument naming that operation, before anything is applied.
  • Removed resources stay removed. Removing a resource that doesn’t exist (or was already removed) is an error, and later operations in the batch can no longer target it.
Layout operations accept the same B-roll media field as add_layout and update_layout.
  • A time-ranged add_layout can provide media and omit layout to use the default full-frame B-roll layout. It trims, splits, or removes overlapping layouts to make room, exactly like the standalone call.
  • update_layout can replace either media slot while keeping the other, and can reshape media-bearing layouts.
  • An add without a range sets the clip’s base layout and returns the ID base. update_layout accepts base (or the operationId of a clip-spanning add), but the base layout accepts layout only.

Retrying a batch

Without an idempotency key the call is not idempotent. Re-sending a batch after a success re-applies its adds as new resources, and its removes then fail validation because their targets are already gone — so the retried batch is rejected as a whole.
  • To resend safely after losing a response, include _meta.idempotencyKey and reuse the same key — see Retrying tool calls safely.
  • Otherwise, retry only when the previous call definitely did not apply, such as after a rate limit or a pre-execution unavailable error.
  • A revision in the response is proof the batch landed.

Examples

Two adds on one clip:
A mixed batch — add a zoom, update an existing text overlay, and remove a sound effect in one revision: