Edits a clip with one or more semantic ops in a single call (executed in order, ONE preview re-render at the end), saves the result onto the clip, and supports undo. Ops: 'set_captions' / 'set_emoji' / 'set_keyword_highlight' (pass enabled true|false), 'remove_filler_words' (hard-cuts um/uh/like), 'remove_pauses' (hard-cuts silences at or above minPauseSec, default 0.5s), 'trim_section' / 'split_section' / 'drop_section' / 'reorder_sections' (structural edits: a section is one cut of the clip, addressed by its 0-based sectionIndex -- every timeline op result echoes the resulting sections as index/start_sec/end_sec, so the next op can be addressed without re-reading anything), 'delete_phrase' (cuts a spoken phrase out of BOTH the video and the captions, not just the on-screen text -- give phrase as the words to remove, matched against this clip's own transcript ignoring case/punctuation/whitespace; if it appears more than once, pass occurrence to pick one (1-based) or "all"), 'replace_phrase' (fixes the caption TEXT -- a typo, a misheard word -- without touching the video or its timing: give phrase as the wording on screen now and replacement as the wording you want, with the same number of words; same matching and occurrence rules as delete_phrase), 'set_style' (caption appearance -- pass any of captionColor (the caption text colour), highlightColor (the keyword-highlight colour, the OpusClip default being the bright green #04f827), captionPosition, uppercase; several in one set_style is one change. NOTE these are style settings, NOT script edits -- they are the only way to change caption colour, which is not present in the editing script at all), 'add_text_overlay' / 'set_text_overlay' / 'remove_text_overlay' (a title card, lower third or outro text laid OVER the video -- the clip keeps its length. It renders as the same card the auto-hook uses: bold black text on a white rounded box. add takes text, atClipSec (where it starts), durationSec (default 5, clamped to the clip end) and position top|middle|bottom (default top); set and remove address an existing one by overlayIndex, 0-based in time order, and every result lists the overlays so the next op can be addressed without re-reading; set takes any of text / position), 'remove_emoji' / 'move_emoji' (one emoji at a time, picked by atClipSec -- the moment it is on screen; move_emoji also takes position top|middle|bottom. Unlike set_emoji, which switches the whole emoji layer on or off, these leave every other emoji alone; if nothing is showing at that moment the call errors and lists when emoji do appear), 'dub' (translates the clip's speech into another language as a NEW clip -- the original clip is untouched and does not re-render. Must be the ONLY op in the array: it starts an async job, not a script edit, and undo does not apply to it (there is a new clip, not a change on this one to revert). Three modes: 1. call with targetLang only to get the credit cost (10 credits per minute of clip) and a one-time quoteToken valid for 10 minutes; 2. call again with targetLang, confirm:true and that quoteToken to start the job, which returns job_id and new_clip_id; 3. poll by calling with jobId:"<job_id>" until status is completed. Do NOT poll describe_clip for dub progress -- the new clip copies the SOURCE clip's render state, so it looks ready while the dubbed audio is still being generated. For dubbing the WHOLE project at submit time, use submit_project's dubbingLanguage instead), and 'undo' (alone in the array: reverts the previous edit_clip call -- available for 72 hours; calling undo twice redoes. Undo is refused if the clip changed after that edit, e.g. a web editor save, so newer work is never discarded). Batch related edits into ONE call ("remove fillers and turn captions off" = two ops, one render). Removal ops shorten the clip; video, captions, and audio stay in sync. The edit is persisted immediately, and every result carries editor_deep_link -- opening it shows the edited clip right away, because the web editor rebuilds its preview from the saved script instead of waiting on the render. Offer that link to a user who wants to see the result now. The rendered preview follows asynchronously -- the result returns render_pending true, poll describe_clip until it clears, then read the clip's preview_url to see the new video. No HD render is booted; HD renders on demand at export_clip. This vocabulary is the whole editing surface -- for anything outside it, say so plainly and point the user at the clip in the OpusClip web editor rather than approximating with a near-miss op. Pass dryRun: true to see what a batch WOULD do -- it reports each op and the tracks the clip carries, and saves and renders nothing; with an empty ops array it is the way to ask what the clip has before editing.
opusclip_edit_clip