ClipSDKDOCS
REST Reference (Python)

ClipSDK Clips API Reference (Python)

Complete Python reference for POST /v1/clips, from_job second passes, presigned uploads, and word-level clip edits on https://api.clipsdk.com.

POST /v1/clips Parameters

POST https://api.clipsdk.com/v1/clips accepts a video_url or from_job plus clip count, aspect ratio, active-speaker reframe, caption preset, hook banner, prompt, and webhook_url.

Control wait behavior with ?wait=0..300 (default 60) or the Prefer header (wait=120 or respond-async). Pass Idempotency-Key (1-255 printable ASCII chars, 24h TTL per API key) to retry safely without double billing; replayed responses include Idempotent-Replayed: true.

FieldType & RangeDefaultBehavior
video_urlHTTPS URI (<=4096 chars)Required*15 supported platforms, direct MP4/MOV/WebM/MKV, or /v1/uploads URL (<=5 GB, <=48h, first 3h clipped). *Omit with from_job.
from_jobjob_[a-z0-9]{20}NoneRe-clip a succeeded job (<7 days old) skipping already clipped moments.
clipsinteger 1-20 (1-50 paid)5Max ranked clips returned best-first (rank: 1 highest score).
min_secondsinteger 10-90 (10-180 paid)20Minimum duration per clip in seconds.
max_secondsinteger 15-90 (15-180 paid)60Maximum clip duration; must be at least min_seconds + 5.
aspect9:16, 1:1, 4:5, 16:99:161080x1920, 1080x1080, 1080x1350, or 1920x1080 output resolution.
reframeauto, center, noneautoauto tracks active speaker; center crops middle; none fits whole frame over blur.
captionsfalse, preset string, or objectbold8 presets or style object; see Captions & Hooks.
hookboolean or style objectfalseOpening headline overlay (classic, outline, sticky, banner, pill).
languageISO 639-1 (e.g. en, es)AutoSpoken language hint for transcription.
promptstring (<=500 chars)NoneSteers moment selection toward specific themes or speakers.
qualitystandard, highstandardhigh renders higher-bitrate sharper video at 1.5x job price.
bleepbooleanfalseBleeps swear words in audio and censors them in captions, SRT/VTT, and hook.
first_secondsinteger 60-10800First 3hTranscribes, clips, and bills only the opening N seconds (>= min_seconds).
webhook_urlHTTPS URINoneReceives signed job.succeeded or job.failed webhook POST.
Create async clipping job + second-pass from_job in Pythonpython
import json, os, urllib.request

API_KEY = os.environ["CLIPSDK_KEY"]

def post_json(path: str, body: dict, idem_key: str):
    req = urllib.request.Request(
        f"https://api.clipsdk.com{path}",
        data=json.dumps(body).encode("utf-8"),
        headers={
            "Authorization": f"Bearer {API_KEY}",
            "Content-Type": "application/json",
            "Prefer": "respond-async",
            "Idempotency-Key": idem_key,
        },
        method="POST",
    )
    with urllib.request.urlopen(req, timeout=30) as resp:
        return json.loads(resp.read().decode("utf-8"))

# First pass: clip the opening 60 minutes
job1 = post_json(
    "/v1/clips",
    {
        "video_url": "https://cdn.example.com/interview-ep88.mp4",
        "clips": 8,
        "min_seconds": 25,
        "max_seconds": 75,
        "aspect": "9:16",
        "reframe": "auto",
        "captions": "karaoke",
        "hook": {"template": "pill", "seconds": 4},
        "first_seconds": 3600,
        "webhook_url": "https://app.example.com/webhooks/clipsdk",
    },
    "ep88-pass-1",
)["job"]

# Second pass later: mine 5 new moments without re-uploading
job2 = post_json(
    "/v1/clips",
    {"from_job": job1["id"], "clips": 5, "captions": "minimal"},
    "ep88-pass-2",
)["job"]
print("Queued:", job1["id"], job2["id"])

GET and DELETE /v1/jobs/{id}

Poll GET /v1/jobs/{id}?wait=0..300 to track stages (fetching, transcribing, ranking, reframing, rendering) and call DELETE /v1/jobs/{id} to purge finished files early.

Any API key belonging to the account can read a job. While job.status is queued or running, GET /v1/jobs/{id} returns 202 Accepted with Location and Retry-After. Once finished, it returns 200 OK whether status is succeeded or failed. Every response carries a Request-Id header matching error.request_id.

  • DELETE /v1/jobs/{id}: Deletes the finished job's clips, posters, captions, transcript, and its /v1/uploads source once no other job references it. Returns 200 { "id": "...", "deleted": true }. Billing is unaffected.
  • Active Jobs Protection: Deleting an in-progress job or one with a rendering clip edit returns 409 JOB_NOT_FINISHED with Retry-After.
  • 7-Day Automatic Expiry: All rendered MP4, JPG, SRT, VTT, and uploaded source files live at GET /f/{key} for 7 days with HTTP Range support (200, 206, 416) and zero auth header required.

