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| name | type | unit | range | default | description |
|---|---|---|---|---|---|
o.from | number | seconds | >= 0 | 0 | Window start; clips overlapping it are included. |
o.to | number | seconds | >= from | project end | Window end; clips overlapping it are included. |
o.tracks | TrackId[] | — | — | all tracks | Restrict 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, notclips—t.tracks[0].itemsis 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/tonarrow items and joins; joins are selected by their overlap window.durationis always the whole project.- Reads see writes made earlier in the same script, so a read after
Insertalready 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| name | type | unit | range | default | description |
|---|---|---|---|---|---|
id | ClipId | — | — | — | 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);startandendare timeline seconds;lengthisend - start.sourceIn/sourceOutdescribe the kept source interval in seconds;sourceOutis exclusive and equalssourceInfor a frozen clip.- Use
GetTimelinewhen you need many clips at once: oneGetItemper 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[]| name | type | unit | range | default | description |
|---|---|---|---|---|---|
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
asyncvisitor is rejected. ctx.trackis the whole track view, so a visitor can filter onctx.track.kindorctx.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| name | type | unit | range | default | description |
|---|---|---|---|---|---|
ref | MediaRef | — | — | — | { 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;durationUsis the same value in microseconds, kept for callers that already read it. - Write
{ libraryId, assetId }; the HTTP spellinglibrary_id/asset_idis read the same way, with anINPUT_ADJUSTEDwarning. - 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[]| name | type | unit | range | default | description |
|---|---|---|---|---|---|
ref | MediaRef | — | — | — | Media reference in a bound library. |
o.from | number | seconds | >= 0 | 0 | Window start in source time. |
o.to | number | seconds | >= from | source end | Window 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.towindow and each word’sstart/endare source seconds; use those.from/toare 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
FindItemson a caption track to read the words a clip actually kept. filleris media’s own label for a word that is not part of the sentence:{ kind, confidence }wherekindisfiller,verbal_tic,repetitionorrestart(an older transcript wrotetrue, which reads as a certainfiller). Pass the words straight toDeleteWordsorRemoveFillers.
Agents: codemode.describe("praxis.cut.script.GetTranscript")
GetAnalysis
GetAnalysis(ref: MediaRef, kind: AnalysisKind): Segment[]| name | type | unit | range | default | description |
|---|---|---|---|---|---|
ref | MediaRef | — | — | — | 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/toare 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.
kindis one ofsilence,filler,scenes,beats; anything else is rejected.beatsis a music asset’s measured beat grid: one segment per beat,labelis 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 asclip.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.createwith kindbeatsstarts that measurement, answerspendingwithretry_after_sec, and saysno_musicwhen 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
kindand parameter names insideeffectonJoin; 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,descriptionand 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));phaseisin,outorloop;targetisanyortext.- A slot use is
{ preset, duration?, ...params };durationis 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
familyinstyle.fontFamily; an unknown family is rejected. - Check
scriptsbefore 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
valueis in Shotstack’s rich shape (font,style,stroke,shadow,background,border,align,active,animation, plusglow/margin/maxWidth/maxLines), so it can be pasted straight intostyle. categorygroups the catalog:basic,box,highlight,dynamic,titleanddecorative. Pick adynamiccaption 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.
GetItemandGetTimelineexposestyleSourceso 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
maxLengthbefore 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| name | type | unit | range | default | description |
|---|---|---|---|---|---|
track | TrackId | — | — | — | Track returned by AddTrack or read from GetTimeline. |
item | ItemInit | — | — | — | The clip to add; type and start are always required. |
o.ripple | boolean | — | — | false | Shift same-track followers right to open room. |
o.after | ClipId | — | — | — | 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 useAppend,{ after: previousId }, or the previous clip’s end as the nextstart. - 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_ADJUSTEDwarning; a wider overlap is stillOVERLAP. - A video whose clip is longer than its footage keeps its length and holds the last frame: the extra output becomes a
freezeclip right after it, so nothing shifts. Audio has no frame to hold and is shortened to the source instead. Both carry anINPUT_ADJUSTEDwarning. - 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 writelength: "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: truemoves 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| name | type | unit | range | default | description |
|---|---|---|---|---|---|
track | TrackId | — | — | — | Track returned by AddTrack or read from GetTimeline. |
item | ItemInit | — | — | — | 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
startis rejected; useInsertto place a clip at a chosen time.
Agents: codemode.describe("praxis.cut.script.Append")
Update
Update(id: ClipId, patch: ItemPatchView): void| name | type | unit | range | default | description |
|---|---|---|---|---|---|
id | ClipId | — | — | — | The clip to change. |
patch | ItemPatchView | — | — | — | 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,
styleis that one line’s own style layered over its track’s style:Update(captionId, { style: { font: { color: "#FFE600", size: 60 } } })emphasises a single line.GetItemreports the effective style asstyleand the line’s own asstyleOverride;Update(captionId, { style: null })removes the override. effects: nullclears the effect stack,blend: nullclears the blend mode,animation: nullclears an animation preset, andanimate: nullorreveal: nullremoves 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,blendandmask. - Do not supply
animationtogether withanimateorrevealin one call. length: "auto"on a video or audio clip means the rest of its source, exactly as omittinglengthdoes onInsert.- A change that would overlap a neighbour on the same track is rejected with
OVERLAP; shorten, move, or useripple. A head landing within two frames of the previous clip’s end is absorbed instead, with anINPUT_ADJUSTEDwarning. - A
lengthpast the end of the source is absorbed rather than rejected the wayInsertabsorbs it: up to a frame it is shortened to what the media has, and a video keeps its length by holding its last frame. mediareplaces the clip’s source (Premiere’s Replace With Clip, OTIO’smedia_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 withINPUT_ADJUSTED; audio that no longer fits is rejected withOUT_OF_SOURCE; the clip’stypenever 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 }| name | type | unit | range | default | description |
|---|---|---|---|---|---|
id | ClipId | — | — | — | Video or audio clip. |
rate | number | 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.ripple | boolean | — | — | false | Shift 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"computesround(consumed source / new rate × fps)frames and falls back tofloorwhen rounding would pass the source end; the returned values are the actual frame-rounded seconds.omay be omitted:SetSpeed(id, 0.5)isSetSpeed(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;
audiois"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_SOURCErather than silently shortening the clip. - Preserving direction and audio policy comes from the clip’s existing
playback; change those withUpdate. - 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| name | type | unit | range | default | description |
|---|---|---|---|---|---|
id | ClipId | — | — | — | The clip to remove. |
o.ripple | boolean | — | — | false | Close 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 noRemove,RemoveCliporDeleteClip— a script calling one of those fails as an unknown function. - Without
ripplethe gap stays open and the following clips keep their times; withripple: truethe 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| name | type | unit | range | default | description |
|---|---|---|---|---|---|
left | ClipId | — | — | — | The earlier of the two clips. |
right | ClipId | — | — | — | The later clip; it must start exactly where left ends. |
o.length | number | seconds | > 0 and below each clip’s length | 0.5 | Size of the overlap. |
o.effect | TransitionInput | — | — | — | Required; { kind, ...params } with a kind from ListTransitions(). |
o.keepTrackLength | boolean | — | — | false | true 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]);Joinmoves the right clip and every same-track follower left bylength, so that track becomes shorter and the project duration can shrink with it. Other tracks stay where they are.keepTrackLength: truepredicts the other way: nothing moves, the two clips simply sharelengthseconds, and the track — and the project — keep their length. The shared frames are held by the incoming clip, which grows bylengthat its head. Clip length no longer predicts position in this mode, so readGetItem(id).startrather 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-cliptransitionIn/transitionOut, which also moves nothing. The defaultshiftmode 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 returnINVALID_TRANSITIONwith 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/centerY0–1 (default 0.5); blinds integercount2–64 (default 8) andorientationvertical/horizontal (default vertical); blurradius0–100 pixels at 1080-pixel frame height (default 24); zoomdirectionin/out (default in),amount0.1–3 (default 1) andblur0–1 (default 0.5); clockdirectionclockwise/counterclockwise (default clockwise),startAngle0–360 degrees (default 0, twelve o’clock) andsoftness0–1 (default 0); flashcolorwhite/black (default white) andintensity0–1 (default 1). - Zoom blur uses up to eight radial samples per shot and is slower on server rendering.
- Join options and
UpdateJoinpatches accept onlylengthandeffect;keepTrackLengthis chosen once, onJoin, and stays with the join. UpdateJoinadjusts the overlap afterwards andDeleteJoinrestores the butt cut. Per-cliptransitionIn/transitionOutremain separate entrance/exit effects.
Agents: codemode.describe("praxis.cut.script.Join")
UpdateJoin
UpdateJoin(id: JoinId, patch: Partial<JoinOptions>): void| name | type | unit | range | default | description |
|---|---|---|---|---|---|
id | JoinId | — | — | — | Join id from Join or from GetTimeline().joins. |
patch | Partial<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
lengthmoves 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
lengthandeffectare accepted; any other key is rejected withUNKNOWN_FIELD. - A join made with
Join(..., { keepTrackLength: true })stays in that mode: changinglengthadjusts 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| name | type | unit | range | default | description |
|---|---|---|---|---|---|
id | JoinId | — | — | — | 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; readGetTimeline().joinswhen you are unsure.
Agents: codemode.describe("praxis.cut.script.DeleteJoin")
Split
Split(id: ClipId, at: number): ClipId| name | type | unit | range | default | description |
|---|---|---|---|---|---|
id | ClipId | — | — | — | The clip to cut. |
at | number | seconds | strictly 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]);atis 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 withTOO_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 keepsinon the left,outon the right andloopon 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| name | type | unit | range | default | description |
|---|---|---|---|---|---|
id | ClipId | — | — | — | The clip to trim. |
edge | "in" | "out" | — | — | — | Which edge moves. |
delta | number | seconds | — | — | Positive lengthens, negative shortens. |
o.ripple | boolean | — | — | false | Shift 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
inedge moves the clip’s start and consumes source, so the clip holds its end;outkeeps the start and changes the end. deltais 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; passripple: trueto move the followers instead. - Shrinking below one frame is rejected with
TOO_SHORT, and consuming source the clip does not have fails withOUT_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| name | type | unit | range | default | description |
|---|---|---|---|---|---|
id | ClipId | — | — | — | The clip to move. |
start | number | seconds | >= 0 | — | New timeline start. |
track | TrackId | — | — | current track | Destination 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);startis frame-snapped; read the clip back if you need the exact stored value.- Moving onto an occupied span is rejected with
OVERLAP;Movehas norippleoption, 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| name | type | unit | range | default | description |
|---|---|---|---|---|---|
from | number | seconds | >= 0 | — | Interval start. |
to | number | seconds | > from | — | Interval end. |
tracks | TrackId[] | — | — | all unlocked tracks | Tracks 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
tracksmeans every unlocked track; a locked track is skipped, and naming a locked track fails withLOCKED_TRACK.
Agents: codemode.describe("praxis.cut.script.RippleDeleteRange")
DeleteWords
DeleteWords(source: ClipId, words: { start: number; end: number }[], o?: { keepPauseMs?: number }): { removed: number; seconds: number }| name | type | unit | range | default | description |
|---|---|---|---|---|---|
source | ClipId | — | — | — | The video or audio clip the words were spoken on. |
words | { start, end }[] | seconds | 0 <= start < end | — | Source-clock intervals to delete; a GetTranscript word list is passed as it comes. |
o.keepPauseMs | number | milliseconds | 0–5000 | 250 | Breath 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
sourceInand 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 / 2at each end, so the cut keeps a short breath instead of butting two words together.keepPauseMs: 0cuts the words exactly. - Every unlocked track ripples, exactly as
RippleDeleteRangedoes — 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
RemoveFillerswithdryRun: 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 }| name | type | unit | range | default | description |
|---|---|---|---|---|---|
source | ClipId | — | — | — | The video or audio clip whose words are inspected. |
o.kinds | string[] | — | — | every kind | Which labels count: filler, verbal_tic, repetition, restart. |
o.minConfidence | number | — | 0–1 | 0.7 | The least certain a label may be and still be cut. |
o.keepPauseMs | number | milliseconds | 0–5000 | 250 | Breath kept at each end, as DeleteWords. |
o.dryRun | boolean | — | — | false | List 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
fillerannotation ({ kind, confidence }, or the oldertrue, 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
DeleteWordson 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 }| name | type | unit | range | default | description |
|---|---|---|---|---|---|
source | ClipId | — | — | — | 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,fitandtransform, and the clip’smaskpoints at that track’s id withchannel: "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_PROCESSINGand 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 }| name | type | unit | range | default | description |
|---|---|---|---|---|---|
source | ClipId | — | — | — | 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,lengthand speed, and the original clip’s own sound is set to-60dB (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_PROCESSINGand 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 }[] }| name | type | unit | range | default | description |
|---|---|---|---|---|---|
source | ClipId | — | — | — | The audio or video clip to align. |
referenceClip | ClipId | — | — | — | 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 itssourceIn, 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
maskpoints to, with the samestart) moves by the same seconds; without that, picture and matte would drift apart. - Confidence below
0.3is refused withALIGNMENT_UNCERTAINand 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 }| name | type | unit | range | default | description |
|---|---|---|---|---|---|
source | ClipId | — | — | — | The video clip to reframe. |
o.aspect | enum | — | 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
mediachanges:start,sourceIn,length,fit,transformand every effect stay exactly where the script put them. - A reframed take keeps the source’s own frames, so
sourceInremains meaningful; set the project’s canvas withSetSettingsso the composition matches. - While the job runs the run stops with
MEDIA_PROCESSINGand 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 }| name | type | unit | range | default | description |
|---|---|---|---|---|---|
source | ClipId | — | — | — | The video or image clip to upscale. |
o.height | enum | pixels | 720, 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
mediachanges: 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_PROCESSINGand 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 }| name | type | unit | range | default | description |
|---|---|---|---|---|---|
source | ClipId | — | — | — | The video clip whose targets are hidden. |
o.targets | string[] | — | 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
pixelateeffect 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_PROCESSINGand 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| name | type | unit | range | default | description |
|---|---|---|---|---|---|
kind | "video" | "audio" | "caption" | — | — | — | What the track may hold. |
init.name | string | — | — | — | Display name for the track. |
init.role | "voice" | "music" | "sfx" | — | — | — | Audio role; used by ducking and mixing. |
init.style | RichStyle & { preset?: string } | — | — | — | Caption track style, optionally starting from a preset; see the style field. |
index | number | — | >= 0 | append at the bottom | Layer 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
stylein Shotstack’s rich shape (font,style,stroke,shadow,background,border,align,active,animation, plus theglow/margin/maxWidth/maxLinesextensions), optionally starting from aListTextStyles()preset. A single caption can override it — seeUpdate. animation.stylegives 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; thestylefield lists the semantics.- Use
roleon audio tracks so ducking and mixing treat the track correctly: a level duck side-chains on theundertrack’s measured level, and a mix measurement (analysis.runwithkind: "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
sfxis never inferred. Declarerolerather 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.
indexselects 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. Pass0for the top, or reorder afterwards withMoveTrack.
Agents: codemode.describe("praxis.cut.script.AddTrack")
MoveTrack
MoveTrack(id: TrackId, index: number): void| name | type | unit | range | default | description |
|---|---|---|---|---|---|
id | TrackId | — | — | — | The track to move. |
index | number | — | >= 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]));indexis the same scaleAddTracktakes: 0 is the topmost layer — the last one drawn, covering everything under it — and a larger index sits further down. This is Shotstack’stracks[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
indexpast 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| name | type | unit | range | default | description |
|---|---|---|---|---|---|
id | TrackId | — | — | — | The track to change. |
patch | TrackPatchView | — | — | — | 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]));mutedandgainDbapply 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 withUpdateTrack(videoTrack, { muted: true }));roleapplies to audio tracks;styleto caption tracks.- A locked track refuses every edit to its clips with
LOCKED_TRACK— unlock it before editing. - Read the track back with
GetTimelineto confirm the change.
Agents: codemode.describe("praxis.cut.script.UpdateTrack")
DeleteTrack
DeleteTrack(id: TrackId): void| name | type | unit | range | default | description |
|---|---|---|---|---|---|
id | TrackId | — | — | — | 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| name | type | unit | range | default | description |
|---|---|---|---|---|---|
patch | Partial<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);widthandheightare pixels;fpsis frames per second;backgroundis a colour string.- Changing
fpsre-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[]| name | type | unit | range | default | description |
|---|---|---|---|---|---|
track | TrackId | — | — | — | Caption track to fill. |
source | ClipId | — | — | — | Audio or video clip whose kept words become captions. |
o.style | RichStyle & { preset?: string } | — | — | — | Caption track style, optionally starting from a preset. |
o.maxChars | number | — | 1–1000 | 12 portrait, 20 otherwise | Maximum characters per caption line. |
o.minSeconds | number | seconds | > 0 | 0.6 | Shortest caption kept on screen; a briefer cue is merged into a neighbour or extended. |
o.maxSeconds | number | seconds | ≥ o.minSeconds | 7 | Longest caption; a longer cue is split at the largest pause between its words. |
o.maxLines | 1 | 2 | — | — | 1 | Lines per caption; 2 doubles the merge budget and breaks a merged caption in the middle. |
o.punctuation | "keep" | "subtitle" | — | — | decided by the transcript | subtitle drops the line-end 句读 and turns a comma inside a line into one space; Chinese transcripts default to it. |
o.snapToCuts | boolean | — | — | true | Snap 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 aCAPTION_ADJUSTEDwarning. - Timing follows the subtitle rules: cues keep a two-frame gap and stay on screen between
minSecondsandmaxSeconds, and a cue that outlastsmaxSecondsis split at its largest pause between words. Each change carries aCAPTION_ADJUSTEDwarning 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. maxCharsdefaults to 12 on a portrait canvas and 20 on a landscape or square one, because a narrow picture holds fewer characters.snapToCutsfollows 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 asstyle: { preset: "..." }. o.styleis the track’s style: apresetfirst, then rich fields over it. One line is emphasised withUpdate(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[]| name | type | unit | range | default | description |
|---|---|---|---|---|---|
track | TrackId | — | — | — | Track the template’s first layer goes on. |
o.template | string | — | — | — | Template id from ListTextTemplates(). |
o.start | number | seconds | >= 0 | — | Timeline start of the composition. |
o.slots | Record<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 }| name | type | unit | range | default | description |
|---|---|---|---|---|---|
trackId | TrackId | — | — | — | Caption track to rebuild. |
script | string | — | — | — | The text the captions must follow. |
options.resplit | boolean | — | — | — | Re-split the text on its own punctuation before aligning. |
options.maxChars | number | — | — | — | 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
ImportCaptionswhen you have a subtitle file instead. - When the alignment confidence is too low the whole call fails with
CAPTION_ALIGN_LOW_CONFIDENCEand the track is left unchanged. - The counts tell you what changed:
replacedis captions rewritten,addednew ones,deleteddropped 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[]| name | type | unit | range | default | description |
|---|---|---|---|---|---|
trackId | TrackId | — | — | — | Caption track to fill. |
text | string | — | <= 100000 bytes | — | The subtitle file contents. |
o.format | "srt" | "vtt" | — | — | inferred | Format; a WEBVTT header selects VTT when omitted. |
o.offset | number | seconds | — | 0 | Shift 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_FILEand the offending source line. - Overlap of the imported cues with clips already on the track uses the ordinary
OVERLAPrejection instead. offsetshifts 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
AddCaptionsFromTranscriptdoes 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| name | type | unit | range | default | description |
|---|---|---|---|---|---|
trackId | TrackId | — | — | — | 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.
formatis required; there is no inference on export.- The returned string goes into the script’s prints, so keep the file small —
printsshares the response budget.
Agents: codemode.describe("praxis.cut.script.ExportCaptions")
SetMarker
SetMarker(at: number, label: string): string| name | type | unit | range | default | description |
|---|---|---|---|---|---|
at | number | seconds | >= 0 | — | Timeline position of the marker. |
label | string | — | — | — | 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.
atis 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(...values: unknown[]): void| name | type | unit | range | default | description |
|---|---|---|---|---|---|
values | unknown[] | — | — | — | 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);Printis the only way to see a value from a script — the response carriesprints, 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| name | type | unit | range | default | description |
|---|---|---|---|---|---|
at | number[] | 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
urlis 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
Previewfor, read them throughpraxis.cut.projects.frames.list: itsatparameter takes comma-separated seconds (at most 8 per call, the same bound as here) and itsscaleranges 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 aFRAME_UNAVAILABLEwarning 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 to | every clip |
| Writable | Insert 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 (
typeandstartare 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
| Type | number |
| Unit | seconds |
| Range | >= 0 |
| Default | — |
| Applies to | every clip |
| Writable | Insert 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, keyframeat, and revealdelay/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 withGetItem) as the next clip’sstart— that is what makes them adjacent enough forJoin. - 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
| Type | number | "auto" (video, audio) |
| Unit | seconds |
| Range | >= 1 frame |
| Default | — |
| Applies to | every clip; “auto” only on video and audio |
| Writable | Insert 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_ADJUSTEDwarning; a video asked for much more keeps its length and holds its last frame in afreezeclip right after it. AsourceInalready outside the media is stillOUT_OF_SOURCE. start + lengthis the clip’send, which is the value to feed into the next clip’sstart.- 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
| Type | MediaRef |
| Unit | — |
| Range | — |
| Default | — |
| Applies to | video, image, audio |
| Writable | Insert and Update |
- Required on an Insert of those types.
Update(id, { media })swaps the source and keeps the clip’ssourceIn,length, transitions, effects and keyframes: video holds its last frame when the new footage is shorter (anINPUT_ADJUSTEDwarning), audio that no longer fits is rejected withOUT_OF_SOURCE.- The library must be bound to the project, or the call fails with
UNBOUND_LIBRARY. - Script spelling is camelCase:
libraryIdandassetId. The HTTP nameslibrary_idandasset_idare read as the script names, with anINPUT_ADJUSTEDwarning. - Read its metadata with
GetMedia({ libraryId, assetId });durationUsthere is in microseconds while editing times are seconds.
Agents: codemode.describe("praxis.cut.fields.media")
sourceIn
| Type | number |
| Unit | seconds |
| Range | >= 0 and inside the source |
| Default | 0 |
| Applies to | video, audio |
| Writable | Insert and Update |
- Frame-snapped like every editing time.
sourceOutis not an input: it is derived fromsourceIn + lengthand is returned byGetItem/GetTimeline.sourceOutis exclusive, and for a frozen clip it equalssourceIn.- Sliding
sourceInlater trims the head without moving the clip on the timeline.
Agents: codemode.describe("praxis.cut.fields.sourceIn")
sourceOut
| Type | number |
| Unit | seconds |
| Range | — |
| Default | — |
| Applies to | video, audio |
| Writable | read only |
- Not accepted in
InsertorUpdate; it follows fromsourceInandlength(or fromSetSpeed). - Exclusive: the kept interval is
[sourceIn, sourceOut). - For a frozen clip,
sourceOutequalssourceIn. - 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
| Type | string |
| Unit | — |
| Range | — |
| Default | — |
| Applies to | text, caption |
| Writable | Insert 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
AlignCaptionsis 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
| Type | string |
| Unit | — |
| Range | — |
| Default | — |
| Applies to | color |
| Writable | Insert and Update |
- Required on an Insert of a color clip.
#RRGGBBor#RRGGBBAA.filloverrides it when supplied; on a color clip a gradientfillreplaces 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 to | shape |
| Writable | Insert and Update |
- Required on an Insert of a shape clip, together with
width,heightandfill. - 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
| Type | number |
| Unit | — |
| Range | — |
| Default | — |
| Applies to | shape |
| Writable | Insert and Update |
- A fraction of the canvas width, not pixels:
0.5is half the canvas wide. - Required on an Insert of a shape clip.
transform.scalemultiplies it, so an animation on scale leaves this value untouched.
Agents: codemode.describe("praxis.cut.fields.width")
height
| Type | number |
| Unit | — |
| Range | — |
| Default | — |
| Applies to | shape |
| Writable | Insert 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
| Type | number |
| Unit | pixels at 1080-pixel frame height |
| Range | >= 0 |
| Default | — |
| Applies to | shape |
| Writable | Insert 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
| Type | string | { linear: { angle, stops } } | { radial: { stops } } |
| Unit | — |
| Range | — |
| Default | — |
| Applies to | shape, text, color |
| Writable | Insert and Update |
#RRGGBBor#RRGGBBAA, or{ linear: { angle, stops: [{ at, color }, ...] } }, or{ radial: { stops: [{ at, color }, ...] } }.- Stop positions are 0–1;
angleis degrees with 0 left to right. - On a color clip,
fillreplacescolorwhen 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 to | shape |
| Writable | Insert and Update |
- Optional on a shape clip, and optional on Update;
stroke: nullclears it. - Not the same as the text
style.strokesarray, which draws text outlines. - Width is in pixels at a 1080-pixel frame height.
Agents: codemode.describe("praxis.cut.fields.stroke")
transform
| Type | Partial<{ x, y, scale, rotation, opacity, crop, blur }> |
| Unit | — |
| Range | — |
| Default | — |
| Applies to | visual clips (video, image, text, color, shape) |
| Writable | Insert and Update |
x/yare normalized canvas-centre coordinates and default to 0.5, so{ x: 0.5, y: 0.5 }is centred.scale1 is the fitted size; it multiplies the clip’s fitted dimensions.rotationis degrees, default 0.opacityis 0–1, default 1.cropis{ top, right, bottom, left }, each a fraction of that side.bluris 0–100 pixels at a 1080-pixel frame height; it is applied after the content and its effects, and beforeblend.- Any field you omit keeps its current value; keyframes in
animateoverride the static value for the properties they cover.
Agents: codemode.describe("praxis.cut.fields.transform")
fit
| Type | "contain" | "cover" | "fill" | "none" |
| Unit | — |
| Range | — |
| Default | contain |
| Applies to | video, image |
| Writable | Insert and Update |
containfits the whole image inside the canvas;coverfills the canvas and crops the overflow;fillstretches;nonekeeps native dimensions.noneplaces source pixels 1:1 on the project canvas and shrinks with it in smaller previews.- Combine with
transform.scaleto size anoneclip deliberately.
Agents: codemode.describe("praxis.cut.fields.fit")
blend
| Type | "normal" | "screen" | "multiply" | "overlay" | "add" |
| Unit | — |
| Range | — |
| Default | normal |
| Applies to | visual clips |
| Writable | Insert and Update |
addmaps to Skia Plus; the defaultnormalpath 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
Joinoverlap, 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
| Type | RichStyle & { preset?: string } |
| Unit | — |
| Range | — |
| Default | — |
| Applies to | text, caption |
| Writable | Insert 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 }—widthdefaults to 0, which draws no outline — andshadow:{ 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.colorwithoutstyle.gradientclears any solid fill an earlier write set, andstyle: { gradient: null }clears it explicitly. - Colours are 6 digits with alpha in
opacitythe Shotstack way;#RGBand#RRGGBBAAalso read. - Praxis extensions Shotstack has no field for:
strokeandshadowmay 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), andmargin,maxWidth,maxLines. active.font:color(current-word colour),background(a rounded patch behind it),size(current-word size in 1080-pixel units, a zoom) andopacity(folded into the colour’s alpha).active.stroke/active.shadowrestate the current word’s outline or shadow;"none"removes it.animation.stylesets the word animation:highlight(the current word takesactive.font.color,#FFE600if 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 fromanimation.direction:left/right/up/down, defaultup),bounce(it springs up) andtypewriter(characters appear in turn).noneremoves the highlight a track style set; a style naming onlyactive.font.colorkeeps the plain highlight.style.letterSpacing(px at 1080, -20–100),style.lineHeight(0.5–3) andstyle.textTransform(none/uppercase/lowercase/capitalize) shape the line.border: { width, color, opacity, radius }outlines a box hugging the text (radiusdefaults tobackground.borderRadius).- A rich
strokereplaces the whole outline family;presetnames aListTextStyles()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-levelpadding,background.wrap,style.wordSpacing,style.textDecorationandstyle.size. - The older flat spelling (
fontSize,color,strokes…) still works and reportsSTYLE_LEGACY_FIELDSwith its rich equivalent; mixing the two in one style is refused withINVALID_STYLE. - On a
captionclip the field is that one line’s own style: it layers over the track’s style,GetItemreports it asstyleOverride, and it must obey the track rule thatmarginis 0–0.4 of canvas height. A caption style withmaxLines: 2is 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_STYLEerrors. - 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 to | text, caption |
| Writable | Insert and Update |
- Shotstack’s
alignobject places the text block:align.verticalistop,middleorbottomandalign.horizontalisleft,centerorright. Any other value is rejected withINVALID_STYLE. - When you do not want to change the placement, leave
align.verticalout. Do not passnull— it is not a valid value and the call is rejected. - Omitting the field preserves the current position on Update;
align.horizontaldefaults tocenter. - Use
style.marginfor the distance from the chosen edge. - Position the whole text block vertically; for free placement use
transform.yinstead.
Agents: codemode.describe("praxis.cut.fields.style.align.vertical")
playback
| Type | { kind: "rate", rate, direction, audio } | { kind: "freeze" } |
| Unit | — |
| Range | — |
| Default | — |
| Applies to | video, audio |
| Writable | Insert and Update |
- Rate form:
{ kind: "rate", rate: number, direction: "forward" | "reverse", audio: "preservePitch" | "resample" | "mute" }. - Freeze form:
{ kind: "freeze" }holdssourceInand is silent. - Rate is finite and inclusive 0.25–4; anything outside fails with
RATE_OUT_OF_RANGE. - Omitted
playbackdefaults to 1× forward with preservePitch. Supply the complete rate object when changing playback — a partial one is rejected withINVALID_PLAYBACK. - Reverse requires an explicit
audio: "mute"; preservePitch and resample are rejected withUNSUPPORTED_PLAYBACKrather than silently muted. - Unknown fields inside the object are rejected with
UNKNOWN_FIELD. GetItem/GetTimelineecho the playback and the source interval in seconds;sourceOutis exclusive even for reverse and equalssourceInfor freeze.- Updating playback keeps the output length unless
lengthis 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
| Type | number |
| Unit | dB |
| Range | — |
| Default | 0 |
| Applies to | video, audio |
| Writable | Insert and Update |
- Both
InsertandUpdateaccept it — the writable field set is the same for the two calls. - Negative values quieten, positive values raise the level.
volumeDbis a static level;gainis the keyframed version of the same idea, andducklowers a bed under another track.- Track-level level is separate: use
UpdateTrackwithgainDb.
Agents: codemode.describe("praxis.cut.fields.volumeDb")
gain
| Type | { at: number, value: number, ease?: Ease }[] |
| Unit | seconds (at), dB (value) |
| Range | — |
| Default | — |
| Applies to | audio |
| Writable | Insert and Update |
atis seconds relative to the clip’s own start, exactly likeanimatekeyframes.- Use it when the level must change during the clip;
volumeDbsets one level for the whole clip. duckis the automatic version: it lowers a bed while another track is audible.
Agents: codemode.describe("praxis.cut.fields.gain")
fadeIn
| Type | number |
| Unit | seconds |
| Range | >= 0 |
| Default | 0 |
| Applies to | audio |
| Writable | Insert 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
| Type | number |
| Unit | seconds |
| Range | >= 0 |
| Default | 0 |
| Applies to | audio |
| Writable | Insert 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 to | audio |
| Writable | Insert and Update |
undernames the track the duck listens to;toDbis the lowered level.toDbranges from -60 to 0 dB.attackandreleaseare seconds and shape how fast the level moves.modeis"occupancy"(the default) or"level". Omit it and nothing about the duck changes."occupancy": the duck triggers on the clip occupancy of theundertrack — while a clip there is audible, this clip is lowered. It never inspects the waveform, so aunderclip that happens to be silent still ducks."level": the duck triggers on theundertrack’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 sameattack/releaserates. 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.
holdis 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 inmusic_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 withINVALID_DUCK.
Agents: codemode.describe("praxis.cut.fields.duck")
animate
| Type | Partial<Record<"x" | "y" | "scale" | "rotation" | "opacity" | "blur", { at, value, ease? }[]>> |
| Unit | seconds (at) |
| Range | — |
| Default | — |
| Applies to | visual clips |
| Writable | Insert and Update |
atis measured in seconds relative to the clip’s own start, not from the timeline — a keyframe atat: 0is the clip’s first frame, and it moves with the clip when youMoveit.- Each property’s array must be sorted by
atwith distinct frame-snapped times. - Values hold before the first keyframe and after the last one, overriding the static
transformvalue for that property. easeshapes 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
animatedetaches any animation preset on the clip;animate: nullremoves the keyframes. - Each property is limited to 600 keyframes.
Agents: codemode.describe("praxis.cut.fields.animate")
reveal
| Type | { by, delay?, stagger, duration, from, ease? } |
| Unit | seconds |
| Range | — |
| Default | — |
| Applies to | text |
| Writable | Insert and Update |
byselectschar,wordorline.- Unit
kstarts atdelay + k * staggerand takesdurationseconds to reach its resting state. fromholds the starting look:{ y?, opacity?, scale?, blur? }.from.yis a fraction of the font size, not a pixel offset.- All times are seconds and frame-snapped, like every other editing time.
- Supplying
revealtogether withanimationin one call is rejected;reveal: nullremoves the effect.
Agents: codemode.describe("praxis.cut.fields.reveal")
animation
| Type | { in?: AnimationUse, out?: AnimationUse, loop?: AnimationUse } | null |
| Unit | — |
| Range | — |
| Default | — |
| Applies to | visual clips |
| Writable | Insert and Update |
- Each slot use is
{ preset, duration?, ...params }; discover the ids withListAnimations(). - Presets replace the clip’s existing
animateandrevealwhen 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.
Splitkeepsinon the left,outon the right andloopon both.- Writing
animateorrevealdirectly detaches the preset;Updatewithanimation: nullclears both source and generated effects. - Supplying
animationtogether withanimateorrevealin 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
| Type | EffectEntryView[] | null |
| Unit | — |
| Range | — |
| Default | — |
| Applies to | visual clips |
| Writable | Insert and Update |
- Call
ListEffects()to discover the catalog; an unknown kind is rejected withUNKNOWN_EFFECTand invalid names/values/keyframes withINVALID_EFFECT_PARAM. - Entries include blur, colour adjustment, vignette, film grain, chromatic aberration, pixelate, glitch, shake, flash, light leak and built-in
lutlooks; user.cubeLUTs are not supported, and there are no custom shaders. - The catalog entry carries each parameter’s own range:
blurtakesradius0–100 (default 24), whilecolor_adjusttakesbrightness,contrast,temperatureandtinteach -1–1 (default 0) andsaturation0–2 (default 1). color_adjustuses an SDR-only Rec.709 adjustment matrix with no colour management.speedis 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.
TrimandSplitpreserve effect keyframes with the same clip-local behaviour asanimate.- 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 |
| Unit | seconds (length) |
| Range | — |
| Default | — |
| Applies to | visual clips |
| Writable | Insert and Update |
lengthis seconds and must fit inside the clip.fadechanges opacity,dissolveblends,push_left/push_rightmove horizontally,wipe_leftreveals horizontally.- This is the alternative to
Joinwhen 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 |
| Unit | seconds (length) |
| Range | — |
| Default | — |
| Applies to | visual clips |
| Writable | Insert 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
| Type | VisualMaskView | null |
| Unit | — |
| Range | — |
| Default | — |
| Applies to | visual clips |
| Writable | Insert and Update |
- A mask comes from a shape (
rect,ellipseor an SVGpath) or from another video track (alphaorluma). - 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 withMASK_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 to | caption |
| Writable | Update |
- Each entry is one word with its own
text,startandlength. - Times are relative to the caption clip, in seconds.
- Editing the words directly is the fine-grained path;
AlignCaptionsrebuilds a whole track from text andAddCaptionsFromTranscriptbuilds one from a media clip. Insertdoes not takewords; create the caption withtextand 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
kindthat is not inListTransitions(). - A parameter name the kind does not declare, or a value outside its documented range.
lengththat 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.positionset to anything other thantop,middleorbottom— includingnull.- A colour string that is not
#RRGGBBor#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-levelpadding.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,alphaorluma. - 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/lumatrack 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, …)orSetSpeed(id, 10, …).- A
playback.rateoutside 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"withoutaudio: "mute".- Pitch preservation requested on a reverse or curve playback.
SetSpeedon 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 nodirectionoraudio. - A
kindthat is notrate,freezeorcurve. - 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: trueonDelete. - An option on
SetSpeedother thankeepandripple.
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
lengthchange orSetSpeedthat 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
sourceInalready 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
outedge past the media end. - An
animate/revealclip 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 }). RippleDeleteRangenaming 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
libraryIdtypo.
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
lengthunder one frame. Splitat or outside the clip’s edges.RippleDeleteRangeover 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
toDboutside -60 to 0.- A missing or unknown
undertrack. - Negative
attackorrelease.
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
Removeinstead ofDelete.
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.jobIdhas 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 forRedact). - 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
- Motion, transitions and speed: How to write keyframes, text entrances and speed changes.
- Captions and styled text: Generate captions from speech, style them, import and export.
- Export a video: Set the output and follow the job.