Skip to content
中文

Script reference

Pass synchronous JavaScript in the execute request’s script field. These functions are globals: do not import them or use asynchronous operations.

Script functions

Each entry below is also available on its own with codemode.describe("<name>"), or at its anchor on this page.

GetTimeline

GetTimeline(o?: { from?: number; to?: number; tracks?: TrackId[] }): TimelineView
nametypeunitrangedefaultdescription
o.fromnumberseconds>= 00Window start; clips overlapping it are included.
o.tonumberseconds>= fromproject endWindow end; clips overlapping it are included.
o.tracksTrackId[]——all tracksRestrict the read to these tracks.

Returns TimelineView: duration in seconds, tracks, and joins.

Errors NOT_FOUND.

Example

const picture = AddTrack("video", { name: "Picture" });
Insert(picture, { type: "color", color: "#172554", start: 0, length: 3 });
const t = GetTimeline();
Print(t.duration, t.tracks.map((track) => [track.id, track.items.length]));
  • Each track lists its clips under items, not clips — t.tracks[0].items is the array of segments.
  • A track view carries id, kind, name, index, locked and an optional role; each item view carries id, track, type, start, end, length and the optional fields that apply to it.
  • from/to narrow items and joins; joins are selected by their overlap window. duration is always the whole project.
  • Reads see writes made earlier in the same script, so a read after Insert already contains the new clip.
  • Seconds in the view are already frame-snapped; do not add your own rounding.

Agents: codemode.describe("praxis.cut.script.GetTimeline")

GetItem

GetItem(id: ClipId): ItemView
nametypeunitrangedefaultdescription
idClipId———Clip id from Insert or read from GetTimeline().tracks[].items.

Returns ItemView for the clip.

Errors NOT_FOUND.

Example

const id = Insert(AddTrack("video"), { type: "color", color: "#123456", start: 0, length: 3 });
Print(GetItem(id).end);
  • start and end are timeline seconds; length is end - start.
  • sourceIn/sourceOut describe the kept source interval in seconds; sourceOut is exclusive and equals sourceIn for a frozen clip.
  • Use GetTimeline when you need many clips at once: one GetItem per clip costs one command each.

Agents: codemode.describe("praxis.cut.script.GetItem")

FindItems

FindItems<T>(visit: (item: ItemView, ctx: { track: TrackView; index: number }) => T | undefined): T[]
nametypeunitrangedefaultdescription
visit(item, ctx) => T | undefined———Return a value to collect it, undefined to skip the clip.

Returns Array of the collected values, in timeline order (track order, then index).

Example

const titles = AddTrack("video", { name: "Titles" });
Insert(titles, { type: "text", text: "Chapter one", start: 0, length: 2 });
Insert(titles, { type: "text", text: "Chapter two", start: 2, length: 2 });
const texts = FindItems((item, ctx) => item.type === "text" ? { id: item.id, track: ctx.track.id, text: item.text } : undefined);
Print(texts);
  • The callback must be synchronous; an async visitor is rejected.
  • ctx.track is the whole track view, so a visitor can filter on ctx.track.kind or ctx.track.name.
  • Use it instead of looping GetTimeline().tracks: one command visits every clip.

Agents: codemode.describe("praxis.cut.script.FindItems")

GetMedia

GetMedia(ref: MediaRef): MediaInfo
nametypeunitrangedefaultdescription
refMediaRef———{ libraryId, assetId } in a library bound to the project.

Returns MediaInfo: kind, dimensions, fps, hasAudio, and duration in seconds (with durationUs, the same in microseconds) when the platform knows them.

Errors UNBOUND_LIBRARY, NOT_FOUND, MEDIA_OFFLINE.

Example

// Replace lib_main / video with your own media: a library bound to this project and one of its assets.
const info = GetMedia({ libraryId: "lib_main", assetId: "video" });
Print(info.kind, info.durationUs / 1000000);
  • Use duration (seconds) as an editing time directly; durationUs is the same value in microseconds, kept for callers that already read it.
  • Write { libraryId, assetId }; the HTTP spelling library_id/asset_id is read the same way, with an INPUT_ADJUSTED warning.
  • An uncached lookup counts against the execute media budget, so read each asset once and reuse the value.

Agents: codemode.describe("praxis.cut.script.GetMedia")

GetTranscript

GetTranscript(ref: MediaRef, o?: { from?: number; to?: number }): Word[]
nametypeunitrangedefaultdescription
refMediaRef———Media reference in a bound library.
o.fromnumberseconds>= 00Window start in source time.
o.tonumberseconds>= fromsource endWindow end in source time.

Returns Word[]; each word is { text, start, end, from, to } with optional speaker and filler. start and end are seconds on the source clock; from and to are the same moments in source microseconds.

Errors UNBOUND_LIBRARY, NOT_FOUND, MEDIA_OFFLINE.

Example

// Replace lib_main / talk with your own media: a library bound to this project and an asset that has a transcript.
const words = GetTranscript({ libraryId: "lib_main", assetId: "talk" }, { from: 0, to: 1 });
Print(words.slice(0, 5));
  • The o.from/o.to window and each word’s start/end are source seconds; use those. from/to are kept in microseconds for callers that already read them.
  • Request the transcript first when the words come back empty; an unavailable transcript is not an error here.
  • Use FindItems on a caption track to read the words a clip actually kept.
  • filler is media’s own label for a word that is not part of the sentence: { kind, confidence } where kind is filler, verbal_tic, repetition or restart (an older transcript wrote true, which reads as a certain filler). Pass the words straight to DeleteWords or RemoveFillers.

Agents: codemode.describe("praxis.cut.script.GetTranscript")

GetAnalysis

GetAnalysis(ref: MediaRef, kind: AnalysisKind): Segment[]
nametypeunitrangedefaultdescription
refMediaRef———Media reference in a bound library.
kind"silence" | "filler" | "scenes" | "beats"———Which analysis to read.

Returns Segment[] with from, to (source microseconds), and an optional label and confidence.

Errors UNBOUND_LIBRARY, NOT_FOUND, MEDIA_OFFLINE.

Example

// Replace lib_main / talk with your own media: a library bound to this project and an asset whose analysis is ready.
const silences = GetAnalysis({ libraryId: "lib_main", assetId: "talk" }, "silence");
Print(silences.slice(0, 3));
  • Segment from/to are source microseconds; divide by 1,000,000 before passing them to a timeline function.
  • Request the analysis first when the result is empty; an uncomputed analysis is not an error here.
  • kind is one of silence, filler, scenes, beats; anything else is rejected.
  • beats is a music asset’s measured beat grid: one segment per beat, label is its place in the bar ("1" is a downbeat), so cut on every segment for the beat or on label "1" for the bar. Map a beat to the timeline as clip.start + (beat.from / 1e6 - clip.sourceIn); BPM is 60 / the beat length in seconds. Empty when the asset has no music, or while an asset never measured before is being measured: praxis.cut.projects.analysis.create with kind beats starts that measurement, answers pending with retry_after_sec, and says no_music when there is nothing to measure.

Agents: codemode.describe("praxis.cut.script.GetAnalysis")

ListTransitions

ListTransitions(): TransitionInfo[]

Returns TransitionInfo[]: each entry has kind, name, description and params.

Example

Print(ListTransitions().map((t) => [t.kind, t.params.map((p) => p.name)]));
  • Use the returned kind and parameter names inside effect on Join; a made-up kind is rejected.
  • Kinds include dissolve, dip, push, wipe, iris, blinds, blur, zoom, clock, flash and luma.
  • Each parameter reports its type (enum/number/integer), default, description and either enum values or a numeric min/max.

Agents: codemode.describe("praxis.cut.script.ListTransitions")

ListEffects

ListEffects(): EffectInfo[]

Returns EffectInfo[]; each entry names the effect kind and its parameters.

Example

Print(ListEffects().map((e) => e.kind));
  • Effects are supported only on visual clips (video, image, text, color, shape).
  • A numeric or integer parameter accepts keyframes: { parameter: [{ at, value, ease? }, ...] } with clip-relative seconds.
  • Effects run on the CPU during export and increase render time, so keep the stack short.
  • The catalog is the only source of effect names: an invented kind is rejected.

Agents: codemode.describe("praxis.cut.script.ListEffects")

ListAnimations

ListAnimations(): AnimationPresetInfo[]

Returns AnimationPresetInfo[]: id, version, phase, target, name, description, defaultDuration in seconds, and params.

Example

Print(ListAnimations().filter((a) => a.phase === "in").map((a) => a.id));
  • phase is in, out or loop; target is any or text.
  • A slot use is { preset, duration?, ...params }; duration is seconds.
  • A text-target preset’s duration controls the per-character/word/line rhythm, not the total reveal time.
  • Read the catalog before writing animation — a preset id that is not listed is rejected.

Agents: codemode.describe("praxis.cut.script.ListAnimations")

ListFonts

ListFonts(): FontInfo[]

Returns FontInfo[]: family, weights, scripts (latin/cjk) and source (bundled/catalog).

Example

Print(ListFonts().filter((f) => f.scripts.includes("cjk")).map((f) => f.family));
  • Use a returned family in style.fontFamily; an unknown family is rejected.
  • Check scripts before setting a CJK family on Latin text or the other way round.

Agents: codemode.describe("praxis.cut.script.ListFonts")

ListTextStyles

ListTextStyles(): ScriptTextStylePreset[]

Returns ScriptTextStylePreset[]; each entry has an id, a category, and the style it applies (in the Shotstack spelling).

Example

Print(ListTextStyles().map((s) => s.id));
  • Apply one as style: { preset: "clean-title" } on a text clip or a caption track.
  • Each entry’s value is in Shotstack’s rich shape (font, style, stroke, shadow, background, border, align, active, animation, plus glow / margin / maxWidth / maxLines), so it can be pasted straight into style.
  • category groups the catalog: basic, box, highlight, dynamic, title and decorative. Pick a dynamic caption preset (pop-word, boxed-word, fade-words, slide-up, bounce-word, typewriter) for word-by-word motion.
  • A preset is a starting point: fields supplied alongside it override the preset’s values, in the same rich shape.
  • GetItem and GetTimeline expose styleSource so you can see which preset a clip carries.

Agents: codemode.describe("praxis.cut.script.ListTextStyles")

ListTextTemplates

ListTextTemplates(): TextTemplate[]

Returns TextTemplate[]; each entry names its layers and the slots with their defaults.

Example

Print(ListTextTemplates().map((t) => [t.id, t.slots.map((s) => s.name)]));
  • Insert one with InsertTemplate(track, { template, start, slots }).
  • Read the returned slots and their maxLength before inserting; a slot the template does not declare is rejected.

Agents: codemode.describe("praxis.cut.script.ListTextTemplates")

Insert

Insert(track: TrackId, item: ItemInit, o?: { ripple?: boolean; after?: ClipId }): ClipId
nametypeunitrangedefaultdescription
trackTrackId———Track returned by AddTrack or read from GetTimeline.
itemItemInit———The clip to add; type and start are always required.
o.rippleboolean——falseShift same-track followers right to open room.
o.afterClipId———Start at the end of this clip on the same track; give either after or item.start, not both.

Returns The new ClipId.

Errors OVERLAP, TRACK_KIND_MISMATCH, UNKNOWN_FIELD, OUT_OF_SOURCE, LOCKED_TRACK, TOO_SHORT, NOT_FOUND, UNBOUND_LIBRARY.

Example

const track = AddTrack("video");
Insert(track, { type: "color", color: "#123456", start: 0, length: 3 });
Insert(track, { type: "text", text: "Hello", start: 3, length: 2 });
Print(GetTimeline().tracks[0].items.map((i) => i.start));
  • Clips on the same track may not overlap: a second clip starting before the first ends is rejected with OVERLAP. To butt-join clips use Append, { after: previousId }, or the previous clip’s end as the next start.
  • A boundary that misses by a rounding is absorbed instead of failing the op: a head landing within two frames of the previous clip’s end is moved onto it, and a clip reading up to a frame past its source is shortened to the frame the media has. Each is reported as an INPUT_ADJUSTED warning; a wider overlap is still OVERLAP.
  • A video whose clip is longer than its footage keeps its length and holds the last frame: the extra output becomes a freeze clip right after it, so nothing shifts. Audio has no frame to hold and is shortened to the source instead. Both carry an INPUT_ADJUSTED warning.
  • Two text clips that must appear at the same time need two tracks — a text track and a video track, or two text tracks. They cannot share one track.
  • Every editing time is in seconds and snaps to the project frame rate; a start that falls between frames is moved to the nearest frame, so the value you read back may differ slightly from the one you passed.
  • Video and audio may omit length, or write length: "auto", to use the remaining source duration; image, text, color, shape and caption require a number of seconds.
  • Video tracks accept video, image, text, color and shape; audio and caption tracks accept only their own type.
  • ripple: true moves same-track followers right to make room; without it an overlap is rejected rather than silently shifted.

Agents: codemode.describe("praxis.cut.script.Insert")

Append

Append(track: TrackId, item: ItemInit): ClipId
nametypeunitrangedefaultdescription
trackTrackId———Track returned by AddTrack or read from GetTimeline.
itemItemInit———The clip to add, without start: it starts where the track’s last clip ends (0 on an empty track).

Returns The new ClipId.

Errors UNKNOWN_FIELD, TRACK_KIND_MISMATCH, OUT_OF_SOURCE, LOCKED_TRACK, TOO_SHORT, NOT_FOUND, UNBOUND_LIBRARY.

Example

const track = AddTrack("video");
Append(track, { type: "color", color: "#123456", length: 3.56 });
Append(track, { type: "color", color: "#654321", length: 3.44 });
Print(GetTimeline().tracks[0].items.map((i) => [i.start, i.length]));
  • The easiest way to lay shots back to back: no start arithmetic, so frame snapping can never make neighbours overlap.
  • Passing start is rejected; use Insert to place a clip at a chosen time.

Agents: codemode.describe("praxis.cut.script.Append")

Update

Update(id: ClipId, patch: ItemPatchView): void
nametypeunitrangedefaultdescription
idClipId———The clip to change.
patchItemPatchView———Any subset of the writable clip fields.

Returns Nothing; read the clip back with GetItem to confirm.

Errors NOT_FOUND, OVERLAP, UNKNOWN_FIELD, INVALID_STYLE, LOCKED_TRACK, OUT_OF_SOURCE, TOO_SHORT.

Example