POST /v1/uploads Presigned Uploads

Mint a 1-hour presigned upload_url via POST /v1/uploads for local MP4, MOV, WebM, or MKV files up to 5 GB within the 20 GB per UTC day account quota.

StepRequestImportant Constraint
1. Request ticketPOST /v1/uploads with { "filename": "ep42.mp4", "size": 842104832 }Returns 201 { upload_url, video_url, expires_at } (valid 1 hour)
2. Upload bytesPUT <upload_url> with raw file stream and Content-Length: <exact size>Do NOT send Authorization; any 2xx confirms storage for 7 days
3. Clip videoPOST /v1/clips passing returned video_urlReuse the same video_url across multiple jobs while stored

Word-Level Post-Render Clip Edits

Paid accounts can inspect word timestamps with GET /v1/jobs/{id}/clips/{rank}/words and re-render individual clips via POST /v1/jobs/{id}/clips/{rank}/edit up to 20 times per clip.

POST /v1/jobs/{id}/clips/{rank}/edit accepts only the fields you want to change (trim, aspect, reframe, captions, hook, words, bleep); omitted fields stay unchanged. It answers 202 Accepted immediately while clip.edit.status stays rendering on GET /v1/jobs/{id}. Once edit.status returns to idle, the clip's video, poster, srt, and vtt URLs point to the new render and edit.revision increments.

Edit FieldSchemaNotes
trim{ start_s, end_s } (0..segment_s, >=3s)Relative to the clip's original untrimmed start; later trims can restore earlier cuts
words[{ text, start_s, end_s }] (1-3000 items)Pass the full array from /words with fixed spelling or punctuation
aspect / reframe9:16|1:1|4:5|16:9 / auto|center|noneSwitch platform framing without re-transcribing the source video
captions / hook / bleepSame schemas as /v1/clips + hook.textOverride opening headline text (hook.text, <=1024 chars) or toggle profanity bleeping
Inspect words, fix a brand typo, trim, and poll edit status in Pythonpython
import json, os, time, urllib.request

API_KEY = os.environ["CLIPSDK_KEY"]
JOB_ID = "job_3k9x0c2m1q8w7e6r5t4y"

def call(method: str, path: str, body=None):
    headers = {"Authorization": f"Bearer {API_KEY}"}
    data = None
    if body is not None:
        headers["Content-Type"] = "application/json"
        data = json.dumps(body).encode("utf-8")
    req = urllib.request.Request(f"https://api.clipsdk.com{path}", data=data, headers=headers, method=method)
    with urllib.request.urlopen(req, timeout=30) as resp:
        return json.loads(resp.read().decode("utf-8"))

word_data = call("GET", f"/v1/jobs/{JOB_ID}/clips/1/words")
fixed_words = [
    {**w, "text": "ClipSDK" if w["text"].lower() == "clipsdk" else w["text"]}
    for w in word_data["words"]
]

call("POST", f"/v1/jobs/{JOB_ID}/clips/1/edit", {
    "trim": {"start_s": 1.8, "end_s": word_data["segment_s"] - 1.0},
    "words": fixed_words,
    "hook": {"template": "banner", "text": "How we cut render costs 4x", "seconds": 4},
})

while True:
    job = call("GET", f"/v1/jobs/{JOB_ID}")["job"]
    clip = next(c for c in job["result"]["clips"] if c["rank"] == 1)
    if clip["edit"]["status"] != "rendering":
        print("Edit finished:", clip["edit"]["status"], clip["video"])
        break
    time.sleep(4)

Paid accounts allow 20 edits per clip and 100 edits per UTC day until 1 hour before a job's 7-day files expire (410 CLIP_EXPIRED). Free-tier edit calls return 402 PAYMENT_REQUIRED with error.billing_url.

GET /f/{key} File Delivery

ClipSDK serves every rendered MP4, JPG poster, SRT, and VTT file from GET https://api.clipsdk.com/f/{key} for 7 days with public access and byte-range streaming.

Player elements (<video src="...">), social schedulers, and media workers can stream or copy /f/{key} assets directly without attaching your API key. Mirror long-lived customer assets into your own object storage inside your webhook worker, then optionally call DELETE /v1/jobs/{id} to remove temporary files immediately. Check rate limits and full error codes in Pricing & Limits.