Execute editing script
POST /cut/v1/projects/{project_id}:execute
Edit the current timeline atomically using synchronous JavaScript source. Read state or timeline first, then pass its revision as expected_revision to detect concurrent changes. Unlike Shotstack, execute applies script edits to a persistent project in one transaction. Provide script or a saved edit_id with literal edits, never both; failures roll back writes. A revision conflict while preparing the response may follow a committed edit: retrieve state before retrying. Minimal script after creating a project: const t = AddTrack("video"); Insert(t, {type: "color", color: "#123456", start: 0, length: 3}); Print(t);
Script function, field and error reference
Every script function, clip field and error code has its own section, read one at a time:
codemode.describe("praxis.cut.script.<Name>") // one function: signature, arguments, return, errors, examplecodemode.describe("praxis.cut.fields.<name>") // one field: type, unit, range, default, where writablecodemode.describe("praxis.cut.errors.<CODE>") // one code: meaning, causes, fixcodemode.describe("praxis.cut.script") // names, one page at a timePublished at https://docs.deepraxis.com/developers/cut/script-reference with one anchor per entry. Names below omit the praxis.cut.<kind>. prefix.
Script functions (script)
GetTimeline— Duration, tracks, joins; clips are underitems.GetItem— One clip’s compact view, by id.FindItems— Visit every clip with its track; collect results.GetMedia— Media metadata;durationis seconds.GetTranscript— Transcript words in source microseconds.GetAnalysis— Silence, filler, scene or beat segments.ListTransitions— Join transition kinds and parameters.ListEffects— Visual-effect catalog and parameters.ListAnimations— Animation presets by phase and target.ListFonts— Font families, weights and scripts.ListTextStyles— Text style presets forstyle.preset.ListTextTemplates— Multi-layer templates and their slots.Insert— Add a clip; a track never overlaps itself.Append— Add a clip at the end of a track.Update— Change named fields; the rest stay.SetSpeed— Change rate, keeping source or duration.Delete— Remove a clip. There is noRemove.Join— Overlap clips; followers shift, track shortens.UpdateJoin— Change a join’s length or effect.DeleteJoin— Remove a join; restore the butt cut.Split— Cut a clip in two at a time.Trim— Move one clip edge by seconds.Move— Set a clip’s start or track.RippleDeleteRange— Cut a time range and close the gap.DeleteWords— Cut transcript words and ripple every track, keeping a breath.RemoveFillers— List and delete filler words by media’s own labels; dryRun first.Matte— Replace the clip’s background with media’s matte of its source, read as a luma mask.EnhanceVoice— Replace a clip’s sound with media’s enhanced speech on its own audio track.AlignByAudio— Line two recordings of the same sound up by media’s measurement of their offset.Reframe— Swap the clip’s media for media’s reframed take at the aspect you ask for.Upscale— Swap the clip’s media for media’s upscaled take at the height you ask for.Redact— Pixelate the faces, QR codes or text media marks, leaving the rest of the frame plain.AddTrack— Add a video, audio or caption track.MoveTrack— Move a track between layers; 0 is the topmost.UpdateTrack— Change a track’s name, lock, gain or role.DeleteTrack— Remove a track and its clips.SetSettings— Change canvas, frame rate or background.AddCaptionsFromTranscript— Captions from a clip’s kept words.InsertTemplate— Insert a template and fill its slots.AlignCaptions— Rebuild captions from text punctuation.ImportCaptions— Import SRT or WebVTT onto captions.ExportCaptions— Export captions as SRT or WebVTT.SetMarker— Label a timeline position.Print— Append values to the result’sprints.Preview— Up to 8 frames as inline PNG data URLs.
Fields (fields)
type— Clip kind; decides which fields apply.start— Clip start in seconds; snaps to frames.length— Duration; video and audio may omit it or write “auto”.media— Source{ libraryId, assetId }.sourceIn— First source second kept; default 0.sourceOut— Exclusive source end; read-only.text— Text of a text or caption clip.color— Solid colour of a color clip.shape— Shape clip kind:rectorellipse.width— Shape width, a fraction of canvas width.height— Shape height, a fraction of canvas height.radius— Rect corner rounding, in 1080-height px.fill— Shape or text paint: colour or gradient.stroke— Shape outline: colour and width.transform— Position, scale, rotation, opacity, crop, blur.fit— contain, cover, fill or none.blend— Layer blend mode; null clears.style— Text styling in Shotstack’s rich shape: font, gradient, stroke, shadow, box, border, align, per-word animation.style.align.vertical— top, middle or bottom; omit it, never null.playback— Rate, direction, audio policy, or freeze.volumeDb— Audio level in dB; 0 is source level.gain— Keyframed audio level in dB.fadeIn— Fade-in seconds at the clip’s start.fadeOut— Fade-out seconds at the clip’s end.duck— Lower this clip while another track plays.animate— Transform keyframes;atis clip-relative seconds.reveal— Per-character, word or line reveal timing.animation— Preset slots{ in, out, loop }; null clears.effects— Effect stack, at most 8; null clears.transitionIn— Entrance effect: kind plus seconds.transitionOut— Exit effect: kind plus seconds.mask— Shape, path or track matte.words— Caption words with clip-local times.
Error codes (errors)
JOIN_CONFLICT— A join is invalid or blocks this edit.INVALID_TRANSITION— Bad transition kind, parameter or length.INVALID_STYLE— A style value is out of range.UNSUPPORTED_STYLE_FIELD— A Shotstack style field this platform cannot render yet.STYLE_LEGACY_FIELDS— A style written in the old flat shape; it still works.INVALID_MASK— A mask definition is malformed.MASK_IN_USE— The edit would break a live mask.TOO_MANY_MASKS— At most 16 masks per project.RATE_OUT_OF_RANGE— A rate is outside 0.25-4.UNSUPPORTED_PLAYBACK— Reverse without an explicit mute.INVALID_PLAYBACK— A playback object is partial or malformed.UNKNOWN_FONT— The family is not inListFonts().UNKNOWN_FIELD— The field name is not accepted here.UNKNOWN_TEXT_STYLE—style.presetis not in the catalog.TEXT_STYLE_TARGET_MISMATCH— Preset on the wrong clip type.CAPTION_ALIGN_LOW_CONFIDENCE— Alignment confidence too low; nothing changed.OVERLAP— Two clips on one track would share time.OUT_OF_SOURCE— The clip would read past its source.LOCKED_TRACK— The edit targets a locked track.UNBOUND_LIBRARY— The library is not bound to the project.TRACK_KIND_MISMATCH— The clip type does not fit the track.NOT_FOUND— The named id is not in this project.TOO_SHORT— The result would be under one frame.INVALID_DUCK— Badducklevel or a missing track.UNKNOWN_ANIMATION— The preset is not inListAnimations().INVALID_ANIMATION_PARAM— Bad slot, parameter or keyframe limit.ANIMATION_TOO_LONG— In plus out exceed the clip length.ANIMATION_TARGET_MISMATCH— The preset does not match the clip type.ANIMATION_PHASE_MISMATCH— The preset is in the wrong slot.UNKNOWN_EFFECT— The effect is not inListEffects().INVALID_EFFECT_PARAM— Bad effect parameter or keyframe.TOO_MANY_EFFECTS— More than 8 effects on one clip.PROJECT_NOT_FOUND— No visible project has this id.EXPORT_NOT_FOUND— No such export in this project.DRAFT_RENDER_NOT_FOUND— No such draft render.VERSION_NOT_FOUND— No saved version has this revision.LIBRARY_NOT_FOUND— The library is missing or invisible.BINDING_INVALID— The binding request is malformed.BINDING_IN_USE— Clips still use this library’s assets.NOTHING_TO_UNDO— No earlier revision to return to.NOTHING_TO_REDO— No undone revision is waiting.UNDO_CONFLICT— The revision to undo is no longer head.REVISION_CONFLICT— The project moved; your revision is stale.CUT_BUSY— The project is busy; retry.INVALID_CAPTION_FILE— The subtitle file is malformed or too big.SCRIPT_ERROR— The script threw or did not parse.SCRIPT_LIMIT— An execute budget was exceeded.OPS_REJECTED— An op failed; the whole edit rolled back.EDIT_EXPIRED— The saved edit id is over ten minutes old.MEDIA_NOT_FOUND— The asset id is not in that library.MEDIA_OFFLINE— The asset cannot be fetched right now.MEDIA_UNAVAILABLE— The asset is not usable for rendering.MEDIA_IMPORT_FAILED— Importing media failed.MEDIA_PROCESSING— Media is still processing the clip; wait for the job and rerun.MEDIA_PROCESSING_FAILED— Media’s processing job failed; nothing changed.ALIGNMENT_UNCERTAIN—AlignByAudioconfidence too low; nothing changed.FRAME_OUT_OF_RANGE— The preview time is outside the project.PROJECT_TOO_LARGE— The project exceeds the size limit.RESPONSE_TOO_LARGE— The response would exceed its budget.EXPORT_FAILED— The render failed; readerror.cause.INVALID_PARAMS— The request is malformed.PERMISSION_DENIED— This credential may not do that here.NOT_IMPLEMENTED— Not available on this platform yet.INTERNAL— Unexpected failure; retry with the request id.
Support: supported
Parameters
| Name | Location | Type | Required | Description |
|---|---|---|---|---|
| project_id | path | string | true | Project identifier returned by its create or list operation; use the id, not a display name. |
Request body (application/json)
Required: true
| Name | Type | Description |
|---|---|---|
| script | string | Synchronous editing source using Cut execute functions; submit this or edit_id, never both. Script source is opaque: function names and object fields inside JavaScript use their documented camelCase spelling. |
| edit_id | string | Saved failed script identifier from error.details.edit_id; valid for ten minutes. |
| edits | array<object> | Literal replacements applied to the saved source before rerunning. |
| edits[].find | string | Literal source text to locate in the saved script. |
| edits[].replace | string | Replacement source text; passed to the script without renaming fields. |
| edits[].all | boolean | True replaces every occurrence; false or omission requires exactly one match. |
| expected_revision | integer | Committed project revision from retrieve, state, timeline or execute; increases after each successful write. |
{ "type": "object", "description": "Submit new synchronous source or patch a saved failed script; script and edit_id are exclusive.", "properties": { "script": { "type": "string", "description": "Synchronous editing source using Cut execute functions; submit this or edit_id, never both. Script source is opaque: function names and object fields inside JavaScript use their documented camelCase spelling.", "maxLength": 65536 }, "edit_id": { "type": "string", "description": "Saved failed script identifier from error.details.edit_id; valid for ten minutes." }, "edits": { "type": "array", "description": "Literal replacements applied to the saved source before rerunning.", "items": { "type": "object", "description": "One source replacement for an edit_id retry.", "properties": { "find": { "type": "string", "description": "Literal source text to locate in the saved script." }, "replace": { "type": "string", "description": "Replacement source text; passed to the script without renaming fields." }, "all": { "type": "boolean", "description": "True replaces every occurrence; false or omission requires exactly one match." } }, "required": [ "find", "replace" ] } }, "expected_revision": { "$ref": "#/components/schemas/cut-Revision" } }, "oneOf": [ { "required": [ "script" ], "not": { "required": [ "edit_id" ] } }, { "required": [ "edit_id" ], "not": { "required": [ "script" ] } } ]}Response
HTTP 200
Requested resource or operation result; use its revision when preparing a guarded edit.
application/json
| Name | Type | Description |
|---|---|---|
| revision | integer | Committed project revision from retrieve, state, timeline or execute; increases after each successful write. |
| summary | object | Committed edit counts and second-based duration changes. |
| summary.added | integer | Number of clips added by the transaction. |
| summary.removed | integer | Number of clips removed by the transaction. |
| summary.modified | integer | Number of clips changed by the transaction. |
| summary.duration_before | number | Project duration before the transaction. In seconds, not frames or microseconds. |
| summary.duration_after | number | Project duration after the transaction. In seconds, not frames or microseconds. |
| summary.lines | array<string> | Human-readable descriptions of the committed edits. |
| created | object | Script result names mapped to newly created clip or track ids; keys retain their original spelling. |
| prints | array<string> | String output from Print calls in execution order. |
| warnings | array<object> | Non-fatal issues to inspect after the edit committed. |
| warnings[].code | string | Machine-readable warning category used to select a follow-up check. |
| warnings[].clip_id | string | Affected clip identifier; use GetItem or inspect the timeline. |
| warnings[].message | string | Human-readable explanation of the warning. |
| frames | object | Optional rendered previews keyed by requested time in seconds. |