const id = Insert(AddTrack("video"), { type: "color", color: "#123456", start: 0, length: 3 });
Update(id, { length: 4, color: "#654321" });
const captions = AddCaptionsFromTranscript(AddTrack("caption", { style: { preset: "karaoke" } }), Insert(AddTrack("video"), { type: "color", color: "#000000", start: 0, length: 3 }));
// Emphasise one line: it takes the track style overridden by its own.
Update(captions[0], { style: { font: { color: "#FFE600", size: 60 } } });
Print(GetItem(id));
  • Every field is optional; a field you do not name keeps its current value.
  • On a caption, style is that one line’s own style layered over its track’s style: Update(captionId, { style: { font: { color: "#FFE600", size: 60 } } }) emphasises a single line. GetItem reports the effective style as style and the line’s own as styleOverride; Update(captionId, { style: null }) removes the override.
  • effects: null clears the effect stack, blend: null clears the blend mode, animation: null clears an animation preset, and animate: null or reveal: null removes that effect.
  • Set only fields that apply to the clip’s type; a field for another type is rejected.
  • The writable field set is the same as Insert’s — media, volumeDb, start, length, sourceIn, playback, transform, fit, text, style, color, fadeIn, fadeOut, duck, gain, animate, reveal, animation, fill, stroke, shape, width, height, radius, transitionIn, transitionOut, effects, blend and mask.
  • Do not supply animation together with animate or reveal in one call.
  • length: "auto" on a video or audio clip means the rest of its source, exactly as omitting length does on Insert.
  • A change that would overlap a neighbour on the same track is rejected with OVERLAP; shorten, move, or use ripple. A head landing within two frames of the previous clip’s end is absorbed instead, with an INPUT_ADJUSTED warning.
  • A length past the end of the source is absorbed rather than rejected the way Insert absorbs it: up to a frame it is shortened to what the media has, and a video keeps its length by holding its last frame.
  • media replaces the clip’s source (Premiere’s Replace With Clip, OTIO’s media_reference) and re-checks the clip against the new material without re-timing it: sourceIn, length, transitions, effects and keyframes stay as they are. A video whose footage is shorter keeps its length by holding its last frame and warns with INPUT_ADJUSTED; audio that no longer fits is rejected with OUT_OF_SOURCE; the clip’s type never changes.

Agents: codemode.describe("praxis.cut.script.Update")

SetSpeed

SetSpeed(id: ClipId, rate: number | SpeedCurveInput, o?: { keep?: "source" | "duration"; ripple?: boolean }): { length: number; sourceOut: number }
nametypeunitrangedefaultdescription
idClipId———Video or audio clip.
ratenumber | SpeedCurveInput—0.25–4 (scalar)—A scalar rate, or { curve: [{ at, rate, ease? }], audio? }.
o.keep"source" | "duration"——“source”source keeps the consumed source and changes length; duration keeps output length.
o.rippleboolean——falseShift same-track followers instead of failing on an overlap.

Returns { length, sourceOut } — the actual frame-rounded output length and exclusive source end, in seconds.

Errors RATE_OUT_OF_RANGE, UNSUPPORTED_PLAYBACK, OVERLAP, OUT_OF_SOURCE, UNKNOWN_FIELD, NOT_FOUND.

Example

// Replace lib_main / video with your own media: a library bound to this project and one of its assets.
const track = AddTrack("video", { name: "Speed" });
const id = Insert(track, { type: "video", media: { libraryId: "lib_main", assetId: "video" }, start: 0, length: 4 });
Print(SetSpeed(id, 0.5, { keep: "source" }));
Print(SetSpeed(id, 2, { keep: "source" }));
Print(SetSpeed(id, 0.5, { keep: "duration" }));
Print(GetItem(id));
Preview([0, 1]);
  • keep: "source" computes round(consumed source / new rate × fps) frames and falls back to floor when rounding would pass the source end; the returned values are the actual frame-rounded seconds.
  • o may be omitted: SetSpeed(id, 0.5) is SetSpeed(id, 0.5, { keep: "source" }), the same default as Premiere’s Speed/Duration — the source interval is kept and the length follows the rate. A value other than "source" or "duration" is still rejected.
  • keep: "duration" keeps the output length and changes how much source is consumed instead.
  • Scalar rates are limited to 0.25–4; anything outside fails with RATE_OUT_OF_RANGE.
  • A curve rate is forward-only and holds the output duration fixed; audio is "mute" or "resample", and pitch preservation is not available for curves.
  • A slower rate may need more source than remains; that fails with OUT_OF_SOURCE rather than silently shortening the clip.
  • Preserving direction and audio policy comes from the clip’s existing playback; change those with Update.
  • Ensure enough source remains for the chosen length and rate: Print(SetSpeed(id, 0.5, {keep: "source"})); Print(SetSpeed(id, 2, {keep: "source"})); on an existing four-second clip returns lengths 8 then 2 over the same source interval.
  • Reverse: Update(id, {playback: {kind: "rate", rate: 1, direction: "reverse", audio: "mute"}}). Freeze: Update(id, {playback: {kind: "freeze"}}).

Agents: codemode.describe("praxis.cut.script.SetSpeed")

Delete

Delete(id: ClipId, o?: { ripple?: boolean }): void
nametypeunitrangedefaultdescription
idClipId———The clip to remove.
o.rippleboolean——falseClose the gap by shifting same-track followers left.

Returns Nothing; read the timeline back to confirm.

Errors NOT_FOUND, LOCKED_TRACK, JOIN_CONFLICT.

Example

const track = AddTrack("video", { name: "Shots" });
Insert(track, { type: "color", color: "#172554", start: 0, length: 2 });
const middle = Insert(track, { type: "color", color: "#7C3AED", start: 2, length: 2 });
Insert(track, { type: "color", color: "#0F766E", start: 4, length: 2 });
Delete(middle, { ripple: true });
Print(GetTimeline().duration);
  • The removal function is Delete(id, { ripple? }). There is no Remove, RemoveClip or DeleteClip — a script calling one of those fails as an unknown function.
  • Without ripple the gap stays open and the following clips keep their times; with ripple: true the same-track followers move left to close it.
  • A clip that still takes part in a join cannot be deleted until the join is removed, or the call fails with JOIN_CONFLICT.
  • Deleting the last clip on a track leaves the track in place; remove the track with DeleteTrack.

Agents: codemode.describe("praxis.cut.script.Delete")

Join

Join(left: ClipId, right: ClipId, o: JoinOptions): JoinId
nametypeunitrangedefaultdescription
leftClipId———The earlier of the two clips.
rightClipId———The later clip; it must start exactly where left ends.
o.lengthnumberseconds> 0 and below each clip’s length0.5Size of the overlap.
o.effectTransitionInput———Required; { kind, ...params } with a kind from ListTransitions().
o.keepTrackLengthboolean——falsetrue overlaps without moving the right clip or its followers, so the track keeps its length.

Returns The new JoinId.

Errors JOIN_CONFLICT, INVALID_TRANSITION, TOO_SHORT, NOT_FOUND.

Example

Print(ListTransitions().map((t) => t.kind));
const track = AddTrack("video", { name: "Joined shots" });
const left = Insert(track, { type: "color", color: "#172554", start: 0, length: 4 });
const right = Insert(track, { type: "color", color: "#7C3AED", start: 4, length: 4 });
const join = Join(left, right, { length: 0.5, effect: { kind: "dissolve" } });
Print(GetTimeline().duration);
UpdateJoin(join, { length: 0.8, effect: { kind: "push", direction: "left" } });
Print(GetTimeline().duration, GetTimeline().joins);
Preview([GetItem(right).start + 0.4]);
  • Join moves the right clip and every same-track follower left by length, so that track becomes shorter and the project duration can shrink with it. Other tracks stay where they are.
  • keepTrackLength: true predicts the other way: nothing moves, the two clips simply share length seconds, and the track — and the project — keep their length. The shared frames are held by the incoming clip, which grows by length at its head. Clip length no longer predicts position in this mode, so read GetItem(id).start rather than adding lengths up.
  • When clips must stay aligned to audio, use keepTrackLength: true — or, when a clip only needs to appear or disappear, a per-clip transitionIn/transitionOut, which also moves nothing. The default shift mode is the wrong tool for that: it shortens the track and pulls the picture out of sync with a voiceover or music bed that does not move.
  • Both endpoints must be video, image, text, color or shape; audio and caption clips are rejected.
  • Each clip allows at most one incoming and one outgoing join, and their summed lengths cannot exceed its length.
  • Three-input overlaps, nonadjacent endpoints, cross-track joins and clips that are not butt-adjacent are rejected with JOIN_CONFLICT.
  • Transition parameters come from ListTransitions(); omitted parameters use catalog defaults. Unknown kinds and invalid parameters return INVALID_TRANSITION with the available parameters.
  • Effects and their defaults: dissolve; dip colour black/white (default black); push and wipe direction left/right/up/down (default left); wipe softness 0–1 (default 0); iris centerX/centerY 0–1 (default 0.5); blinds integer count 2–64 (default 8) and orientation vertical/horizontal (default vertical); blur radius 0–100 pixels at 1080-pixel frame height (default 24); zoom direction in/out (default in), amount 0.1–3 (default 1) and blur 0–1 (default 0.5); clock direction clockwise/counterclockwise (default clockwise), startAngle 0–360 degrees (default 0, twelve o’clock) and softness 0–1 (default 0); flash color white/black (default white) and intensity 0–1 (default 1).
  • Zoom blur uses up to eight radial samples per shot and is slower on server rendering.
  • Join options and UpdateJoin patches accept only length and effect; keepTrackLength is chosen once, on Join, and stays with the join.
  • UpdateJoin adjusts the overlap afterwards and DeleteJoin restores the butt cut. Per-clip transitionIn/transitionOut remain separate entrance/exit effects.

Agents: codemode.describe("praxis.cut.script.Join")

UpdateJoin

UpdateJoin(id: JoinId, patch: Partial<JoinOptions>): void
nametypeunitrangedefaultdescription
idJoinId———Join id from Join or from GetTimeline().joins.
patchPartial<JoinOptions>———Only length and effect are accepted.

Returns Nothing.

Errors JOIN_CONFLICT, INVALID_TRANSITION, NOT_FOUND.

Example

const track = AddTrack("video", { name: "Joined shots" });
const left = Insert(track, { type: "color", color: "#172554", start: 0, length: 4 });
const right = Insert(track, { type: "color", color: "#7C3AED", start: 4, length: 4 });
const join = Join(left, right, { length: 0.5, effect: { kind: "dissolve" } });
UpdateJoin(join, { length: 0.8, effect: { kind: "push", direction: "left" } });
Print(GetTimeline().joins);
  • Changing length moves the followers by the difference, so the track grows or shrinks by that amount.
  • An effect update replaces the whole effect object and applies the catalog defaults for parameters you omit.
  • Only length and effect are accepted; any other key is rejected with UNKNOWN_FIELD.
  • A join made with Join(..., { keepTrackLength: true }) stays in that mode: changing length adjusts the incoming clip’s head instead, and the followers still do not move.

Agents: codemode.describe("praxis.cut.script.UpdateJoin")

DeleteJoin

DeleteJoin(id: JoinId): void
nametypeunitrangedefaultdescription
idJoinId———The join to remove.

Returns Nothing.

Errors NOT_FOUND, JOIN_CONFLICT.

Example

const track = AddTrack("video", { name: "Restored cut" });
const left = Insert(track, { type: "color", color: "#172554", start: 0, length: 4 });
const right = Insert(track, { type: "color", color: "#7C3AED", start: 4, length: 4 });
const join = Join(left, right, { length: 0.5, effect: { kind: "dip" } });
UpdateJoin(join, { length: 0.8 });
DeleteJoin(join);
Print(GetTimeline().duration, GetTimeline().joins);
  • The right clip and its same-track followers move right by the join’s length, restoring the original cut.
  • Other tracks are untouched.
  • A join id that does not exist fails with NOT_FOUND; read GetTimeline().joins when you are unsure.

Agents: codemode.describe("praxis.cut.script.DeleteJoin")

Split

Split(id: ClipId, at: number): ClipId
nametypeunitrangedefaultdescription
idClipId———The clip to cut.
atnumbersecondsstrictly inside the clip—Timeline position of the cut.

Returns The new right-hand ClipId; the original clip keeps the left part.

Errors TOO_SHORT, JOIN_CONFLICT, NOT_FOUND, LOCKED_TRACK.

Example

const track = AddTrack("video", { name: "Split shot" });
const id = Insert(track, { type: "color", color: "#172554", start: 0, length: 4 });
const right = Split(id, 2);
Print([GetItem(id).length, GetItem(right).length]);
  • at is a timeline position, not an offset into the clip, and it must fall strictly inside it — a cut at or outside an edge is rejected with TOO_SHORT.
  • Both halves keep their source interval, so the sum of the two lengths equals the original.
  • Effect keyframes are preserved with the same clip-local behaviour as animate, and an animation preset keeps in on the left, out on the right and loop on both.
  • A cut inside a joined overlap is rejected with JOIN_CONFLICT; remove the join first.

Agents: codemode.describe("praxis.cut.script.Split")

Trim

Trim(id: ClipId, edge: "in" | "out", delta: number, o?: { ripple?: boolean }): void
nametypeunitrangedefaultdescription
idClipId———The clip to trim.
edge"in" | "out"———Which edge moves.
deltanumberseconds——Positive lengthens, negative shortens.
o.rippleboolean——falseShift same-track followers when the clip grows.

Returns Nothing.

Errors TOO_SHORT, OVERLAP, OUT_OF_SOURCE, NOT_FOUND, LOCKED_TRACK.

Example

// Replace lib_main / video with your own media: a library bound to this project and one of its assets.
const track = AddTrack("video", { name: "Trim" });
const id = Insert(track, { type: "video", media: { libraryId: "lib_main", assetId: "video" }, start: 0, length: 4 });
Trim(id, "in", 1);
Print(GetItem(id).start);
  • Trimming the in edge moves the clip’s start and consumes source, so the clip holds its end; out keeps the start and changes the end.
  • delta is seconds and snaps to frames, so the resulting length may differ from the arithmetic by less than one frame.
  • Growing an edge past a neighbour is rejected with OVERLAP; pass ripple: true to move the followers instead.
  • Shrinking below one frame is rejected with TOO_SHORT, and consuming source the clip does not have fails with OUT_OF_SOURCE.
  • Effect keyframes are preserved with clip-local times, exactly like animate.

Agents: codemode.describe("praxis.cut.script.Trim")

Move

Move(id: ClipId, start: number, track?: TrackId): void
nametypeunitrangedefaultdescription
idClipId———The clip to move.
startnumberseconds>= 0—New timeline start.
trackTrackId——current trackDestination track; must accept the clip’s type.

Returns Nothing.

Errors OVERLAP, TRACK_KIND_MISMATCH, LOCKED_TRACK, NOT_FOUND, TOO_SHORT.

Example

const track = AddTrack("video", { name: "Move" });
const id = Insert(track, { type: "color", color: "#172554", start: 0, length: 2 });
Move(id, 2.5);
Print(GetItem(id).start);
  • start is frame-snapped; read the clip back if you need the exact stored value.
  • Moving onto an occupied span is rejected with OVERLAP; Move has no ripple option, so make room first or move the neighbours.
  • A destination track that does not accept the clip’s type fails with TRACK_KIND_MISMATCH.

Agents: codemode.describe("praxis.cut.script.Move")

RippleDeleteRange

RippleDeleteRange(from: number, to: number, tracks?: TrackId[]): void
nametypeunitrangedefaultdescription
fromnumberseconds>= 0—Interval start.
tonumberseconds> from—Interval end.
tracksTrackId[]——all unlocked tracksTracks to cut from.

Returns Nothing.

Errors TOO_SHORT, LOCKED_TRACK, NOT_FOUND, JOIN_CONFLICT.

Example

const track = AddTrack("video", { name: "Shots" });
Insert(track, { type: "color", color: "#172554", start: 0, length: 3 });
Insert(track, { type: "color", color: "#7C3AED", start: 3, length: 3 });
Insert(track, { type: "color", color: "#0F766E", start: 6, length: 3 });
RippleDeleteRange(4, 6);
Print(GetTimeline().duration);
  • This is the cut-a-hole tool: it removes the interval from every named track and slides what followed to the left, which is how you drop a pause across several tracks at once.
  • The interval must be at least one frame long, or the call is rejected with TOO_SHORT.
  • Clips that only partly overlap the interval are split at its edges.
  • Omitted tracks means every unlocked track; a locked track is skipped, and naming a locked track fails with LOCKED_TRACK.

Agents: codemode.describe("praxis.cut.script.RippleDeleteRange")

DeleteWords

DeleteWords(source: ClipId, words: { start: number; end: number }[], o?: { keepPauseMs?: number }): { removed: number; seconds: number }
nametypeunitrangedefaultdescription
sourceClipId———The video or audio clip the words were spoken on.
words{ start, end }[]seconds0 <= start < end—Source-clock intervals to delete; a GetTranscript word list is passed as it comes.
o.keepPauseMsnumbermilliseconds0–5000250Breath kept at each end of a cut; half of it on each side.

Returns { removed, seconds } — how many words went and how many timeline seconds the cut took out.

Errors INVALID_PARAMS, NOT_FOUND, TOO_SHORT, OVERLAP.

Example

// Replace lib_main / talk with your own media: a library bound to this project and an asset that has a transcript.
const ref = { libraryId: "lib_main", assetId: "talk" };
const track = AddTrack("video", { name: "Talk" });
const clip = Insert(track, { type: "video", media: ref, start: 0, length: 10 });
const captions = AddTrack("caption");
AddCaptionsFromTranscript(captions, clip, { maxChars: 20 });
const gone = DeleteWords(clip, GetTranscript(ref).filter((word) => word.start < 2));
Print(gone.removed, gone.seconds);
  • This is deleting by transcript: the words are source seconds, mapped onto the timeline through the clip’s sourceIn and playback rate, and only the part of a word the clip still holds is cut.
  • Each interval is merged with its neighbours and shrunk by keepPauseMs / 2 at each end, so the cut keeps a short breath instead of butting two words together. keepPauseMs: 0 cuts the words exactly.
  • Every unlocked track ripples, exactly as RippleDeleteRange does — picture, sound and other clips move together, and the tracks cannot drift apart.
  • A caption generated from this clip is rebuilt from the words that survive, so its wording and its sound stay in step; a caption on a locked track is left alone.
  • The cut is frame-snapped: read the timeline back for exact times. To see what a filler cut would do before doing it, use RemoveFillers with dryRun: true.

Agents: codemode.describe("praxis.cut.script.DeleteWords")

RemoveFillers

RemoveFillers(source: ClipId, o?: { kinds?: ("filler" | "verbal_tic" | "repetition" | "restart")[]; minConfidence?: number; keepPauseMs?: number; dryRun?: boolean }): { items: { text: string; kind: string; at: number; length: number; confidence: number }[]; seconds: number }
nametypeunitrangedefaultdescription
sourceClipId———The video or audio clip whose words are inspected.
o.kindsstring[]——every kindWhich labels count: filler, verbal_tic, repetition, restart.
o.minConfidencenumber—0–10.7The least certain a label may be and still be cut.
o.keepPauseMsnumbermilliseconds0–5000250Breath kept at each end, as DeleteWords.
o.dryRunboolean——falseList the words and change nothing.

Returns { items, seconds } — one entry per word (at and length are timeline seconds), and how many seconds the cut removes.

Errors INVALID_PARAMS, NOT_FOUND, TOO_SHORT, OVERLAP.

Example

// Replace lib_main / talk with your own media: a library bound to this project and an asset that has a transcript.
const ref = { libraryId: "lib_main", assetId: "talk" };
const track = AddTrack("video", { name: "Talk" });
const clip = Insert(track, { type: "video", media: ref, start: 0, length: 10 });
const listed = RemoveFillers(clip, { dryRun: true });
Print(listed.items);
const cut = RemoveFillers(clip, { kinds: ["filler", "verbal_tic"] });
Print(cut.items.length, cut.seconds);
  • The labels are media’s own — the transcript’s filler annotation ({ kind, confidence }, or the older true, read as a certain filler) — not a guess cut makes on its own.
  • A word media did not label falls back to the lexicon rules at confidence 0.6, so a rule-level guess appears in a dry run (minConfidence: 0) and is never deleted by the default 0.7.
  • Deleting is DeleteWords on the words chosen: the same ripple across every unlocked track, the same breath, and the same rebuild of the captions generated from this clip.
  • Write the dry run into the record first in an agent loop: list, decide, then cut — the order this entry’s example keeps.

Agents: codemode.describe("praxis.cut.script.RemoveFillers")

Matte

Matte(source: ClipId): { trackId: TrackId; clipId: ClipId }
nametypeunitrangedefaultdescription
sourceClipId———The video clip whose source is matted.

Returns { trackId, clipId } — the matte track, added under the clip’s own track, and the matte clip on it.

Errors INVALID_PARAMS, NOT_FOUND, MEDIA_PROCESSING, MEDIA_PROCESSING_FAILED, UNBOUND_LIBRARY.

Example

// Replace lib_main / talk with your own media: a library bound to this project and a video of a person.
const track = AddTrack("video", { name: "Talk" });
const clip = Insert(track, { type: "video", media: { libraryId: "lib_main", assetId: "talk" }, start: 0, length: 10, transform: { scale: 0.42, x: 0.77, y: 0.74 } });
// The first run stops with MEDIA_PROCESSING and commits nothing; wait for media's job, then run this script again.
Print(Matte(clip));
  • The mask is a track mask, not a shape: the matte clip sits on its own video track under the clip, with the clip’s own start, sourceIn, length, fit and transform, and the clip’s mask points at that track’s id with channel: "luma" — never at the matte’s asset id.
  • The matte track is not shown on its own; only the clip that masks it is drawn.
  • The first run stops with MEDIA_PROCESSING and commits nothing; wait for the job it names (praxis.media.libraries.jobs.retrieve), then run the same script again, which finds the matte in the cache.
  • Deleting, trimming or moving the clip after the matte is in place moves picture and matte together only because they carry the same placement — as with DeleteWords, keep them in step by editing the clip, not the matte alone.
  • Billing is media’s: a matte is charged by the source video’s seconds. output: "alpha" is deliberately not this verb’s operation — a black-and-white matte is what overlaying needs and is far smaller.

Agents: codemode.describe("praxis.cut.script.Matte")

EnhanceVoice

EnhanceVoice(source: ClipId): { trackId: TrackId; clipId: ClipId }
nametypeunitrangedefaultdescription
sourceClipId———The audio or video clip whose speech is enhanced.

Returns { trackId, clipId } — the new audio track and the enhanced clip on it.

Errors INVALID_PARAMS, NOT_FOUND, MEDIA_PROCESSING, MEDIA_PROCESSING_FAILED, UNBOUND_LIBRARY.

Example

// Replace lib_main / talk with your own media: a library bound to this project and a clip of someone speaking.
const track = AddTrack("video", { name: "Talk" });
const clip = Insert(track, { type: "video", media: { libraryId: "lib_main", assetId: "talk" }, start: 0, length: 10 });
// The first run stops with MEDIA_PROCESSING and commits nothing; wait for media's job, then run this script again.
Print(EnhanceVoice(clip));
  • The enhanced audio is placed with the clip’s own start, sourceIn, length and speed, and the original clip’s own sound is set to -60 dB (zero), so the enhanced voice replaces it instead of layering with it.
  • Enhance the voice of a clip whose transcript you have already judged: enhancement changes the sound, not the words, so captions and cuts timed against the original still hold.
  • While the job runs the run stops with MEDIA_PROCESSING and nothing is committed; wait for the job and run the same script again.

Agents: codemode.describe("praxis.cut.script.EnhanceVoice")

AlignByAudio

AlignByAudio(source: ClipId, referenceClip: ClipId): { offsetSeconds: number; confidence: number; moved: { clipId: ClipId; sourceIn: number }[] }
nametypeunitrangedefaultdescription
sourceClipId———The audio or video clip to align.
referenceClipClipId———The other recording to align it against; the two must be in one library.

Returns { offsetSeconds, confidence, moved } — media’s offset, its confidence, and the clips whose sourceIn moved.

Errors INVALID_PARAMS, NOT_FOUND, ALIGNMENT_UNCERTAIN, MEDIA_PROCESSING, MEDIA_PROCESSING_FAILED, UNBOUND_LIBRARY.

Example

// Replace lib_main / video and lib_main / talk with your own media: two recordings of the same take.
const a = AddTrack("video", { name: "Camera" });
const b = AddTrack("video", { name: "Screen" });
const camera = Insert(a, { type: "video", media: { libraryId: "lib_main", assetId: "video" }, start: 0, length: 10 });
const screen = Insert(b, { type: "video", media: { libraryId: "lib_main", assetId: "talk" }, start: 0, length: 10 });
// The first run stops with MEDIA_PROCESSING and commits nothing; wait for media's job, then run this script again.
Print(AlignByAudio(camera, screen));
  • The recording that started earlier gets media’s |offset| added to its sourceIn, so the same moment of sound is heard at the same timeline time in both.
  • A matte that mirrors the moved clip (on the track its mask points to, with the same start) moves by the same seconds; without that, picture and matte would drift apart.
  • Confidence below 0.3 is refused with ALIGNMENT_UNCERTAIN and nothing is changed: a guess would silently misalign the take. Record a clearer stretch of the same passage or align by a hand-found word instead.
  • Both recordings must be in one library: media aligns a pair inside one library. Mute the recording whose sound you do not want to hear twice.

Agents: codemode.describe("praxis.cut.script.AlignByAudio")

Reframe

Reframe(source: ClipId, o: { aspect: "9:16" | "1:1" | "16:9" }): { clipId: ClipId }
nametypeunitrangedefaultdescription
sourceClipId———The video clip to reframe.
o.aspectenum—9:16, 1:1, 16:9—The aspect the reframed take is composed for.

Returns { clipId } — the clip, now playing the reframed media.

Errors INVALID_PARAMS, NOT_FOUND, MEDIA_PROCESSING, MEDIA_PROCESSING_FAILED.

Example

// Replace lib_main / talk with your own media: a library bound to this project and a landscape clip.
const track = AddTrack("video", { name: "Talk" });
const clip = Insert(track, { type: "video", media: { libraryId: "lib_main", assetId: "talk" }, start: 0, length: 10 });
// The first run stops with MEDIA_PROCESSING and commits nothing; wait for media's job, then run this script again.
Print(Reframe(clip, { aspect: "9:16" }));
  • Only the clip’s media changes: start, sourceIn, length, fit, transform and every effect stay exactly where the script put them.
  • A reframed take keeps the source’s own frames, so sourceIn remains meaningful; set the project’s canvas with SetSettings so the composition matches.
  • While the job runs the run stops with MEDIA_PROCESSING and nothing is committed; wait for the job and run the same script again.

Agents: codemode.describe("praxis.cut.script.Reframe")

Upscale

Upscale(source: ClipId, o: { height: 720 | 1080 | 1440 | 2160 }): { clipId: ClipId }
nametypeunitrangedefaultdescription
sourceClipId———The video or image clip to upscale.
o.heightenumpixels720, 1080, 1440, 2160—The height the upscaled take is rendered at.

Returns { clipId } — the clip, now playing the upscaled media.

Errors INVALID_PARAMS, NOT_FOUND, MEDIA_PROCESSING, MEDIA_PROCESSING_FAILED.

Example

// Replace lib_main / video with your own media: a library bound to this project and a small clip.
const track = AddTrack("video", { name: "Shot" });
const clip = Insert(track, { type: "video", media: { libraryId: "lib_main", assetId: "video" }, start: 0, length: 4 });
// The first run stops with MEDIA_PROCESSING and commits nothing; wait for media's job, then run this script again.
Print(Upscale(clip, { height: 1440 }));
  • Only the clip’s media changes: the in and out points stay put, so a cut timed against the original still lands where it did.
  • An image clip is accepted: a still can be upscaled for a canvas larger than its own pixels.
  • While the job runs the run stops with MEDIA_PROCESSING and nothing is committed; wait for the job and run the same script again.

Agents: codemode.describe("praxis.cut.script.Upscale")

Redact

Redact(source: ClipId, o: { targets: ("face" | "qr" | "text")[] }): { trackId: TrackId; clipId: ClipId; maskTrackId: TrackId; maskClipId: ClipId }
nametypeunitrangedefaultdescription
sourceClipId———The video clip whose targets are hidden.
o.targetsstring[]—face, qr, text—Which marked things are hidden; at least one.

Returns { trackId, clipId, maskTrackId, maskClipId } — the pixelated copy’s track and clip, and the mask track and clip under it.

Errors INVALID_PARAMS, NOT_FOUND, MEDIA_PROCESSING, MEDIA_PROCESSING_FAILED.

Example

// Replace lib_main / talk with your own media: a library bound to this project and a clip with faces.
const track = AddTrack("video", { name: "Interview" });
const clip = Insert(track, { type: "video", media: { libraryId: "lib_main", assetId: "talk" }, start: 0, length: 10 });
// The first run stops with MEDIA_PROCESSING and commits nothing; wait for media's job, then run this script again.
Print(Redact(clip, { targets: ["face", "qr"] }));
  • Two layers are added: a mask track under the clip carrying media’s redact mask (white where the targets are), and a muted copy of the clip above it carrying the pixelate effect masked by that track — so only the marked boxes are pixelated and the rest of the frame is the untouched clip.
  • The copy repeats the clip’s media and placement, and its track is muted, so the sound is heard once.
  • While the job runs the run stops with MEDIA_PROCESSING and nothing is committed; wait for the job and run the same script again.

Agents: codemode.describe("praxis.cut.script.Redact")

AddTrack

AddTrack(kind: "video" | "audio" | "caption", init?: { name?: string; role?: "voice" | "music" | "sfx"; style?: RichStyle & { preset?: string } }, index?: number): TrackId
nametypeunitrangedefaultdescription
kind"video" | "audio" | "caption"———What the track may hold.
init.namestring———Display name for the track.
init.role"voice" | "music" | "sfx"———Audio role; used by ducking and mixing.
init.styleRichStyle & { preset?: string }———Caption track style, optionally starting from a preset; see the style field.
indexnumber—>= 0append at the bottomLayer position; 0 is the topmost.

Returns The new TrackId.

Errors NOT_FOUND, INVALID_PARAMS.

Example

const video = AddTrack("video");
const voice = AddTrack("audio", { name: "Voice", role: "voice" });
const captions = AddTrack("caption", { style: { preset: "subtitle-black", font: { size: 56 } } });
Print([video, voice, captions]);
  • Video tracks accept video, image, text, color and shape clips; audio and caption tracks accept only their own type.
  • A caption track takes style in Shotstack’s rich shape (font, style, stroke, shadow, background, border, align, active, animation, plus the glow / margin / maxWidth / maxLines extensions), optionally starting from a ListTextStyles() preset. A single caption can override it — see Update.
  • animation.style gives the track a per-word animation (highlight, karaoke, pop, fade, slide, bounce, typewriter), driven by the transcript’s word times or an even split when there are none; the style field lists the semantics.
  • Use role on audio tracks so ducking and mixing treat the track correctly: a level duck side-chains on the under track’s measured level, and a mix measurement (analysis.run with kind: "mix") reports loudness per role and where music masks the voice.
  • A track that declares no role is still measured: the rule is the timeline’s own facts, and it is deliberately conservative — an asset with a transcript counts as the voice, every other audio track counts as the music, and sfx is never inferred. Declare role rather than relying on it.
  • A role the timeline carries no clip of measures as absent, so a mix measurement only reports the balance between voice and music when both are present.
  • index selects layer order with 0 on the topmost layer; omitting it appends the track below every existing track, on the bottom-most layer, so a full-screen capture added last covers the clips already there. Pass 0 for the top, or reorder afterwards with MoveTrack.

Agents: codemode.describe("praxis.cut.script.AddTrack")

MoveTrack

MoveTrack(id: TrackId, index: number): void
nametypeunitrangedefaultdescription
idTrackId———The track to move.
indexnumber—>= 0—Layer position, the same scale AddTrack uses; an index past the last layer is clamped to the bottom-most.

Returns Nothing; read the timeline back to confirm the new order.

Errors NOT_FOUND, INVALID_PARAMS.

Example

const under = AddTrack("video", { name: "Under" });
Insert(under, { type: "color", color: "#172554", start: 0, length: 2 });
const over = AddTrack("video", { name: "Over" });
Insert(over, { type: "color", color: "#7C3AED", start: 0, length: 2 });
MoveTrack(over, 0);
Print(GetTimeline().tracks.map((track) => [track.name, track.index]));
  • index is the same scale AddTrack takes: 0 is the topmost layer — the last one drawn, covering everything under it — and a larger index sits further down. This is Shotstack’s tracks[0]-on-top order.
  • Only the layer order changes: the track’s id, name, kind and every clip and transition on it move with it.
  • An index past the last layer is clamped to the bottom-most position, and a negative one to the top, so a script cannot index out of range.
  • A track is added at the bottom by default; use this to lift a full-screen capture, an overlay or a watermark above the picture.

Agents: codemode.describe("praxis.cut.script.MoveTrack")

UpdateTrack

UpdateTrack(id: TrackId, patch: TrackPatchView): void
nametypeunitrangedefaultdescription
idTrackId———The track to change.
patchTrackPatchView———Any subset of name, locked, hidden, muted, gainDb, role and style.

Returns Nothing.

Errors NOT_FOUND, INVALID_PARAMS.

Example

const voice = AddTrack("audio", { name: "Voice", role: "voice" });
UpdateTrack(voice, { gainDb: -3, role: "voice" });
Print(GetTimeline().tracks.map((t) => [t.name, t.role]));
  • muted and gainDb apply to audio tracks and to video tracks, where they act on the original sound of the track’s video clips (mute the footage under a voiceover with UpdateTrack(videoTrack, { muted: true })); role applies to audio tracks; style to caption tracks.
  • A locked track refuses every edit to its clips with LOCKED_TRACK — unlock it before editing.
  • Read the track back with GetTimeline to confirm the change.

Agents: codemode.describe("praxis.cut.script.UpdateTrack")

DeleteTrack

DeleteTrack(id: TrackId): void
nametypeunitrangedefaultdescription
idTrackId———The track to remove.

Returns Nothing.

Errors NOT_FOUND, JOIN_CONFLICT, LOCKED_TRACK.

Example

const scratch = AddTrack("video", { name: "Scratch" });
Insert(scratch, { type: "color", color: "#172554", start: 0, length: 2 });
DeleteTrack(scratch);
Print(GetTimeline().tracks.length);
  • Every clip on the track goes with it; to keep a clip, move it to another track first.
  • A track whose clips take part in a join cannot be removed until the join is.
  • Prefer deleting the clips and keeping the track when you only want to empty it.

Agents: codemode.describe("praxis.cut.script.DeleteTrack")

SetSettings

SetSettings(patch: Partial<ProjectSettingsView>): void
nametypeunitrangedefaultdescription
patchPartial<ProjectSettingsView>———Any of width, height (pixels), fps and background (colour).

Returns Nothing.

Errors INVALID_PARAMS, NOT_FOUND.

Example

SetSettings({ width: 1080, height: 1920, fps: 30, background: "#000000" });
const titles = AddTrack("video", { name: "Titles" });
Insert(titles, { type: "text", text: "Vertical", start: 0, length: 3 });
Print(GetTimeline().duration);
  • width and height are pixels; fps is frames per second; background is a colour string.
  • Changing fps re-snaps existing times, so read the timeline back after changing it and before positioning clips.
  • Only the fields you supply change.

Agents: codemode.describe("praxis.cut.script.SetSettings")

AddCaptionsFromTranscript

AddCaptionsFromTranscript(track: TrackId, source: ClipId, o?: { style?: RichStyle & { preset?: string }; maxChars?: number; minSeconds?: number; maxSeconds?: number; maxLines?: 1 | 2; punctuation?: "keep" | "subtitle"; snapToCuts?: boolean }): ClipId[]
nametypeunitrangedefaultdescription
trackTrackId———Caption track to fill.
sourceClipId———Audio or video clip whose kept words become captions.
o.styleRichStyle & { preset?: string }———Caption track style, optionally starting from a preset.
o.maxCharsnumber—1–100012 portrait, 20 otherwiseMaximum characters per caption line.
o.minSecondsnumberseconds> 00.6Shortest caption kept on screen; a briefer cue is merged into a neighbour or extended.
o.maxSecondsnumberseconds≥ o.minSeconds7Longest caption; a longer cue is split at the largest pause between its words.
o.maxLines1 | 2——1Lines per caption; 2 doubles the merge budget and breaks a merged caption in the middle.
o.punctuation"keep" | "subtitle"——decided by the transcriptsubtitle drops the line-end 句读 and turns a comma inside a line into one space; Chinese transcripts default to it.
o.snapToCutsboolean——trueSnap an in-point that begins within half a second after a cut onto the cut’s first frame.

Returns The created ClipId[], one per caption.

Errors TRACK_KIND_MISMATCH, NOT_FOUND, OVERLAP, INVALID_STYLE.

Example

// Replace lib_main / talk with a bound library's own asset.
const footage = AddTrack("video");
const clip = Insert(footage, { type: "video", media: { libraryId: "lib_main", assetId: "talk" }, start: 0, length: 4 });
const track = AddTrack("caption");
const captions = AddCaptionsFromTranscript(track, clip, { maxChars: 24, style: { preset: "subtitle-outline", font: { size: 52 } } });
Print(captions.length);
  • Only words the source clip actually keeps become captions, so trimming first is how you caption a section.
  • The caption track must be empty where the captions land, or the call is rejected with OVERLAP. The captions this call generates never overlap each other: a transcript’s overlapping word times are trimmed, with a CAPTION_ADJUSTED warning.
  • Timing follows the subtitle rules: cues keep a two-frame gap and stay on screen between minSeconds and maxSeconds, and a cue that outlasts maxSeconds is split at its largest pause between words. Each change carries a CAPTION_ADJUSTED warning naming its kind: trimmed overlap, merged short, extended short, snapped to cut, split long.
  • A line ends at a pause between transcript words (a gap of at least 0.3 s) or at a closing mark (。!?), never in the middle of a word; a comma is a weaker break and only ends a line when the next word would overrun it.
  • A Chinese caption is read by the subtitle convention by default: no 句读 ends a line, and a comma inside a line becomes one space. Question and exclamation marks, quotation marks and book-title marks stay. Pass punctuation: "keep" for the transcript’s own punctuation.
  • maxChars defaults to 12 on a portrait canvas and 20 on a landscape or square one, because a narrow picture holds fewer characters.
  • snapToCuts follows the cut points of every video and image clip on the timeline: an in-point within half a second after a cut starts at the cut’s first frame, and an out-point less than half a second before a cut pulls back two frames. Dialogue that itself spans a cut keeps its own timing.
  • Use ListTextStyles() for a preset id and pass it as style: { preset: "..." }.
  • o.style is the track’s style: a preset first, then rich fields over it. One line is emphasised with Update(captionId, { style: { font: { size: 60 } } }).

Agents: codemode.describe("praxis.cut.script.AddCaptionsFromTranscript")

InsertTemplate

InsertTemplate(track: TrackId, o: { template: string; start: number; slots?: Record<string, string> }): ClipId[]
nametypeunitrangedefaultdescription
trackTrackId———Track the template’s first layer goes on.
o.templatestring———Template id from ListTextTemplates().
o.startnumberseconds>= 0—Timeline start of the composition.
o.slotsRecord<string, string>———Text for the template’s declared slots.

Returns The created ClipId[].

Errors UNKNOWN_FIELD, NOT_FOUND, OVERLAP, TRACK_KIND_MISMATCH.

Example

const template = ListTextTemplates()[0].id;
const videoTrack = AddTrack("video", { name: "Titles" });
const ids = InsertTemplate(videoTrack, { template, start: 0, slots: {} });
Print(ids.length);
  • Read ListTextTemplates() first: the entry lists each slot’s name, default and maximum length.
  • A slot the template does not declare, or text longer than the slot allows, is rejected.
  • The template inserts several clips, so the target track must have room for the whole composition.

Agents: codemode.describe("praxis.cut.script.InsertTemplate")

AlignCaptions

AlignCaptions(trackId: TrackId, script: string, options?: { resplit?: boolean; maxChars?: number }): { replaced: number; added: number; deleted: number }
nametypeunitrangedefaultdescription
trackIdTrackId———Caption track to rebuild.
scriptstring———The text the captions must follow.
options.resplitboolean———Re-split the text on its own punctuation before aligning.
options.maxCharsnumber———Maximum characters per caption line.

Returns { replaced, added, deleted } counts.

Errors CAPTION_ALIGN_LOW_CONFIDENCE, TRACK_KIND_MISMATCH, NOT_FOUND, OVERLAP.

Example

const captionTrack = AddTrack("caption", { name: "Captions" });
Insert(captionTrack, { type: "caption", text: "Hello there, this is Praxis Cut.", start: 0, length: 3 });
Print(AlignCaptions(captionTrack, "Hello there, this is Praxis Cut.", { resplit: true, maxChars: 20 }));
  • This aligns an existing caption track to supplied text; use ImportCaptions when you have a subtitle file instead.
  • When the alignment confidence is too low the whole call fails with CAPTION_ALIGN_LOW_CONFIDENCE and the track is left unchanged.
  • The counts tell you what changed: replaced is captions rewritten, added new ones, deleted dropped ones.
  • The track’s timing follows the same rules as AddCaptionsFromTranscript: no overlap, nothing too brief to read, and a two-frame gap between neighbours.

Agents: codemode.describe("praxis.cut.script.AlignCaptions")

ImportCaptions

ImportCaptions(trackId: TrackId, text: string, o?: ImportCaptionsOptions): ClipId[]
nametypeunitrangedefaultdescription
trackIdTrackId———Caption track to fill.
textstring—<= 100000 bytes—The subtitle file contents.
o.format"srt" | "vtt"——inferredFormat; a WEBVTT header selects VTT when omitted.
o.offsetnumberseconds—0Shift every imported cue by this amount.

Returns The created ClipId[], one per cue.

Errors INVALID_CAPTION_FILE, OVERLAP, TRACK_KIND_MISMATCH, NOT_FOUND.

Example

const captionTrack = AddTrack("caption", { name: "Imported captions" });
const cues = ImportCaptions(captionTrack, "1\n00:00:00,000 --> 00:00:02,000\nHello\n", { format: "srt" });
Print(cues.length);
  • More than 100000 bytes, more than 5000 cues, a malformed timecode, an end before the start, or overlapping cues inside the file are rejected with INVALID_CAPTION_FILE and the offending source line.
  • Overlap of the imported cues with clips already on the track uses the ordinary OVERLAP rejection instead.
  • offset shifts every cue in seconds, which is how you sync a file that was timed against a different start.
  • Cues come out sorted by timeline start on the way back through ExportCaptions, which writes millisecond timecodes.
  • Only the timing is normalised: cues that overlap are trimmed and a cue too brief to read is merged or extended, exactly as AddCaptionsFromTranscript does it, but the file’s own wording and punctuation are never rewritten.

Agents: codemode.describe("praxis.cut.script.ImportCaptions")

ExportCaptions

ExportCaptions(trackId: TrackId, o: ExportCaptionsOptions): string
nametypeunitrangedefaultdescription
trackIdTrackId———Caption track to export.
o.format"srt" | "vtt"———Required output format.

Returns The subtitle file contents as a string.

Errors TRACK_KIND_MISMATCH, NOT_FOUND, INVALID_PARAMS.

Example

const captionTrack = AddTrack("caption", { name: "Imported captions" });
const cues = ImportCaptions(captionTrack, "1\n00:00:00,000 --> 00:00:01,500\nHello Cut\n\n2\n00:00:01,500 --> 00:00:03,000\nSecond line\n", { format: "srt" });
Print(cues.length, ExportCaptions(captionTrack, { format: "vtt" }));
  • Cues are sorted by timeline start and written with millisecond timecodes.
  • format is required; there is no inference on export.
  • The returned string goes into the script’s prints, so keep the file small — prints shares the response budget.

Agents: codemode.describe("praxis.cut.script.ExportCaptions")

SetMarker

SetMarker(at: number, label: string): string
nametypeunitrangedefaultdescription
atnumberseconds>= 0—Timeline position of the marker.
labelstring———Text shown for the marker.

Returns The new marker id.

Errors INVALID_PARAMS, NOT_FOUND.

Example

const marker = SetMarker(4.5, "chapter 2");
Print(marker);
  • Markers are annotations only; they never affect render or duration.
  • at is frame-snapped like every other editing time.
  • Use markers to record intent a later edit can read back from the timeline.

Agents: codemode.describe("praxis.cut.script.SetMarker")

Print

Print(...values: unknown[]): void
nametypeunitrangedefaultdescription
valuesunknown[]———Any JSON-serialisable values.

Returns Nothing; the values appear in the response’s prints array.

Errors RESPONSE_TOO_LARGE.

Example

const track = AddTrack("video");
Print(track, GetTimeline().duration);
  • Print is the only way to see a value from a script — the response carries prints, not the script’s return value.
  • Values are JSON-serialised; a value that cannot be serialised is shown as its string form.
  • The prints share the response byte budget, so printing a whole timeline is itself a way to overflow it. Print ids and counts instead.

Agents: codemode.describe("praxis.cut.script.Print")

Preview

Preview(at: number[]): void
nametypeunitrangedefaultdescription
atnumber[]seconds<= 8 times per execute—Timeline positions to render.

Returns Nothing; the images arrive in the response’s frames object, keyed by the requested seconds (frames["1.5"].url), the same shape frames.list returns — not an array.

Errors FRAME_OUT_OF_RANGE, SCRIPT_LIMIT, RESPONSE_TOO_LARGE.

Example

const track = AddTrack("video", { name: "Preview" });
Insert(track, { type: "color", color: "#172554", start: 0, length: 3 });
Preview([0, 1.5]);
Print(GetTimeline().duration);
  • Each returned url is an inline PNG data URL (data:image/png;base64,...), not an HTTP image link — decode the base64 payload to save the image.
  • A codemode call returns at most 4 images and fails when the result exceeds 1 MiB, so request at most four times per execute from an agent and keep the images small.
  • For frames you did not ask Preview for, read them through praxis.cut.projects.frames.list: its at parameter takes comma-separated seconds (at most 8 per call, the same bound as here) and its scale ranges from above 0 to 0.5 inclusive.
  • At most eight preview times are allowed per execute, and each one counts against the execute command budget.
  • A time outside the project is rejected with FRAME_OUT_OF_RANGE; a frame whose source is unavailable comes back as an offline tile and a FRAME_UNAVAILABLE warning while the edit still commits.

Agents: codemode.describe("praxis.cut.script.Preview")

Fields

Each entry below is also available on its own with codemode.describe("<name>"), or at its anchor on this page.

type

Type"video" | "image" | "text" | "color" | "shape" | "audio" | "caption"
Unit—
Range—
Default—
Applies toevery clip
WritableInsert only
  • Required on every Insert; it cannot be changed afterwards — delete the clip and insert the new type instead.
  • The type must match the track: video tracks accept video, image, text, color and shape; audio and caption tracks accept only their own type.
  • A mismatch is rejected with TRACK_KIND_MISMATCH.
  • Required and optional fields per type (type and start are required for every type, and are not repeated):
  • | type | required beyond type/start | optional | | --- | --- | --- | | video | media | length, sourceIn, playback, volumeDb, transform, fit, blend, animate, animation, effects, mask, transitionIn, transitionOut | | image | media, length | transform, fit, blend, animate, animation, effects, mask, transitionIn, transitionOut | | text | text, length | style, transform, blend, reveal, animate, animation, effects, mask, transitionIn, transitionOut | | color | color, length | transform, fill, blend, animate, animation, effects, mask, transitionIn, transitionOut | | shape | shape, length, width, height, fill | radius, stroke, transform, blend, animate, animation, effects, mask, transitionIn, transitionOut | | audio | media | length, sourceIn, playback, volumeDb, gain, fadeIn, fadeOut, duck | | caption | text, length | — |
  • image, text, color, shape and caption require length; video and audio may omit it and use the remaining source duration.
  • Only fields that apply to the type may be supplied; a field from another type is rejected with UNKNOWN_FIELD.

Agents: codemode.describe("praxis.cut.fields.type")

start

Typenumber
Unitseconds
Range>= 0
Default—
Applies toevery clip
WritableInsert and Update
  • Required on every Insert.
  • Times used for editing are seconds and snap to the project frame rate: start, length, sourceIn, fadeIn/fadeOut, transition length, keyframe at, and reveal delay/stagger/duration.
  • Seconds snap to frames, so the stored value can differ from the one passed by less than a frame; read the clip back when the exact value matters.
  • Two clips on one track may not overlap: a start inside a neighbour’s span is rejected with OVERLAP.
  • To butt-join two clips, use the previous clip’s start + length (read it with GetItem) as the next clip’s start — that is what makes them adjacent enough for Join.
  • Clips that must appear at the same time need separate tracks, not two starts on one track — two text clips shown together, for example, need two text tracks.

Agents: codemode.describe("praxis.cut.fields.start")

length

Typenumber | "auto" (video, audio)
Unitseconds
Range>= 1 frame
Default—
Applies toevery clip; “auto” only on video and audio
WritableInsert and Update
  • Required for image, text, color, shape and caption clips; video and audio may omit it to use the rest of the source, and length: "auto" says the same thing in one word.
  • "auto" on any other clip type is rejected: only video and audio read a source whose remainder could be the length.
  • Frame-snapped like every other time, and it must stay at least one frame long or the call is rejected with TOO_SHORT.
  • A length up to a frame past the end of the source is shortened to the frame the media has, with an INPUT_ADJUSTED warning; a video asked for much more keeps its length and holds its last frame in a freeze clip right after it. A sourceIn already outside the media is still OUT_OF_SOURCE.
  • start + length is the clip’s end, which is the value to feed into the next clip’s start.
  • Changing the length while an animation preset is applied regenerates the preset’s keyframes: shorter shrinks in/out proportionally, longer restores the requested durations.

Agents: codemode.describe("praxis.cut.fields.length")

media

TypeMediaRef
Unit—
Range—
Default—
Applies tovideo, image, audio
WritableInsert and Update
  • Required on an Insert of those types.
  • Update(id, { media }) swaps the source and keeps the clip’s sourceIn, length, transitions, effects and keyframes: video holds its last frame when the new footage is shorter (an INPUT_ADJUSTED warning), audio that no longer fits is rejected with OUT_OF_SOURCE.
  • The library must be bound to the project, or the call fails with UNBOUND_LIBRARY.
  • Script spelling is camelCase: libraryId and assetId. The HTTP names library_id and asset_id are read as the script names, with an INPUT_ADJUSTED warning.
  • Read its metadata with GetMedia({ libraryId, assetId }); durationUs there is in microseconds while editing times are seconds.

Agents: codemode.describe("praxis.cut.fields.media")

sourceIn

Typenumber
Unitseconds
Range>= 0 and inside the source
Default0
Applies tovideo, audio
WritableInsert and Update
  • Frame-snapped like every editing time.
  • sourceOut is not an input: it is derived from sourceIn + length and is returned by GetItem/GetTimeline.
  • sourceOut is exclusive, and for a frozen clip it equals sourceIn.
  • Sliding sourceIn later trims the head without moving the clip on the timeline.

Agents: codemode.describe("praxis.cut.fields.sourceIn")

sourceOut

Typenumber
Unitseconds
Range—
Default—
Applies tovideo, audio
Writableread only
  • Not accepted in Insert or Update; it follows from sourceIn and length (or from SetSpeed).
  • Exclusive: the kept interval is [sourceIn, sourceOut).
  • For a frozen clip, sourceOut equals sourceIn.
  • Use it to carry a source position across a split or re-insert without re-reading the media.

Agents: codemode.describe("praxis.cut.fields.sourceOut")

text

Typestring
Unit—
Range—
Default—
Applies totext, caption
WritableInsert and Update
  • Required on an Insert of a text or caption clip.
  • Changing the text does not re-split it: captions are split by their own rules, and AlignCaptions is the tool for rebuilding a caption track from text.
  • Style is separate: this field carries only the characters.

Agents: codemode.describe("praxis.cut.fields.text")

color

Typestring
Unit—
Range—
Default—
Applies tocolor
WritableInsert and Update
  • Required on an Insert of a color clip.
  • #RRGGBB or #RRGGBBAA.
  • fill overrides it when supplied; on a color clip a gradient fill replaces the solid colour.
  • The project background is a separate setting, changed with SetSettings.

Agents: codemode.describe("praxis.cut.fields.color")

shape

Type"rect" | "ellipse"
Unit—
Range—
Default—
Applies toshape
WritableInsert and Update
  • Required on an Insert of a shape clip, together with width, height and fill.
  • An unknown value is rejected with UNKNOWN_FIELD.
  • For a free-form outline, use a mask rather than a shape clip.

Agents: codemode.describe("praxis.cut.fields.shape")

width

Typenumber
Unit—
Range—
Default—
Applies toshape
WritableInsert and Update
  • A fraction of the canvas width, not pixels: 0.5 is half the canvas wide.
  • Required on an Insert of a shape clip.
  • transform.scale multiplies it, so an animation on scale leaves this value untouched.

Agents: codemode.describe("praxis.cut.fields.width")

height

Typenumber
Unit—
Range—
Default—
Applies toshape
WritableInsert and Update
  • A fraction of the canvas height, not pixels.
  • Required on an Insert of a shape clip.
  • Match aspect deliberately: equal width and height fractions are not a square unless the canvas is square.

Agents: codemode.describe("praxis.cut.fields.height")

radius

Typenumber
Unitpixels at 1080-pixel frame height
Range>= 0
Default—
Applies toshape
WritableInsert and Update
  • Only meaningful for rect; an ellipse is already round.
  • Scales with the frame like every other 1080-relative pixel measurement, so a smaller preview keeps the same look.
  • A value at or above half the shorter side produces a stadium/pill shape.

Agents: codemode.describe("praxis.cut.fields.radius")

fill

Typestring | { linear: { angle, stops } } | { radial: { stops } }
Unit—
Range—
Default—
Applies toshape, text, color
WritableInsert and Update
  • #RRGGBB or #RRGGBBAA, or { linear: { angle, stops: [{ at, color }, ...] } }, or { radial: { stops: [{ at, color }, ...] } }.
  • Stop positions are 0–1; angle is degrees with 0 left to right.
  • On a color clip, fill replaces color when supplied.
  • On text, a gradient spans one bounding box around the complete text.
  • Update(id, { fill: null }) clears it and returns the clip to its solid colour.
  • Required on an Insert of a shape clip.

Agents: codemode.describe("praxis.cut.fields.fill")

stroke

Type{ color: string, width: number }
Unit—
Range—
Default—
Applies toshape
WritableInsert and Update
  • Optional on a shape clip, and optional on Update; stroke: null clears it.
  • Not the same as the text style.strokes array, which draws text outlines.
  • Width is in pixels at a 1080-pixel frame height.

Agents: codemode.describe("praxis.cut.fields.stroke")

transform

TypePartial<{ x, y, scale, rotation, opacity, crop, blur }>
Unit—
Range—
Default—
Applies tovisual clips (video, image, text, color, shape)
WritableInsert and Update
  • x/y are normalized canvas-centre coordinates and default to 0.5, so { x: 0.5, y: 0.5 } is centred.
  • scale 1 is the fitted size; it multiplies the clip’s fitted dimensions.
  • rotation is degrees, default 0.
  • opacity is 0–1, default 1.
  • crop is { top, right, bottom, left }, each a fraction of that side.
  • blur is 0–100 pixels at a 1080-pixel frame height; it is applied after the content and its effects, and before blend.
  • Any field you omit keeps its current value; keyframes in animate override the static value for the properties they cover.

Agents: codemode.describe("praxis.cut.fields.transform")

fit

Type"contain" | "cover" | "fill" | "none"
Unit—
Range—
Defaultcontain
Applies tovideo, image
WritableInsert and Update
  • contain fits the whole image inside the canvas; cover fills the canvas and crops the overflow; fill stretches; none keeps native dimensions.
  • none places source pixels 1:1 on the project canvas and shrinks with it in smaller previews.
  • Combine with transform.scale to size a none clip deliberately.

Agents: codemode.describe("praxis.cut.fields.fit")

blend

Type"normal" | "screen" | "multiply" | "overlay" | "add"
Unit—
Range—
Defaultnormal
Applies tovisual clips
WritableInsert and Update
  • add maps to Skia Plus; the default normal path adds no blend layer.
  • Blending is applied to the completed visual layer after its content, effects and transform.blur.
  • Applied to the completed visual layer — after its content, its effects and transform.blur.
  • During a Join overlap, blending is forced to normal because each input is composed on transparency.
  • Update(id, { blend: null }) clears it.

Agents: codemode.describe("praxis.cut.fields.blend")

style

TypeRichStyle & { preset?: string }
Unit—
Range—
Default—
Applies totext, caption
WritableInsert and Update
  • Shotstack’s recommended shape (RichCaptionAsset / RichTextAsset). Writing in it: style: { font: { family: "Noto Sans SC", size: 64, weight: "bold", color: "#FFE600" }, background: { color: "#000000", opacity: 0.7, borderRadius: 8, padding: 16 } }.
  • font: family, size, weight (a number, or "normal" = 400 / "bold" = 700), color, opacity. background: color, opacity, borderRadius (0–200), padding (0–200). align: horizontal (left / center / right), vertical (top / middle / bottom).
  • style.gradient: { type: "linear" | "radial", angle, stops: [{ offset, color }] }, offsets 0–1. stroke: { width, color, opacity } — width defaults to 0, which draws no outline — and shadow: { offsetX, offsetY, blur, color, opacity }, whose default opacity is 0.5; a stroke’s default colour is black and it is opaque.
  • A gradient is the fill: naming font.color without style.gradient clears any solid fill an earlier write set, and style: { gradient: null } clears it explicitly.
  • Colours are 6 digits with alpha in opacity the Shotstack way; #RGB and #RRGGBBAA also read.
  • Praxis extensions Shotstack has no field for: stroke and shadow may each be an array (multi-layer, outside to inside, at most 4, stroke width 0–40, blur 0–100), glow: { color, radius, strength } (radius 0–100, strength 0–1), and margin, maxWidth, maxLines.
  • active.font: color (current-word colour), background (a rounded patch behind it), size (current-word size in 1080-pixel units, a zoom) and opacity (folded into the colour’s alpha). active.stroke / active.shadow restate the current word’s outline or shadow; "none" removes it.
  • animation.style sets the word animation: highlight (the current word takes active.font.color, #FFE600 if none, and any richer animation an earlier write set is cleared), karaoke (spoken words and the current one stay highlighted), pop (it grows in), fade (words fade in as spoken), slide (they slide in from animation.direction: left / right / up / down, default up), bounce (it springs up) and typewriter (characters appear in turn). none removes the highlight a track style set; a style naming only active.font.color keeps the plain highlight.
  • style.letterSpacing (px at 1080, -20–100), style.lineHeight (0.5–3) and style.textTransform (none / uppercase / lowercase / capitalize) shape the line. border: { width, color, opacity, radius } outlines a box hugging the text (radius defaults to background.borderRadius).
  • A rich stroke replaces the whole outline family; preset names a ListTextStyles() entry and is a starting point — rich fields you supply alongside it override the preset.
  • Update(id, { style: null }) removes a caption’s own style so the line follows its track again.
  • Refused with UNSUPPORTED_STYLE_FIELD, naming the field: font.style, font.background, top-level padding, background.wrap, style.wordSpacing, style.textDecoration and style.size.
  • The older flat spelling (fontSize, color, strokes…) still works and reports STYLE_LEGACY_FIELDS with its rich equivalent; mixing the two in one style is refused with INVALID_STYLE.
  • On a caption clip the field is that one line’s own style: it layers over the track’s style, GetItem reports it as styleOverride, and it must obey the track rule that margin is 0–0.4 of canvas height. A caption style with maxLines: 2 is the track’s limit too.
  • Glow and large shadow blur increase render time.
  • Every dimension is in pixels at a 1080-pixel frame height and scales with the text.
  • Invalid colours or ranges return actionable INVALID_STYLE errors.
  • Discover families with ListFonts(); an unknown family is rejected.

Agents: codemode.describe("praxis.cut.fields.style")

style.align.vertical

Type"top" | "middle" | "bottom"
Unit—
Range—
Default—
Applies totext, caption
WritableInsert and Update
  • Shotstack’s align object places the text block: align.vertical is top, middle or bottom and align.horizontal is left, center or right. Any other value is rejected with INVALID_STYLE.
  • When you do not want to change the placement, leave align.vertical out. Do not pass null — it is not a valid value and the call is rejected.
  • Omitting the field preserves the current position on Update; align.horizontal defaults to center.
  • Use style.margin for the distance from the chosen edge.
  • Position the whole text block vertically; for free placement use transform.y instead.

Agents: codemode.describe("praxis.cut.fields.style.align.vertical")

playback

Type{ kind: "rate", rate, direction, audio } | { kind: "freeze" }
Unit—
Range—
Default—
Applies tovideo, audio
WritableInsert and Update
  • Rate form: { kind: "rate", rate: number, direction: "forward" | "reverse", audio: "preservePitch" | "resample" | "mute" }.
  • Freeze form: { kind: "freeze" } holds sourceIn and is silent.
  • Rate is finite and inclusive 0.25–4; anything outside fails with RATE_OUT_OF_RANGE.
  • Omitted playback defaults to 1× forward with preservePitch. Supply the complete rate object when changing playback — a partial one is rejected with INVALID_PLAYBACK.
  • Reverse requires an explicit audio: "mute"; preservePitch and resample are rejected with UNSUPPORTED_PLAYBACK rather than silently muted.
  • Unknown fields inside the object are rejected with UNKNOWN_FIELD.
  • GetItem/GetTimeline echo the playback and the source interval in seconds; sourceOut is exclusive even for reverse and equals sourceIn for freeze.
  • Updating playback keeps the output length unless length is supplied in the same call.
  • Browser reverse playback currently displays a placeholder; server-rendered Preview/frames and exports support reverse normally.
  • Speed-adjusted audio is generated asynchronously after the edit transaction commits, and exports wait for it.

Agents: codemode.describe("praxis.cut.fields.playback")

volumeDb

Typenumber
UnitdB
Range—
Default0
Applies tovideo, audio
WritableInsert and Update
  • Both Insert and Update accept it — the writable field set is the same for the two calls.
  • Negative values quieten, positive values raise the level.
  • volumeDb is a static level; gain is the keyframed version of the same idea, and duck lowers a bed under another track.
  • Track-level level is separate: use UpdateTrack with gainDb.

Agents: codemode.describe("praxis.cut.fields.volumeDb")

gain

Type{ at: number, value: number, ease?: Ease }[]
Unitseconds (at), dB (value)
Range—
Default—
Applies toaudio
WritableInsert and Update
  • at is seconds relative to the clip’s own start, exactly like animate keyframes.
  • Use it when the level must change during the clip; volumeDb sets one level for the whole clip.
  • duck is the automatic version: it lowers a bed while another track is audible.

Agents: codemode.describe("praxis.cut.fields.gain")

fadeIn

Typenumber
Unitseconds
Range>= 0
Default0
Applies toaudio
WritableInsert and Update
  • A fade is an audio level ramp, not a visual transition: for picture use transitionIn.
  • Frame-snapped like every other time.
  • A fade longer than the clip is rejected.

Agents: codemode.describe("praxis.cut.fields.fadeIn")

fadeOut

Typenumber
Unitseconds
Range>= 0
Default0
Applies toaudio
WritableInsert and Update
  • Mirror of fadeIn, measured back from the clip’s end.
  • Frame-snapped, and it must fit inside the clip.
  • For a picture fade at the end of a clip use transitionOut.

Agents: codemode.describe("praxis.cut.fields.fadeOut")

duck

Type{ under: TrackId, toDb, attack, release, mode?, hold? } | null
Unit—
Range—
Default—
Applies toaudio
WritableInsert and Update
  • under names the track the duck listens to; toDb is the lowered level.
  • toDb ranges from -60 to 0 dB.
  • attack and release are seconds and shape how fast the level moves.
  • mode is "occupancy" (the default) or "level". Omit it and nothing about the duck changes.
  • "occupancy": the duck triggers on the clip occupancy of the under track — while a clip there is audible, this clip is lowered. It never inspects the waveform, so a under clip that happens to be silent still ducks.
  • "level": the duck triggers on the under track’s measured level instead. The mix measures that track’s RMS per frame and lowers this clip only where the level is above -40 dBFS, following the same attack/release rates. A voice track that holds a clip but is silent inside it therefore no longer ducks the music.
  • Level ducking is measured at export and draft time, so the result depends on the actual audio rather than on the edit alone.
  • hold is seconds (default 1.5, at most 10): the music stays lowered that long after the voice stops before the release begins, so a pause between sentences does not let it swell back up. Without a hold the bed rises at every pause and pumps; the mix measurement lists those swells in music_swells.
  • Under continuous narration keep the default occupancy duck: the bed stays down through the whole voice-over. Sit the music about 20 dB under the voice and duck it by 6–10 dB; a deeper duck makes every change audible.
  • Update(id, { duck: null }) clears it, and invalid values are rejected with INVALID_DUCK.

Agents: codemode.describe("praxis.cut.fields.duck")

animate

TypePartial<Record<"x" | "y" | "scale" | "rotation" | "opacity" | "blur", { at, value, ease? }[]>>
Unitseconds (at)
Range—
Default—
Applies tovisual clips
WritableInsert and Update
  • at is measured in seconds relative to the clip’s own start, not from the timeline — a keyframe at at: 0 is the clip’s first frame, and it moves with the clip when you Move it.
  • Each property’s array must be sorted by at with distinct frame-snapped times.
  • Values hold before the first keyframe and after the last one, overriding the static transform value for that property.
  • ease shapes the segment arriving at that keyframe: linear, in, out, inOut, { bezier: [x1,y1,x2,y2] } or { spring: { stiffness, damping, mass? } }.
  • Springs may overshoot the target value.
  • Writing animate detaches any animation preset on the clip; animate: null removes the keyframes.
  • Each property is limited to 600 keyframes.

Agents: codemode.describe("praxis.cut.fields.animate")

reveal

Type{ by, delay?, stagger, duration, from, ease? }
Unitseconds
Range—
Default—
Applies totext
WritableInsert and Update
  • by selects char, word or line.
  • Unit k starts at delay + k * stagger and takes duration seconds to reach its resting state.
  • from holds the starting look: { y?, opacity?, scale?, blur? }.
  • from.y is a fraction of the font size, not a pixel offset.
  • All times are seconds and frame-snapped, like every other editing time.
  • Supplying reveal together with animation in one call is rejected; reveal: null removes the effect.

Agents: codemode.describe("praxis.cut.fields.reveal")

animation

Type{ in?: AnimationUse, out?: AnimationUse, loop?: AnimationUse } | null
Unit—
Range—
Default—
Applies tovisual clips
WritableInsert and Update
  • Each slot use is { preset, duration?, ...params }; discover the ids with ListAnimations().
  • Presets replace the clip’s existing animate and reveal when applied, and the source preset is retained so a length or transform change regenerates the keyframes automatically.
  • If the clip gets shorter, in/out durations shrink proportionally; when it grows, the requested durations return.
  • Split keeps in on the left, out on the right and loop on both.
  • Writing animate or reveal directly detaches the preset; Update with animation: null clears both source and generated effects.
  • Supplying animation together with animate or reveal in one call is rejected.
  • A text-target preset’s duration controls the rhythm per character/word/line, not the total reveal time; out and loop presets apply to the whole clip.
  • Each animated property is limited to 600 keyframes and a loop period must be at least 4 frames.

Agents: codemode.describe("praxis.cut.fields.animation")

effects

TypeEffectEntryView[] | null
Unit—
Range—
Default—
Applies tovisual clips
WritableInsert and Update
  • Call ListEffects() to discover the catalog; an unknown kind is rejected with UNKNOWN_EFFECT and invalid names/values/keyframes with INVALID_EFFECT_PARAM.
  • Entries include blur, colour adjustment, vignette, film grain, chromatic aberration, pixelate, glitch, shake, flash, light leak and built-in lut looks; user .cube LUTs are not supported, and there are no custom shaders.
  • The catalog entry carries each parameter’s own range: blur takes radius 0–100 (default 24), while color_adjust takes brightness, contrast, temperature and tint each -1–1 (default 0) and saturation 0–2 (default 1).
  • color_adjust uses an SDR-only Rec.709 adjustment matrix with no colour management.
  • speed is cycles per second for animated effects.
  • More than 8 entries is rejected with TOO_MANY_EFFECTS, and disabled entries are skipped rather than removed.
  • Numeric and integer parameters accept keyframes: { parameter: [{ at, value, ease? }, ...] } with clip-local seconds that snap to frames and must increase strictly inside the clip.
  • Omitted parameters use the catalog defaults.
  • Trim and Split preserve effect keyframes with the same clip-local behaviour as animate.
  • Effects run on the CPU during export and increase render time, especially blur and animated treatments.
  • Update(id, { effects: null }) clears the stack.

Agents: codemode.describe("praxis.cut.fields.effects")

transitionIn

Type{ kind, length } | null
Unitseconds (length)
Range—
Default—
Applies tovisual clips
WritableInsert and Update
  • length is seconds and must fit inside the clip.
  • fade changes opacity, dissolve blends, push_left/push_right move horizontally, wipe_left reveals horizontally.
  • This is the alternative to Join when clips must not move: a per-clip entrance never shifts the track or its followers, so it is the tool for staying aligned to a fixed audio bed.
  • Update(id, { transitionIn: null }) removes it.

Agents: codemode.describe("praxis.cut.fields.transitionIn")

transitionOut

Type{ kind, length } | null
Unitseconds (length)
Range—
Default—
Applies tovisual clips
WritableInsert and Update
  • Mirror of transitionIn, measured back from the clip’s end.
  • Because it moves nothing on the timeline, it keeps the following clips and the audio where they are.
  • Update(id, { transitionOut: null }) removes it.

Agents: codemode.describe("praxis.cut.fields.transitionOut")

mask

TypeVisualMaskView | null
Unit—
Range—
Default—
Applies tovisual clips
WritableInsert and Update
  • A mask comes from a shape (rect, ellipse or an SVG path) or from another video track (alpha or luma).
  • It supports invert, enabled, feather, transform and its own clip-relative keyframes.
  • A track mask must reference a separate visual track and may not form a cycle.
  • Shape/path dimensions and feather are normalized to the canvas; keyframe times are seconds.
  • Invalid definitions are rejected with INVALID_MASK, a mask still in use blocks destructive edits with MASK_IN_USE, and a project is limited to 16 masks (TOO_MANY_MASKS).
  • Update(id, { mask: null }) clears it.

Agents: codemode.describe("praxis.cut.fields.mask")

words

Type{ text: string, start: number, length: number }[]
Unit—
Range—
Default—
Applies tocaption
WritableUpdate
  • Each entry is one word with its own text, start and length.
  • Times are relative to the caption clip, in seconds.
  • Editing the words directly is the fine-grained path; AlignCaptions rebuilds a whole track from text and AddCaptionsFromTranscript builds one from a media clip.
  • Insert does not take words; create the caption with text and adjust the words afterwards.

Agents: codemode.describe("praxis.cut.fields.words")

Error codes

Each entry below is also available on its own with codemode.describe("<name>"), or at its anchor on this page.

JOIN_CONFLICT

Surface operation rejection (error.code OPS_REJECTED, details.rejections[])

Meaning The join geometry the edit would leave is not allowed, so the whole transaction is rolled back.

Common causes

  • The two clips are not butt-adjacent (the right clip does not start exactly where the left ends).
  • A clip already has an incoming or outgoing join and the new one would be a second.
  • The summed join lengths would exceed a clip’s length.
  • Three-input overlaps, nonadjacent endpoints or a cross-track join.
  • The edit would delete, split, move or trim a clip that still takes part in a join.

How to fix Read GetTimeline().joins, shorten or DeleteJoin the conflicting join, make the endpoints butt-adjacent again, and retry the saved edit.

Agents: codemode.describe("praxis.cut.errors.JOIN_CONFLICT")

INVALID_TRANSITION

Surface operation rejection (error.code OPS_REJECTED, details.rejections[])

Meaning The transition object does not match the shared catalog that ListTransitions() returns.

Common causes

  • A kind that is not in ListTransitions().
  • A parameter name the kind does not declare, or a value outside its documented range.
  • length that is zero, negative or not frame-aligned.
  • A transition long enough to overrun the clip it belongs to.

How to fix Call ListTransitions() and build the effect from the returned kind and parameter names; set a positive length that fits inside the clip.

Agents: codemode.describe("praxis.cut.errors.INVALID_TRANSITION")

INVALID_STYLE

Surface operation rejection (error.code OPS_REJECTED, details.rejections[])

Meaning One of the style fields failed validation; the message names the field and the accepted values.

Common causes

  • style.position set to anything other than top, middle or bottom — including null.
  • A colour string that is not #RRGGBB or #RRGGBBAA.
  • A numeric field outside its range, such as stroke width above 40, more than 4 strokes or shadows, glow radius above 100.
  • A font weight the chosen family does not have.

How to fix Read the message for the named field and use a value the style model accepts; to leave placement unchanged, omit position instead of passing null.

Agents: codemode.describe("praxis.cut.errors.INVALID_STYLE")

UNSUPPORTED_STYLE_FIELD

Surface operation rejection (error.code OPS_REJECTED, details.rejections[])

Meaning The style is written in Shotstack’s rich shape, and the named field is part of that shape but has no rendering on this platform yet, so the write is refused rather than silently dropped.

Common causes

  • font.style, font.background, background.wrap, top-level padding.
  • style.wordSpacing, style.textDecoration, style.size.

How to fix Drop the field, or use the supported one the message names: style.background.borderRadius / style.background.padding for a box, border for an outlined box, animation.style for a word animation.

Agents: codemode.describe("praxis.cut.errors.UNSUPPORTED_STYLE_FIELD")

STYLE_LEGACY_FIELDS

Surface warnings[] on a successful cut.projects.execute response (never a rejection)

Meaning The style was written in this platform’s internal flat shape (fontSize, color, strokes…) instead of Shotstack’s rich shape (font.size, stroke, align…). It was applied exactly as written; the warning carries the same style in the Shotstack spelling so the next write can use it.

Common causes

  • A script written before the rich shape was published.
  • A style copied out of an older example or out of a stored internal snapshot.

How to fix Nothing is required. Paste the style the warning prints (font, stroke, shadow, background, align, active/animation, plus the glow / margin / maxWidth / maxLines extensions) to write in the current spelling.

Agents: codemode.describe("praxis.cut.errors.STYLE_LEGACY_FIELDS")

INVALID_MASK

Surface operation rejection (error.code OPS_REJECTED, details.rejections[])

Meaning The mask failed validation against the mask model.

Common causes

  • A mask kind that is not rect, ellipse, path, alpha or luma.
  • A track mask that names the clip’s own track, a non-visual track, or forms a cycle.
  • Normalized values outside 0–1 for shape geometry or feather.
  • A keyframe time outside the clip.

How to fix Use a separate visual track for a track mask, keep normalized values within 0–1, and read GetTimeline() to confirm the referenced track exists.

Agents: codemode.describe("praxis.cut.errors.INVALID_MASK")

MASK_IN_USE

Surface operation rejection (error.code OPS_REJECTED, details.rejections[])

Meaning A destructive change to a masked resource was refused because live references still depend on it.

Common causes

  • Deleting or restructuring a track that is the source of an alpha/luma track mask.
  • Changing a clip that other masks point at in a way that invalidates them.

How to fix Remove the dependent masks first (set mask: null on the clips that use them), then repeat the destructive edit.

Agents: codemode.describe("praxis.cut.errors.MASK_IN_USE")

TOO_MANY_MASKS

Surface operation rejection (error.code OPS_REJECTED, details.rejections[])

Meaning The edit would create more masks than the project limit allows.

Common causes

  • Adding masks to clips beyond the 16th.
  • Repeated inserts that each carry a new mask.

How to fix Reuse one mask across clips instead of duplicating it, or clear masks you no longer need with mask: null.

Agents: codemode.describe("praxis.cut.errors.TOO_MANY_MASKS")

RATE_OUT_OF_RANGE

Surface operation rejection (error.code OPS_REJECTED, details.rejections[])

Meaning Scalar playback rates must be finite and inclusive between 0.25 and 4.

Common causes

  • SetSpeed(id, 0.1, …) or SetSpeed(id, 10, …).
  • A playback.rate outside the same interval.
  • A curve knot rate outside it.

How to fix Use a rate within 0.25–4; for a bigger change, chain edits or split the clip.

Agents: codemode.describe("praxis.cut.errors.RATE_OUT_OF_RANGE")

UNSUPPORTED_PLAYBACK

Surface operation rejection (error.code OPS_REJECTED, details.rejections[])

Meaning The requested playback is valid in shape but not supported for this clip.

Common causes

  • direction: "reverse" without audio: "mute".
  • Pitch preservation requested on a reverse or curve playback.
  • SetSpeed on a frozen clip.

How to fix Reverse requires explicit audio: "mute": Update(id, { playback: { kind: "rate", rate: 1, direction: "reverse", audio: "mute" } }).

Agents: codemode.describe("praxis.cut.errors.UNSUPPORTED_PLAYBACK")

INVALID_PLAYBACK

Surface operation rejection (error.code OPS_REJECTED, details.rejections[])

Meaning The playback object does not match the rate or freeze shape.

Common causes

  • A partial rate object, such as { kind: "rate", rate: 2 } with no direction or audio.
  • A kind that is not rate, freeze or curve.
  • Numeric fields that are not finite numbers.

How to fix Supply the complete rate object: { kind: "rate", rate, direction, audio }, or { kind: "freeze" }.

Agents: codemode.describe("praxis.cut.errors.INVALID_PLAYBACK")

UNKNOWN_FONT

Surface operation rejection (error.code OPS_REJECTED, details.rejections[])

Meaning The requested family is not available to the renderer.

Common causes

  • A family name with different capitalisation or spacing.
  • A font assumed from a local system rather than the catalog.

How to fix Call ListFonts() and use a returned family verbatim; check weights and scripts before choosing.

Agents: codemode.describe("praxis.cut.errors.UNKNOWN_FONT")

UNKNOWN_FIELD

Surface operation rejection (error.code OPS_REJECTED, details.rejections[])

Meaning The script used a key the target object does not declare. Scripts use camelCase everywhere, including nested objects, while HTTP request and response JSON outside script source uses snake_case.

Common causes

  • Snake_case names carried over from HTTP JSON: library_id → libraryId, asset_id → assetId, source_in → sourceIn, volume_db → volumeDb, fade_in/fade_out → fadeIn/fadeOut, transition_in/transition_out → transitionIn/transitionOut, font_family/font_size/font_weight/max_width → fontFamily/fontSize/fontWeight/maxWidth, gain_db → gainDb, highlight_color/max_lines → highlightColor/maxLines.
  • A field that belongs to another clip type.
  • A made-up option such as remove: true on Delete.
  • An option on SetSpeed other than keep and ripple.

How to fix Use the camelCase name as the message suggests and keep only fields that apply to the clip’s type. Fields such as animate, reveal, fill, stroke, at and length keep their spelling, and GetTimeline/GetItem already return camelCase compact views — the expanded retrieveTimeline HTTP response is not an Insert object and cannot be pasted back.

Agents: codemode.describe("praxis.cut.errors.UNKNOWN_FIELD")

UNKNOWN_TEXT_STYLE

Surface operation rejection (error.code OPS_REJECTED, details.rejections[])

Meaning The named text style preset does not exist.

Common causes

  • A typo in the preset id.
  • A preset remembered from a different project or version.

How to fix Call ListTextStyles() and use a returned id, or supply explicit style fields instead of a preset.

Agents: codemode.describe("praxis.cut.errors.UNKNOWN_TEXT_STYLE")

TEXT_STYLE_TARGET_MISMATCH

Surface operation rejection (error.code OPS_REJECTED, details.rejections[])

Meaning Text style presets declare the target they are meant for, and the clip does not match it.

Common causes

  • A text-only preset applied to a caption track.
  • A caption preset applied to a text clip.

How to fix Apply the preset to a clip of the type the preset targets, or use explicit fields that the target accepts.

Agents: codemode.describe("praxis.cut.errors.TEXT_STYLE_TARGET_MISMATCH")

CAPTION_ALIGN_LOW_CONFIDENCE

Surface operation rejection (error.code OPS_REJECTED, details.rejections[])

Meaning AlignCaptions refuses to rewrite a caption track when the alignment is unreliable, and leaves the track unchanged.

Common causes

  • A script that differs substantially from the spoken words.
  • Too little existing caption text to align against.
  • Punctuation that implies splits the audio cannot support.

How to fix Supply the text actually spoken, or import timed cues instead with ImportCaptions.

Agents: codemode.describe("praxis.cut.errors.CAPTION_ALIGN_LOW_CONFIDENCE")

OVERLAP

Surface operation rejection (error.code OPS_REJECTED, details.rejections[])

Meaning Same-track clips may not overlap, so the edit was refused instead of silently shifting or dropping a clip. An overlap of two frames or less is not this error: it is a rounding, absorbed with an INPUT_ADJUSTED warning.

Common causes

  • A new clip starting more than two frames before the previous clip on that track ends.
  • A length change or SetSpeed that grows a clip into its neighbour.
  • Moving a clip onto an occupied span.
  • Imported or generated captions landing where captions already are.

How to fix Move or shorten the conflicting clip, use the previous clip’s start + length (read it with GetItem) as the next start, or pass ripple: true where the function accepts it to shift followers explicitly.

Agents: codemode.describe("praxis.cut.errors.OVERLAP")

OUT_OF_SOURCE

Surface operation rejection (error.code OPS_REJECTED, details.rejections[])

Meaning The requested length or rate reads past the end of the source, by more than a rounding. A clip that only rounds past the media end is shortened to the frame the media has; a video asked for a length it does not have holds its last frame instead; both warn with INPUT_ADJUSTED rather than fail.

Common causes

  • A sourceIn already at or past the media duration — no clip can read anything there.
  • A slower scalar rate with keep: "source", which needs more source per output second.
  • Trimming or extending the out edge past the media end.
  • An animate/reveal clip longer than its footage, which cannot be split into a hold.

How to fix Reduce length, use a faster rate, or raise sourceIn so fewer source frames are skipped before the clip starts.

Agents: codemode.describe("praxis.cut.errors.OUT_OF_SOURCE")

LOCKED_TRACK

Surface operation rejection (error.code OPS_REJECTED, details.rejections[])

Meaning A locked track refuses changes to its clips and to itself.

Common causes

  • Editing a clip on a track locked with UpdateTrack(id, { locked: true }).
  • RippleDeleteRange naming a locked track.

How to fix Unlock the track with UpdateTrack, make the edit, then lock it again if you need the protection.

Agents: codemode.describe("praxis.cut.errors.LOCKED_TRACK")

UNBOUND_LIBRARY

Surface operation rejection (error.code OPS_REJECTED, details.rejections[])

Meaning The project may only read from libraries bound to it.

Common causes

  • An asset from a library never bound to this project.
  • A binding deleted earlier.
  • A libraryId typo.

How to fix Bind the library to the project, then retry; read bindings with the project’s bindings endpoint to confirm the id.

Agents: codemode.describe("praxis.cut.errors.UNBOUND_LIBRARY")

TRACK_KIND_MISMATCH

Surface operation rejection (error.code OPS_REJECTED, details.rejections[])

Meaning Video tracks hold visual clips, audio tracks hold audio, and caption tracks hold captions — never across.

Common causes

  • Inserting an audio clip on a video track.
  • Moving a visual clip onto an audio track.
  • Running a caption function on a track that is not a caption track.

How to fix Insert or move the clip onto a track of its own kind; AddTrack creates one.

Agents: codemode.describe("praxis.cut.errors.TRACK_KIND_MISMATCH")

NOT_FOUND

Surface operation rejection (error.code OPS_REJECTED, details.rejections[])

Meaning A clip, track, join or marker id was not found, or belongs to another project.

Common causes

  • An id from a previous script that was deleted since.
  • A guessed id instead of one returned by a create function.
  • A clip from a different project.

How to fix Read the current ids with GetTimeline() (tracks[].items[].id, joins) and use those rather than remembered ids.

Agents: codemode.describe("praxis.cut.errors.NOT_FOUND")

TOO_SHORT

Surface operation rejection (error.code OPS_REJECTED, details.rejections[])

Meaning The result of the edit has no usable length.

Common causes

  • A length under one frame.
  • Split at or outside the clip’s edges.
  • RippleDeleteRange over an interval shorter than one frame.
  • A transition longer than half the shorter neighbouring clip.

How to fix Lengthen the clip or interval, split strictly inside the clip, and shorten the transition to fit its neighbours.

Agents: codemode.describe("praxis.cut.errors.TOO_SHORT")

INVALID_DUCK

Surface operation rejection (error.code OPS_REJECTED, details.rejections[])

Meaning The ducking definition does not match { under, toDb, attack, release }.

Common causes

  • toDb outside -60 to 0.
  • A missing or unknown under track.
  • Negative attack or release.

How to fix Name an existing audio track in under and keep toDb within -60–0 dB with non-negative times.

Agents: codemode.describe("praxis.cut.errors.INVALID_DUCK")

UNKNOWN_ANIMATION

Surface operation rejection (error.code OPS_REJECTED, details.rejections[])

Meaning animation referenced a preset that ListAnimations() does not return.

Common causes

  • A guessed preset name.
  • A preset version from a different catalog revision.

How to fix Call ListAnimations() and use a returned id in the slot’s preset.

Agents: codemode.describe("praxis.cut.errors.UNKNOWN_ANIMATION")

INVALID_ANIMATION_PARAM

Surface operation rejection (error.code OPS_REJECTED, details.rejections[])

Meaning The slot use does not match the preset’s declared parameters or the platform’s keyframe limits.

Common causes

  • A parameter the preset does not declare, or a value outside its range.
  • More than one preset in the same slot.
  • A generated property exceeding 600 keyframes.
  • A loop period shorter than 4 frames.

How to fix Build the slot from the catalog’s params and keep the clip long enough for the requested loop.

Agents: codemode.describe("praxis.cut.errors.INVALID_ANIMATION_PARAM")

ANIMATION_TOO_LONG

Surface operation rejection (error.code OPS_REJECTED, details.rejections[])

Meaning The entrance and exit cannot both fit inside the clip.

Common causes

  • A short clip with a long preset duration.
  • Applying a preset to a clip that was shortened first.

How to fix Shorten the preset durations or lengthen the clip; later length changes fit the durations proportionally instead of failing.

Agents: codemode.describe("praxis.cut.errors.ANIMATION_TOO_LONG")

ANIMATION_TARGET_MISMATCH

Surface operation rejection (error.code OPS_REJECTED, details.rejections[])

Meaning Text-target presets need text; every preset needs a visual clip.

Common causes

  • A text-only preset on a color or video clip.
  • A preset applied to an audio or caption clip.

How to fix Use a preset whose target matches the clip, discovered from ListAnimations().

Agents: codemode.describe("praxis.cut.errors.ANIMATION_TARGET_MISMATCH")

ANIMATION_PHASE_MISMATCH

Surface operation rejection (error.code OPS_REJECTED, details.rejections[])

Meaning An in preset belongs in in, an out preset in out, and a loop preset in loop.

Common causes

  • A loop preset passed as in.
  • An entrance preset passed as out.

How to fix Check the preset’s phase in ListAnimations() and put it in the matching slot.

Agents: codemode.describe("praxis.cut.errors.ANIMATION_PHASE_MISMATCH")

UNKNOWN_EFFECT

Surface operation rejection (error.code OPS_REJECTED, details.rejections[])

Meaning effects referenced a kind ListEffects() does not return.

Common causes

  • A guessed effect name.
  • A custom shader, which is not supported.

How to fix Call ListEffects() and use a returned kind; user .cube LUTs and custom shaders are not available.

Agents: codemode.describe("praxis.cut.errors.UNKNOWN_EFFECT")

INVALID_EFFECT_PARAM

Surface operation rejection (error.code OPS_REJECTED, details.rejections[])

Meaning The effect entry does not match its catalog parameter declarations.

Common causes

  • A parameter the effect does not declare.
  • A value outside the catalog range.
  • Keyframes that are not strictly increasing, fall outside the clip, or do not follow the parameter’s range.

How to fix Read the entry’s parameters from ListEffects() and keep keyframes clip-local, strictly increasing and inside the clip.

Agents: codemode.describe("praxis.cut.errors.INVALID_EFFECT_PARAM")

TOO_MANY_EFFECTS

Surface operation rejection (error.code OPS_REJECTED, details.rejections[])

Meaning The ordered effect stack is limited to 8 catalog entries.

Common causes

  • Appending effects without removing old ones.
  • A preset that adds effects to an already full stack.

How to fix Keep the stack at or below 8 entries; replace rather than append, since effects writes the whole stack.

Agents: codemode.describe("praxis.cut.errors.TOO_MANY_EFFECTS")

PROJECT_NOT_FOUND

Surface top-level error.code on the response

Meaning The project id does not exist, or the caller may not see it.

Common causes

  • A deleted project.
  • A project id from another organization.
  • A typo in the id.

How to fix List projects to obtain a current id; a project the caller cannot see is deliberately indistinguishable from a missing one.

Agents: codemode.describe("praxis.cut.errors.PROJECT_NOT_FOUND")

EXPORT_NOT_FOUND

Surface top-level error.code on the response

Meaning The export id is unknown or already purged.

Common causes

  • An export from a different project.
  • A stale id kept across sessions.

How to fix List the project’s exports and use a current id.

Agents: codemode.describe("praxis.cut.errors.EXPORT_NOT_FOUND")

DRAFT_RENDER_NOT_FOUND

Surface top-level error.code on the response

Meaning The render id is unknown, belongs to another project, or its 24-hour file has expired.

Common causes

  • A render id from a different project.
  • A draft older than 24 hours.

How to fix Request a new draft with projects.renders.create for the range you need.

Agents: codemode.describe("praxis.cut.errors.DRAFT_RENDER_NOT_FOUND")

VERSION_NOT_FOUND

Surface top-level error.code on the response

Meaning The version id or revision is not in this project’s history.

Common causes

  • A revision from another project.
  • A version pruned before the call.

How to fix List the project’s versions and restore one from the returned ids.

Agents: codemode.describe("praxis.cut.errors.VERSION_NOT_FOUND")

LIBRARY_NOT_FOUND

Surface top-level error.code on the response

Meaning A binding operation named a library the caller cannot reach.

Common causes

  • A library id typo.
  • A library in another organization.

How to fix List the libraries available to the organization and bind one of those ids.

Agents: codemode.describe("praxis.cut.errors.LIBRARY_NOT_FOUND")

BINDING_INVALID

Surface top-level error.code on the response

Meaning The binding input failed validation before anything was written.

Common causes

  • A missing library id.
  • A library the credential cannot bind.

How to fix Supply a library id the organization can bind; read the bindings endpoint to see what is already bound.

Agents: codemode.describe("praxis.cut.errors.BINDING_INVALID")

BINDING_IN_USE

Surface top-level error.code on the response

Meaning Unbinding would leave live clips pointing at unreachable media, so it is refused.

Common causes

  • Deleting a binding while clips on the timeline use assets from that library.

How to fix Remove or replace the clips that use the library’s assets, then delete the binding.

Agents: codemode.describe("praxis.cut.errors.BINDING_IN_USE")

NOTHING_TO_UNDO

Surface top-level error.code on the response

Meaning The project is already at the oldest retained revision.

Common causes

  • Undo repeated past the start of the retained history.
  • Undo immediately after creating the project.

How to fix Read the current state before undoing; there is nothing older to return to.

Agents: codemode.describe("praxis.cut.errors.NOTHING_TO_UNDO")

NOTHING_TO_REDO

Surface top-level error.code on the response

Meaning Nothing was undone, or a new edit replaced the redo branch.

Common causes

  • Redo after a fresh edit.
  • Redo with no prior undo.

How to fix Read the state and continue editing; redo only exists immediately after an undo.

Agents: codemode.describe("praxis.cut.errors.NOTHING_TO_REDO")

UNDO_CONFLICT

Surface top-level error.code on the response

Meaning The caller expected to undo a specific revision and the head moved.

Common causes

  • Another edit landed between the read and the undo.
  • A saved undo script replayed later.

How to fix Re-read the state to learn the current head, then prepare the undo against it.

Agents: codemode.describe("praxis.cut.errors.UNDO_CONFLICT")

REVISION_CONFLICT

Surface top-level error.code on the response

Meaning The guarded edit was refused because its expected_revision is stale — this is the normal optimistic-concurrency failure, not a script bug.

Common causes

  • Another client edited the project between your read and your execute.
  • A retry that reused an old expected_revision.
  • A revision conflict raised while preparing the response after the edit itself committed.

How to fix Read the current state first; if your edit already committed, do not retry it. Otherwise rerun against the new revision.

Agents: codemode.describe("praxis.cut.errors.REVISION_CONFLICT")

CUT_BUSY

Surface top-level error.code on the response

Meaning One edit at a time runs per project, and the slot was taken.

Common causes

  • Concurrent executes on the same project.
  • A long export or analysis holding the project.

How to fix Retry after a short wait; this is retryable and safe to repeat with the same input.

Agents: codemode.describe("praxis.cut.errors.CUT_BUSY")

INVALID_CAPTION_FILE

Surface top-level error.code on the response

Meaning The caption file could not be read, and the reported line names where.

Common causes

  • More than 100000 bytes or more than 5000 cues.
  • A malformed timecode, or an end before the start.
  • Cues that overlap inside the file.

How to fix Fix the file at the reported line, or split it into smaller imports; overlap with clips already on the track reports OVERLAP instead.

Agents: codemode.describe("praxis.cut.errors.INVALID_CAPTION_FILE")

SCRIPT_ERROR

Surface top-level error.code on the response

Meaning Execution stopped before any edit was committed, and details.line/column point at the failure when known.

Common causes

  • A syntax error in the script source.
  • A runtime exception such as reading a property of undefined.
  • Calling a function that does not exist, such as Remove instead of Delete.

How to fix Read the line and message, fix the script, and rerun; nothing was written by the failed attempt.

Agents: codemode.describe("praxis.cut.errors.SCRIPT_ERROR")

SCRIPT_LIMIT

Surface top-level error.code on the response

Meaning A hard execute limit stopped the run before commit.

Common causes

  • More than 64 KiB of script source, or more than 5000 commands.
  • Wall clock above 10 seconds or memory above 32 MiB.
  • More than 32 uncached media lookups, or more than 8 preview times.

How to fix Split the work into several executes, narrow reads with GetTimeline({ from, to, tracks }), and cache media facts in variables instead of re-reading them.

Agents: codemode.describe("praxis.cut.errors.SCRIPT_LIMIT")

OPS_REJECTED

Surface top-level error.code on the response

Meaning Every operation is applied atomically, so a single bad op rejects the entire edit and nothing is written.

Common causes

  • Any operation rejection code, listed in details.rejections[] with #opIndex, code and reason.
  • A field that does not apply to the clip’s type.

How to fix Read each rejection’s #opIndex, code and reason, fix exactly those operations, and retry the saved edit rather than assuming a field was ignored.

Agents: codemode.describe("praxis.cut.errors.OPS_REJECTED")

EDIT_EXPIRED

Surface top-level error.code on the response

Meaning A failed script is kept briefly so it can be repaired with edit_id and literal edits, and that window has closed.

Common causes

  • Repairing a failed edit more than ten minutes after it failed.

How to fix Rerun the corrected script as new script source instead of repairing the expired id.

Agents: codemode.describe("praxis.cut.errors.EDIT_EXPIRED")

MEDIA_NOT_FOUND

Surface top-level error.code on the response

Meaning The media library has no asset with this id: nothing is wrong with the media service or the asset’s bytes.

Common causes

  • A mistyped or shortened asset id (ids are 32 characters).
  • An asset from another library, or one that was deleted.

How to fix List the library’s assets (praxis.media.libraries.assets.list) and use the full id it returns.

Agents: codemode.describe("praxis.cut.errors.MEDIA_NOT_FOUND")

MEDIA_OFFLINE

Surface top-level error.code on the response

Meaning The library knows the asset, but its bytes are unreachable right now.

Common causes

  • The upstream file was moved or deleted.
  • A temporary fetch failure.

How to fix Retry later; if it persists, re-import the asset into the library and point the clip at the new asset.

Agents: codemode.describe("praxis.cut.errors.MEDIA_OFFLINE")

MEDIA_UNAVAILABLE

Surface top-level error.code on the response

Meaning The asset exists but cannot be decoded or streamed in the requested way.

Common causes

  • An unsupported container or codec.
  • A partially imported asset.
  • A source that only serves a range the renderer cannot use.

How to fix Re-import the media through the media API so it is transcoded into a supported form, then retry.

Agents: codemode.describe("praxis.cut.errors.MEDIA_UNAVAILABLE")

MEDIA_IMPORT_FAILED

Surface top-level error.code on the response

Meaning The platform could not fetch or store the asset, so no usable asset was created.

Common causes

  • A source URL that is not publicly fetchable.
  • A remote server that refused the request.
  • A storage failure during import.

How to fix Check that the URL is publicly reachable, fix access on the source, and retry the import.

Agents: codemode.describe("praxis.cut.errors.MEDIA_IMPORT_FAILED")

MEDIA_PROCESSING

Surface top-level error.code on the response

Meaning A script verb (Matte, EnhanceVoice, AlignByAudio, Reframe, Upscale, Redact) asked media to process a clip’s source, and the job has not finished. Nothing was committed: run the same script again once the job completes and the derived result is read from the cache.

Common causes

  • The first run of a processing verb: media accepted the job but is still queued or running.
  • Rerunning before the job named in error.details.jobId has completed.

How to fix Read the job with praxis.media.libraries.jobs.retrieve ({ libraryId, jobId } from error.details); wait until it is completed, then run the same script again.

Agents: codemode.describe("praxis.cut.errors.MEDIA_PROCESSING")

MEDIA_PROCESSING_FAILED

Surface top-level error.code on the response

Meaning The processing job a verb requested ended as failed, or reported completed without the derived asset or align result the verb needs. The run committed nothing.

Common causes

  • The source is unsuitable for the operation (for example a silent clip for EnhanceVoice, or no faces for Redact).
  • A media-side failure while running the job.

How to fix Read the job with praxis.media.libraries.jobs.retrieve for its failures, fix or replace the source, and run the script again.

Agents: codemode.describe("praxis.cut.errors.MEDIA_PROCESSING_FAILED")

ALIGNMENT_UNCERTAIN

Surface top-level error.code on the response

Meaning Media measured an offset for the two recordings, but its confidence was below 0.3, so AlignByAudio refused to move anything.

Common causes

  • The two clips are not recordings of the same sound.
  • Too little shared audio for media to lock on.

How to fix Align two recordings of the same passage, or find the sync point by hand and set sourceIn yourself.

Agents: codemode.describe("praxis.cut.errors.ALIGNMENT_UNCERTAIN")

FRAME_OUT_OF_RANGE

Surface top-level error.code on the response

Meaning The time is not renderable because it falls outside [0, duration].

Common causes

  • A time past the project duration.
  • A negative time.

How to fix Read GetTimeline().duration and request times inside it; frame times are snapped, so stay a frame away from the exact edge if a frame must render.

Agents: codemode.describe("praxis.cut.errors.FRAME_OUT_OF_RANGE")

PROJECT_TOO_LARGE

Surface top-level error.code on the response

Meaning The stored document would grow past the allowed size, so the edit is refused.

Common causes

  • Very many clips, keyframes or effect entries.
  • Repeated duplicated tracks.

How to fix Consolidate clips and tracks, or split the work into more than one project; narrowing reads does not reduce the stored size.

Agents: codemode.describe("praxis.cut.errors.PROJECT_TOO_LARGE")

RESPONSE_TOO_LARGE

Surface top-level error.code on the response

Meaning The result was refused rather than truncated, so the edit may not have returned its prints.

Common causes

  • Printing a whole timeline or transcript.
  • Requesting many preview frames, which arrive inline as base64 PNG.
  • Returning far more print text than the response allows.

How to fix Print ids and counts instead of whole objects, request at most four preview times, and read large collections through the HTTP read operations with a time window.

Agents: codemode.describe("praxis.cut.errors.RESPONSE_TOO_LARGE")

EXPORT_FAILED

Surface top-level error.code on the response

Meaning Rendering stopped after the edit had already committed.

Common causes

  • An offline or undecodable source.
  • A render resource failure.
  • An unsupported combination reached during rendering.

How to fix Read error.cause and error.request_id, fix the named source or setting, and create a new export; the timeline itself is already committed.

Agents: codemode.describe("praxis.cut.errors.EXPORT_FAILED")

INVALID_PARAMS

Surface top-level error.code on the response

Meaning Validation failed before the project was read.

Common causes

  • An id with the wrong prefix or length.
  • A field of the wrong type.
  • A missing required parameter.

How to fix Correct the parameters; ids are prefixed values (for example cut_… for projects), not arbitrary strings.

Agents: codemode.describe("praxis.cut.errors.INVALID_PARAMS")

PERMISSION_DENIED

Surface top-level error.code on the response

Meaning Authentication succeeded but the caller lacks the required permission.

Common causes

  • A read-only credential attempting an edit.
  • A credential for a different organization.

How to fix Use a credential with write access to the project’s organization.

Agents: codemode.describe("praxis.cut.errors.PERMISSION_DENIED")

NOT_IMPLEMENTED

Surface top-level error.code on the response

Meaning The operation is recognised but deliberately unanswered.

Common causes

  • Calling a capability that is published but not yet supported.

How to fix Use the supported alternative named in the operation’s own description, or check the docs for the current capability list.

Agents: codemode.describe("praxis.cut.errors.NOT_IMPLEMENTED")

INTERNAL

Surface top-level error.code on the response

Meaning Something failed that the service did not classify further.

Common causes

  • A transient internal fault.
  • An unhandled edge case in the input.

How to fix Retry once; if it repeats, report the request_id so the failure can be traced.

Agents: codemode.describe("praxis.cut.errors.INTERNAL")

Requests and results

Submit script for new source, or edit_id and edits to repair a saved failed script, never both. Each replacement has find, replace, and optional all; by default exactly one match is required. Get the saved ID from error.details.edit_id; it lasts ten minutes. Success returns revision, summary, prints, and requested frames.

Read errors

An OPS_REJECTED response contains nested operation rejection codes. Rejections identify #opIndex, code, and reason. For UNKNOWN_FIELD, check spelling and camelCase. For OVERLAP, move or shorten conflicting clips. For OUT_OF_SOURCE, reduce source consumption. For RATE_OUT_OF_RANGE, use 0.25–4. For UNSUPPORTED_PLAYBACK, check explicit mute on reverse. Correct the input before retrying.

On REVISION_CONFLICT, read state to establish whether the prior edit committed. For SCRIPT_LIMIT, reduce the script or split edits into stages. FRAME_UNAVAILABLE is a preview warning: the edit still commits, and the warning alone does not establish broken source media.

Masks, effects, speed curves and audio

Masks

Visual clips accept a mask from a shape (rect, ellipse, or SVG path) or another video track (alpha or luma). Masks support invert, enabled, feather, transform, and clip-relative keyframes; they can be cleared with mask: null. A track mask must reference a separate visual track and cannot form a cycle. Shape/path dimensions and feather are normalized to the canvas; keyframe times are seconds. Invalid definitions return INVALID_MASK, referenced masks that are in use block destructive edits with MASK_IN_USE, and a project is limited to 16 masks (TOO_MANY_MASKS).

Effects and built-in LUT looks

Call ListEffects() before choosing an effect; it returns the available categories, parameters, defaults, limits, and cost notes. Current categories include blur and color adjustment, plus built-in LUT looks. speed is cycles per second for animated effects. Effects run on the CPU during export and increase render time, especially blur and animated treatments. User-supplied .cube LUT files are not supported.

Variable speed curves

SetSpeed(id, {curve: [{at, rate}, ...], audio?}, {keep}) applies a piecewise playback-rate curve; Update(id, {playback}) can also set kind: "curve". Knot times are clip-relative seconds and rates must be positive, from 0.25 through 4. Curves are forward-only and preserve the clip’s output duration; audio is mute or resample. Pitch preservation is not supported for curve playback.

Audio gain, roles, ducking and export loudness

Audio clips accept gain: [{at, value, ease?}] keyframes in dB, relative to the clip. AddTrack("audio", {role: "voice" | "music" | "sfx"}) labels a track; ducking uses the audible occupancy times of clips on the selected under track and does not inspect waveform loudness. exports.create accepts loudness: {targetLufs, truePeakDbtp} and returns measured integrated LUFS and true peak when enabled. Normalization adds an analysis/render pass and export time.

duck: { under, toDb, attack, release }: lowers the audio to toDb (-60 to 0) while the under track has audible clips, with attack and release in seconds. null clears it, and invalid values raise INVALID_DUCK.

Text styles, templates and caption alignment

Discover style presets with ListTextStyles() and templates with ListTextTemplates(). AlignCaptions(track, script, {resplit: true, maxChars}) rebuilds captions on the script’s punctuation. Use style: {preset: "clean-title"} on text or tracks; GetItem and GetTimeline expose styleSource. InsertTemplate(track, {template, start, slots}) inserts a discovered multi-layer composition. AlignCaptions(track, script) aligns an existing caption track to supplied text and returns replaced/added/deleted counts. Presets and templates are versioned catalog entries; inspect their returned slots and values before insertion.

ImportCaptions(track, text, {format?, offset?}) imports SRT or WebVTT onto a caption track; offset shifts cues in seconds. When format is omitted, a WEBVTT header selects VTT. ExportCaptions(track, {format}) exports cues in timeline order with millisecond timecodes. More than 100000 bytes, more than 5000 cues, a malformed timecode, an end before the start, or overlap inside the file returns INVALID_CAPTION_FILE with a source line; overlap with existing timeline clips still uses OVERLAP.

fit: "none" places source pixels 1:1 on the project canvas and shrinks with it in smaller previews. The luma transition uses the built-in maps radial, diagonal, clouds, spiral, honeycomb and bars; user maps are not available yet.

chroma_key keys green or blue in Rec.709 chroma with color, tolerance, softness and spill. List it first in effects. It is costly at export.

Next steps