Pipelines

Process video files through versioned graphs of analysis, review, redaction and publishing steps.

Editframe enables pipelines for each organization after you tell us about your footage. Until then, every pipeline route returns 404.

A pipeline is a named, versioned graph of steps. A run processes one video file through one version of a pipeline. Each step starts when the steps it needs have finished, so independent steps run in parallel.

Editframe runs the built-in steps: probe, transcription, frame sampling, scene detection, detection of faces and spoken personal details, redaction and publishing. An endpoint step sends the media and earlier results to your own service. Filter and review steps decide whether the rest of a branch runs, and a join step merges branches.

Every step writes its output to a namespace on the file. Later steps, filters and your own code read outputs by namespace. See Pipeline runs to monitor, cancel, retry and review runs.

Browse pipeline examples to see recordings, steps, and outputs. Use the definition checker to validate JSON in your browser. Both are available without an account.

Quick start

Create a speech-check pipeline and run it on a short recording. The pipeline transcribes the audio and publishes playback when it finds speech.

  1. In a new directory, save a short MP4 recording with audible speech as sample.mp4.
  2. Run this command to write speech-check.json. You can also paste the JSON into the definition checker.
bash
cat > speech-check.json <<'JSON'
{
  "steps": {
    "probe": { "type": "probe" },
    "transcript": { "type": "transcribe", "needs": ["probe"] },
    "has_speech": {
      "type": "filter",
      "needs": ["transcript"],
      "when": { "path": "transcript.metadata.word_count", "op": "gt", "value": 0 }
    },
    "publish": { "type": "publish", "needs": ["has_speech"] }
  }
}
JSON
  1. For a hosted run, use an organization with Factory enabled. Set EDITFRAME_TOKEN to an API key from that organization. Run the following command with Node.js and npm installed.
bash
npm exec --package=@editframe/cli -- editframe pipelines create speech-check --definition speech-check.json
  1. Copy the pipeline ID from the creation result. Replace PIPELINE_ID in the following command with that value.
bash
npm exec --package=@editframe/cli -- editframe pipelines upload ./sample.mp4 --run PIPELINE_ID --watch

The command uploads the file, starts a run, and waits for the result. Expect succeeded when the transcript contains words. A recording with no transcribed words ends filtered. Open the run in the dashboard to inspect its steps and transcript. See the CLI installation and command reference to invoke editframe directly.

Run the same definition with the SDK

There is also an experimental @editframe/api/pipelines entry point. In a Node.js project, run npm install @editframe/api. Save this code as speech-check.mjs beside the definition file. Replace FILE_ID with the input file ID returned by the upload command or upload a file with the SDK. Run node speech-check.mjs with the same EDITFRAME_TOKEN.

js
import { readFileSync } from "node:fs";
import {
  Client,
  createPipeline,
  createPipelineRun,
  getPipelineRun,
  isPipelineRunTerminal,
} from "@editframe/api/pipelines";

const client = new Client(process.env.EDITFRAME_TOKEN);
const definition = JSON.parse(readFileSync(new URL("./speech-check.json", import.meta.url), "utf8"));
const pipeline = await createPipeline(client, {
  name: "speech-check-sdk",
  definition,
});

const { run } = await createPipelineRun(
  client,
  { pipeline_id: pipeline.id, file_id: "FILE_ID" },
  { idempotencyKey: "speech-check:FILE_ID" },
);

let current = run;
while (!isPipelineRunTerminal(current)) {
  await new Promise((resolve) => setTimeout(resolve, 5000));
  current = await getPipelineRun(client, run.id);
}
console.log(current.status);

Definitions

A definition is a JSON object with one field, steps. Each key of steps is a step key: 1–63 characters of lowercase letters, digits and underscores, starting with a letter. A definition has 1–64 steps.

Edit or paste a definition below to check its step types, options and dependencies with Factory's parser. This validates the definition; it does not start a run or check whether an endpoint is registered.

Paste or type a pipeline file, and Factory's own parser checks it as you go.

Factory's parser accepts this file: 3 steps.

Unknown fields cause a validation error. Editframe stores the normalized definition: it records every default, sorts needs, kinds and formats, and computes a digest (sha256: followed by the SHA-256 of the canonical JSON). Equivalent definitions have the same digest.

Step types

Notes on the built-in steps:

  • probe is final: it runs once the whole file is available.
  • transcribe reads the first audio track, or the track labelled track; a file without that track gets an empty output with track_found false. Without language, or with en, it transcribes English. With another code, or auto, it transcribes that language or the one it detects, and language in the output is the language it reported. In English, it leaves out words with no speech under them, which recognition can write over music, noise or silence, and segments hold only the words it keeps; speech that loud noise drowns out, such as commentary under a rocket launch's roar, can be left out with them. When an output would exceed the output limits, it keeps segments in time order and includes words only if all of them fit. truncated reports that annotations were left out.
  • In English, transcribe also writes a speech.untranscribed annotation, with start_ms, end_ms, text and track_id, for each stretch of speech between words that the transcript leaves out, such as a filler ("um"), a false start, a stutter or a missed word, so a later step can cut or avoid it. Its text is the speech spelled as it sounds, such as ah, im or like, and is approximate, or um for a voiced sound at the speaker's level in which no letters are heard, such as a closed-mouth hum; segments and words do not include it. Breaths, clicks, noise, music between the words and stretches shorter than 80 ms get none, and other languages get none. These annotations follow the words, and are included only if all of them fit.
  • sample_frames takes a frame at each multiple of every_ms. Endpoint steps that need it receive the frame URLs.
  • redact_render blurs every annotation of the selected kinds that has keyframes, and mutes the audio of every one without keyframes. It reads the annotations of every step it needs, directly or indirectly, with review corrections applied. It creates an ordinary render in your organization, which uses render minutes like any other render. Editframe then adds the rendered MP4 to your organization as a new file, named after the input with a -redacted.mp4 suffix, and the step succeeds when that file is ready. output_file_id is its ID. Like an upload, it sends file.processing and then file.ready or file.failed webhooks, and it expires when the input file does. When nothing matches, the step succeeds without rendering, and the output's status is skipped. A failed render or redacted file fails the step without an automatic retry; retrying the run renders again.
  • With captions: true, redact_render burns in captions from the original output of the one transcribe step it needs, directly or indirectly. Needing none fails validation with not_upstream at with.captions, and needing more than one fails with not_allowed. Each transcript segment is one caption, and a word overlapping a mute span shows as ▇▇▇. With title, it shows title.text, trimmed of white space, at the top of the video until duration_ms, fading out over the last half second. A step with captions or a title always renders, even when nothing matches.
  • model runs an ONNX export of an open model from Hugging Face on the frames of the sample_frames steps it needs, directly or indirectly, or on boxes in them with crops. revision pins the model's commit, so a later change on the Hub cannot change a stored pipeline. Editframe resolves the revision when you create the version and copies its files; a step waits until the copy is ready. The model's config.json model_type must be one Editframe runs for that task: detr, d_fine or owlv2 for object-detection, depth_anything or depth_anything_3 for depth-estimation, vit or siglip for image-classification, and siglip for image-feature-extraction. Its licence, or that of the model it converts, must be apache-2.0, mit, bsd-2-clause, bsd-3-clause or cc-by-4.0. A revision that does not qualify fails validation at with.model, with.revision or with.task with model_not_found, model_access_denied, model_license_not_allowed or model_unsupported, and labels it cannot use fail at with.labels with model_labels_required or model_label_unknown. Object detection writes an object annotation with a keyframe for each box. Image classification writes an image.label annotation for each of a frame's five highest labels, and max_scores, each label's highest score across the frames, which a filter can test, for example nsfw.metadata.max_scores.nsfw. min_confidence, when set, drops scores below it; omitted, every score the model reports is kept. When an output would hold more than 4,000 annotations, the highest scores are kept and truncated is true.
  • scene_render draws the object annotations of the steps it needs, or a scene graph from metadata.scene when a step wrote one, as one labeled isometric view. It creates an ordinary render. The step needs at least one upstream step. It adds the rendered MP4 as a new file, named after the input with a -scene.mp4 suffix, and succeeds when that file is ready.
  • track follows the boxes of the kinds it names, which the steps it needs found frame by frame. Detections at or above high_confidence start tracks and are matched first; those from min_confidence only continue them. A detection continues a track when its box overlaps where the track predicts the object by at least iou_threshold. A track ends after max_gap_ms without a detection, and one shorter than min_duration_ms is dropped and counted in short_track_count. Boxes from different steps, kinds, labels or source tracks are never linked. A redact_render step that selects <kind>.track blurs each object between its keyframes.
  • render renders a template with RENDER_DATA built from the steps it needs: { "source": { "file_id", "filename", "duration_ms", "width", "height" }, "steps": { "<namespace>": { "metadata", "annotations" } } }, with review corrections applied and steps narrowed to include. With for_each, it renders once for each item of that list, adding item and index; an item's name names its render, otherwise <step key>-<n>. An item with start_ms and end_ms receives only the annotations that overlap its span, so a clip's template gets the transcript words spoken during the clip; with context_ms, it also receives those within that many milliseconds before and after its span, such as the speech either side of a clip that the template needs to place its first and last cut. A render lasts as long as its template's root timegroup, so a template may cut time out of an item's span, unless the item or the step names a duration_ms. With composition, it renders each composition the named step wrote, at the composition's own size. Each render is an ordinary render in your organization and uses render minutes. Each rendered MP4 becomes a new file named after the input and the render's name. The step succeeds when every render has finished and at least one has rendered, and lists failed renders beside the rest; it fails when every render fails. See Render results for passing a template's decisions to later steps.
  • llm sends a Gemini or Claude model on Google Cloud its instructions, the input file's ID and duration, the outputs of the steps it needs as JSON (or the namespaces and paths include names, in that order), up to max_frames frames from the sample_frames steps it needs and, with attach_video, the input video. It drops frames, then shortens the outputs and leaves out annotations, to fit max_input_tokens, and records what it sent in llm.input. location keeps the request in that region's data boundary. With output.mode json, the answer must follow output.schema, a JSON Schema subset of object, array, string, number, integer and boolean types with properties, required, items, minItems, maxItems, enum, minimum and maximum, which may not declare llm; an answer that does not fails the step with model_output_invalid. An array item with kind, start_ms and end_ms becomes an annotation when it is a valid output annotation; one with box keyframes, such as a licence plate or on-screen text the model found in the frames or video, is ready for a track or redact_render step, and an invalid item is left out and counted in llm.annotations_skipped. With composition, the answer is a list of compositions of at most max_duration_ms each, which a render step with composition renders. Their ef-video and ef-audio elements may play, by file-id, the input file and the files that the redact_render, scene_render, render and speak steps it needs, directly or indirectly, made; the model is told each file's ID, kind and the step that made it, and a composition that names any other file is sent back for correction. With agent, the model works in up to max_turns turns and max_tokens tokens, reading the run's outputs, frames and transcript and previewing renders through tools, and fails with model_budget_spent when it runs out. A model that declines to answer fails the step with model_rejected. Each response is recorded before the step uses it, so a retry that sends the same request reuses it; reused_calls counts those. Editframe enables llm steps for an organization on request; elsewhere a definition with one fails validation with step_not_enabled at the step's type.
  • speak voices the lines a step it needs wrote, such as a translated script or audio description from an llm step. Each line is an object with text of 1–1000 characters, start_ms and end_ms, and optionally its own voice and style; a step voices at most 500 lines. It calls a Gemini text-to-speech model on Google Cloud with style and language as delivery directions, and places each line's speech at its start_ms. Speech that runs past end_ms is asked for again at a faster pace, and the shorter delivery is then sped up without changing its pitch, by at most 1.3×; paced and speed record what was done, and speech that still does not fit plays on past end_ms. With mix, the input's first audio track plays under the speech, lowered by source_gain_db while each line plays and ramping over a quarter second on either side; without mix, or when the input has no audio, the file holds only the speech. Editframe adds the audio to your organization as a new AAC file, named after the input with a -speech.m4a suffix, and the step succeeds when that file is ready; file_id is its ID, which an llm step's compositions play with ef-audio. Like a redacted file, it expires when the input file does. A lines value that is not a list, or a line without text, with an unknown voice or starting at or after the input's end, fails the step with lines_invalid. Each synthesis is recorded before the step uses it, so a retry reuses it, and a group's model usage counts its tokens. Editframe enables speak steps with llm steps; elsewhere a definition with one fails validation with step_not_enabled at the step's type.
  • publish returns playback URLs for the run's input file. After redact_render, scene_render, render or speak steps it needs, directly or indirectly, it plays the files they made instead, or the input file for a redaction that was skipped. The output's file_id and URLs are those of the first file in step key order. With several files, renditions lists each one's step_key, file_id and URLs, and the name and index of a render. Requests to the URLs need an API key, a session or a signed URL token.

Render results

A render step's template can pass what it decided from its data to later steps. Set window.EF_RENDER_RESULT to a JSON value while the page loads, for example in the script that reads RENDER_DATA:

html
<ef-timegroup mode="fixed" duration="6s"><!-- the play's footage --></ef-timegroup>
<script>
  const play = window.RENDER_DATA.item;
  const replay = play.label === "replay";
  window.EF_RENDER_RESULT = { replay, start_ms: replay ? play.start_ms + 2000 : play.start_ms };
</script>

Editframe reads it once per render, when it measures the render's size and duration, after the template's scripts have run and its media durations have resolved. The step lists it as that render's result:

json
{ "index": 3, "name": "q2-dunk", "status": "complete", "duration_ms": 6000, "result": { "replay": true, "start_ms": 412000 } }

Later steps read it like other metadata: a render step that includes the step receives it in RENDER_DATA.steps.<namespace>.metadata.renders, an llm step sends it to the model, and a filter can test a path such as plays.metadata.renders.3.result.replay. A render whose template sets no result has no result field.

  • A result is a JSON value of at most 16 KiB as UTF-8, nested at most 16 levels deep. A larger or deeper value, a value with no JSON form (such as a function or an object that contains itself), a Promise, or a string with a NUL character fails the render.
  • Compute it from RENDER_DATA alone, without the clock or random numbers. A retry of the step reuses a finished render with the result it recorded, and a render that renders again records its result again.
  • Object keys are not kept in order.

Personal information

A detect_pii step finds spoken personal details in a transcript and faces in sampled frames. Its annotations are ready for a redact_render step with kinds ["pii.face", "pii.speech"], which blurs the faces and mutes the speech.

The PII redaction example adds on-screen text detection and human review to this workflow.

json
{
  "type": "detect_pii",
  "needs": ["transcript", "frames"],
  "with": { "faces": "all", "min_confidence": 0.5 }
}
  • Speech reads the transcript of the one transcribe step the step needs, directly or indirectly, with review corrections applied. Needing none fails validation with not_upstream at with.speech, and more than one with not_allowed. Each match at or above min_confidence becomes a pii.speech annotation over its words, padded slightly so a mute covers their edges. Its label is the entity. The matched text is not stored in the output or passed to later steps. government_id finds US Social Security numbers. Spoken symbols, such as "at" and "dot" in an email address, are read in English, Spanish, German, French and Portuguese. Set speech to [] to detect faces only.
  • Faces reads the frames of the sample_frames steps the step needs, directly or indirectly; needing none fails validation with not_upstream at with.faces. Faces found in consecutive frames form one track, and each marked track becomes a pii.face annotation whose keyframes follow the face. all marks every face. bystanders marks every face except the participant's, the track with the most face area over the file, which suits footage with one main subject, such as an interview. none detects no faces.
  • A step that detects neither speech nor faces fails validation with invalid_value at with.
  • detect_pii is a file step, but it works in 30-second windows: each window runs once the outputs of the steps it needs cover it, so during a streamed upload it follows segment steps it needs.
  • Detection misses some details and marks some that are not personal. Pair it with a review step before a redaction you publish.

Model steps

labels lists the labels a model step reports. With a detector or classifier that has its own labels, such as d_fine or vit, the step keeps only the boxes and labels you list, so later steps and renders receive no others; each label must be one the model's config.json names, spelled the same way, or validation fails with model_label_unknown. A frame's five highest labels are then chosen among those you list.

json
{
  "type": "model",
  "needs": ["frames"],
  "with": {
    "provider": "huggingface",
    "model": "onnx-community/dfine_l_obj2coco_e25-ONNX",
    "task": "object-detection",
    "revision": "60e6123fe13da26a6e1dafc9d608ddeb5c393dcc",
    "min_confidence": 0.4,
    "labels": ["person", "sports ball"]
  }
}

An open-vocabulary model finds what its labels describe, in your words, and a step that runs one must name them (model_labels_required):

  • OWLv2 (owlv2), such as onnx-community/owlv2-base-patch16-ensemble-ONNX at 180d6ef7599bd69bb48db5c72bd49ad03ddfab80, an export of google/owlv2-base-patch16-ensemble, writes an object box for each thing a label describes, labelled with that label. Each label is a short phrase such as license plate or goalkeeper, cut to its first 14 tokens, about ten words. It reports boxes scoring at least 0.1, and of overlapping boxes with one label, only the highest. OWLv2 scores a frame at 960 × 960 pixels and takes about 12 times as long as a d_fine detector, so sample frames sparingly, and give long inputs segment granularity so that no attempt scores more than about 200 frames.
  • SigLIP 2 (siglip), such as onnx-community/siglip2-base-patch16-224-ONNX at ba1f3b0843f24bc5417d38e19c37b287d719b2f4, an export of google/siglip2-base-patch16-224, scores how well each label describes the frame. It scores this is a photo of <label>. in lowercase, and each score is a probability of its own, so several labels can score high, or none. Scores are often low, such as 0.08 for basketball on a frame of a basketball game, so compare labels with each other, or test max_scores against a low threshold. Image classification needs the logit scale and bias of the checkpoint the export converts, which Editframe knows for the fixed-resolution google/siglip2-* checkpoints; another fails validation with model_unsupported.
json
{
  "type": "model",
  "needs": ["frames"],
  "with": {
    "provider": "huggingface",
    "model": "onnx-community/siglip2-base-patch16-224-ONNX",
    "task": "image-classification",
    "revision": "ba1f3b0843f24bc5417d38e19c37b287d719b2f4",
    "labels": ["a rocket launch", "the earth seen from space", "mission control"]
  }
}

With image-feature-extraction, a SigLIP 2 step writes no annotations. Its metadata.embeddings holds the image embedding of each frame, for searching frames by text:

json
{
  "dimensions": 768,
  "dtype": "float16",
  "logit_scale": 112.66890226978423,
  "logit_bias": -16.771724700927734,
  "items": [{ "t_ms": 0, "vector": "AADUJ..." }]
}

Each vector is the embedding scaled to unit length, as base64 of dimensions little-endian IEEE 754 half-precision numbers (a JavaScript Float16Array). To search, embed your text with the same revision's text model (onnx/text_model_quantized.onnx, its Gemma tokenizer from tokenizer.json, the text lowercased and padded to 64 tokens), scale that to unit length and take its dot product with each vector; 1 / (1 + exp(-(logit_scale * dot + logit_bias))) is the probability that the text describes the frame. logit_scale and logit_bias are present when Editframe knows them. The vectors of one output take at most 800,000 bytes; items past that are left out and truncated is true.

crops runs the model on boxes instead of whole frames: each keyframe box of the annotations of kinds that the step named by step wrote, cut from the sampled frame nearest its t_ms, within half the sampling interval, and widened by padding times its width and height on every side. Results keep the source's time and track_id. A label is an image.label annotation with the source box as its keyframe, so you can tell which player wore which shirt; a box found inside a crop is an object annotation placed on the whole frame; an embedding item adds the source box and track_id. A step scores at most 1,000 boxes, the most confident; crops_dropped counts the keyframes left out, including those with no frame nearby and crops smaller than 4 pixels.

json
{
  "steps": {
    "probe": { "type": "probe" },
    "frames": { "type": "sample_frames", "needs": ["probe"], "with": { "every_ms": 1000 } },
    "players": {
      "type": "model",
      "needs": ["frames"],
      "with": {
        "provider": "huggingface",
        "model": "onnx-community/owlv2-base-patch16-ensemble-ONNX",
        "task": "object-detection",
        "revision": "180d6ef7599bd69bb48db5c72bd49ad03ddfab80",
        "labels": ["basketball player"],
        "min_confidence": 0.2
      }
    },
    "tracks": { "type": "track", "needs": ["players"], "with": { "kinds": ["object"] } },
    "teams": {
      "type": "model",
      "needs": ["tracks"],
      "with": {
        "provider": "huggingface",
        "model": "onnx-community/siglip2-base-patch16-224-ONNX",
        "task": "image-classification",
        "revision": "ba1f3b0843f24bc5417d38e19c37b287d719b2f4",
        "labels": ["a white shirt", "a yellow shirt"],
        "crops": { "step": "tracks", "kinds": ["object.track"], "padding": 0.1 }
      }
    }
  }
}

Transcription languages

with.language accepts auto or one of these ISO 639-1 codes: en, zh, de, es, ru, ko, fr, ja, pt, tr, pl, ca, nl, ar, sv, it, id, hi, fi, vi, he, uk, el, ms, cs, ro, da, hu, ta, no, th, ur, hr, bg, lt, la, mi, ml, cy, sk, te, fa, lv, bn, sr, az, sl, kn, et, mk, br, eu, is, hy, ne, mn, bs, kk, sq, sw, gl, mr, pa, si, km, sn, yo, so, af, oc, ka, be, tg, sd, gu, am, yi, lo, uz, fo, ht, ps, tk, nn, mt, sa, lb, my, bo, tl, mg, as, tt, ln, ha, ba, su. Any other value fails validation with invalid_value. Captions that redact_render burns in are in the spoken language; transcripts are not translated.

Segment steps

A step with granularity { "mode": "segment", "window_ms": 60000, "overlap_ms": 2000 } processes the file in windows instead of all at once. window_ms is 1000–3,600,000. overlap_ms is 0 to half of window_ms, default 0. Only transcribe, sample_frames, detect_scenes, endpoint and model steps can use segment mode.

Windows start on fragment boundaries, so a window can be longer than window_ms and an overlap can be longer than overlap_ms. The last window ends at the end of the file. Each window has its own output, and its annotations must be inside the window.

Segment steps can start before an upload finishes. With a streamed upload, a segment step processes each window as soon as the media for it has arrived. This is true only when every step it needs is also a segment step: a whole-file step it needs must finish first, and whole-file steps wait for the complete file. A URL source is complete when it is created, so all of its windows are ready at once.

Browser recordings can opt into early analysis on verified fragments. Try sampling frames before you stop recording and compare with a run that starts once the File is ready. Process while recording

Branching with filters

A filter step evaluates its when predicate against the outputs of earlier steps. When the predicate is true, the filter succeeds. When it is false, the filter is skipped, and so is every step that needs it, directly or indirectly.

json
{
  "type": "filter",
  "needs": ["detector"],
  "when": {
    "any": [
      { "path": "detector.annotations", "op": "non_empty" },
      { "path": "detector.metadata.flagged", "op": "eq", "value": true }
    ]
  }
}

A predicate is a leaf or a combination of predicates:

  • { "all": [...] } is true when every child is true. { "any": [...] } is true when one child is true. Each takes 1–16 children.
  • { "not": predicate } inverts its child.
  • A leaf is { "path", "op", "value" }. Predicates nest at most 4 levels deep.

A path is <namespace>.metadata.<field>... or <namespace>.annotations..., with at most 16 segments. A numeric segment selects an array item, for example detector.annotations.0.kind. A filter can read only the namespaces of steps it needs, directly or indirectly.

Every leaf is false when nothing is at path, including ne. Strings in value have at most 1024 characters.

A filter reads a merged view of each segment step: the annotations of every window, and each metadata field from the last window that sets it.

To branch, give two filters complementary predicates. The branch that is not taken is skipped, and the run ends succeeded when the taken branch reaches its final step. An ordinary step that needs steps from both branches is always skipped, because one of them is skipped. To merge the branches again, have a join step need the last step of each branch, and later steps need the join:

json
{
  "clear": { "type": "filter", "needs": ["pii"], "when": { "not": { "path": "pii.annotations", "op": "non_empty" } } },
  "flagged": { "type": "filter", "needs": ["pii"], "when": { "path": "pii.annotations", "op": "non_empty" } },
  "review": { "type": "review", "needs": ["flagged"] },
  "admitted": { "type": "join", "needs": ["clear", "review"] },
  "publish": { "type": "publish", "needs": ["admitted"] }
}

The join waits for both branches and succeeds when either succeeded, so publish runs for clear videos and for approved ones. It is skipped when every step it needs was skipped, for example when the reviewer rejects a flagged video. A join writes no output, so a filter after it reads the namespaces of the steps before it. See Run statuses.

Review steps

A review step pauses its branch until a person approves or rejects the results of the steps before it.

json
{
  "type": "review",
  "needs": ["has_faces"],
  "with": {
    "instructions": "Check every face box. Remove false detections.",
    "expires_after_ms": 86400000,
    "on_expiry": "reject"
  }
}

When the review step starts, Editframe opens a review task, and the step waits in waiting_review. The decision changes the run:

  • Approve: the step succeeds. The approval can include corrected annotations, which replace the original annotations of their kinds for every later step.
  • Reject: the step is skipped, so the steps after it are skipped. The run ends filtered unless another branch reaches a final step.
  • Expiry: when nobody decides within expires_after_ms, on_expiry applies. approve succeeds the step with the decision expired. reject skips the step. fail fails the step and the run, and a run retry opens a new review task.

Decide reviews through the API, the SDK, the CLI or the dashboard. See Reviews.

Endpoint steps

An endpoint step sends a signed HTTP request to your service and uses the response as the step's output. First register the endpoint:

js
import { createPipelineEndpoint } from "@editframe/api/pipelines";

const endpoint = await createPipelineEndpoint(client, {
  url: "https://models.example.com/editframe/faces",
  headers: { Authorization: `Bearer ${process.env.MODEL_TOKEN}` },
  timeout_ms: 30000,
  callback_timeout_ms: 3600000,
  max_concurrency: 16,
});

// Store this secret now. Editframe returns it only once.
console.log(endpoint.signing_secret); // "whsec_..."

You cannot set headers that Editframe sets itself: host, connection, keep-alive, upgrade, te, trailer, transfer-encoding, expect, content-length, content-type, content-encoding, user-agent, or any header that starts with proxy- or webhook-.

You can change the timeout_ms, callback_timeout_ms and max_concurrency of an endpoint. Send only the limits to change. Requests sent after the change use the new limits; requests already sent keep their timeouts:

js
import { updatePipelineEndpoint } from "@editframe/api/pipelines";

await updatePipelineEndpoint(client, endpoint.id, { max_concurrency: 4, timeout_ms: 45000 });

The ranges are the same as for a new endpoint. A body with no limit, an unknown field or a value out of range fails with 422 invalid_request. An archived endpoint keeps its limits: the change fails with 409 endpoint_archived. Editframe records each change, with the API key or user that made it, in the endpoint's change history in the dashboard. A change to values that the endpoint already has records nothing.

You cannot change the URL, the headers or the signing secret. To change them, create an endpoint, create a pipeline version that uses it, and then archive the old endpoint. A new version cannot name an archived endpoint, and a run whose version names an archived endpoint fails with endpoint_not_found.

Then reference the endpoint from a step:

json
{
  "type": "endpoint",
  "needs": ["frames", "transcript"],
  "granularity": { "mode": "segment", "window_ms": 60000 },
  "with": { "endpoint_id": "6f1c2a9e-3b4d-4e5f-8a7b-1c2d3e4f5a6b", "max_concurrency": 16 }
}

Request

Editframe sends POST with a JSON body and the User-Agent Editframe-Pipelines/1:

json
{
  "pipeline_id": "9a8b7c6d-5e4f-4a3b-8c2d-1e0f9a8b7c6d",
  "pipeline_version": 12,
  "pipeline_run_id": "3d0f6c1a-5b2e-4c7d-9f8a-1b2c3d4e5f60",
  "step_run_id": "c1d2e3f4-a5b6-4c7d-8e9f-0a1b2c3d4e5f",
  "step_key": "detector",
  "namespace": "detector",
  "attempt": 1,
  "idempotency_key": "c1d2e3f4-a5b6-4c7d-8e9f-0a1b2c3d4e5f:1:14",
  "external_id": "truck-1182/2026-10-01",
  "deadline_at": "2026-10-02T04:15:30.000Z",
  "file": {
    "id": "7b8c9d0e-1f2a-4b3c-8d4e-5f6a7b8c9d0e",
    "filename": "truck-1182.mp4",
    "status": "receiving",
    "duration_ms": null,
    "tracks": [
      { "track_id": 1, "type": "video", "codec": "h264", "duration_ms": null },
      { "track_id": 2, "type": "audio", "codec": "aac", "duration_ms": null }
    ]
  },
  "window": { "index": 14, "start_ms": 840000, "end_ms": 900000, "overlap_ms": 0 },
  "media": {
    "expires_at": "2026-10-02T04:15:30.000Z",
    "source_url": "https://editframe.com/api/v1/files/7b8c9d0e-…/tracks/1?media_token=…",
    "index_url": "https://editframe.com/api/v1/files/7b8c9d0e-…/index?media_token=…",
    "audio_url": "https://editframe.com/api/v1/files/7b8c9d0e-…/tracks/2?media_token=…",
    "frames": [
      { "t_ms": 840000, "url": "https://editframe.com/api/v1/files/7b8c9d0e-…/pipeline-frames/…/840000?media_token=…" }
    ]
  },
  "metadata": {
    "transcript": { "metadata": { "word_count": 112 }, "annotations": [] },
    "frames": { "metadata": { "every_ms": 1000, "frame_count": 60 }, "annotations": [] }
  },
  "callback": {
    "url": "https://editframe.com/api/v1/pipeline-callbacks/…",
    "expires_at": "2026-10-02T04:15:30.000Z"
  }
}
  • window is null for a file step. file.status is receiving while a streamed upload is still arriving, and ready after that. Durations are null until the upload is sealed. A file that was uploaded whole also has the probed width and height of video tracks, and sample_rate and channels of audio tracks.
  • deadline_at and callback.expires_at are callback_timeout_ms after the request.
  • metadata holds the outputs of every step this step needs, directly or indirectly, by namespace, with review corrections applied. For a segment step, annotations are limited to the window.
  • media URLs need no API key. They work until media.expires_at, at most four hours after the request. frames lists the frames of every sample_frames step the step needs, at most 1000 per request.
  • idempotency_key is the same for every delivery of one attempt. Use it to deduplicate.

Requests for URL sources

When the run's file was created from a URL, Editframe serves none of its media, and media has your URL instead of Editframe's media URLs. The rest of the request, including file and window, is the same:

json
{
  "media": {
    "url": "https://media.example.com/fleet/truck-1182.mp4",
    "tracks": [
      { "track_id": 1, "type": "video", "label": "camera", "codec": "avc1.640028" },
      { "track_id": 2, "type": "audio", "label": null, "codec": "mp4a.40.2" }
    ],
    "expires_at": "2026-10-02T04:15:30.000Z",
    "frames": [
      { "t_ms": 840000, "url": "https://editframe.com/api/v1/files/7b8c9d0e-…/pipeline-frames/…/840000?media_token=…" }
    ]
  }
}
  • url is the URL that Editframe recorded when it created the file, after redirects. Read it yourself, by byte range for the window of a segment step. Editframe adds no token to it.
  • tracks lists every track with its label and codec, without URLs.
  • source_url, audio_url and index_url are absent. expires_at is present only with frames, whose URLs work until then.

In the SDK, request.media.url is set only for a URL source.

Signatures

Requests are signed with Standard Webhooks headers: webhook-id, webhook-timestamp and webhook-signature (v1, followed by a base64 HMAC-SHA256). Verify them with the endpoint's whsec_ secret and the raw request body:

js
import express from "express";
import { postPipelineCallback, verifyPipelineEndpointRequest } from "@editframe/api/pipelines";

const app = express();

app.post("/editframe/faces", express.raw({ type: "application/json" }), async (req, res) => {
  let request;
  try {
    request = await verifyPipelineEndpointRequest({
      secret: process.env.EDITFRAME_ENDPOINT_SECRET,
      headers: req.headers,
      body: req.body,
    });
  } catch {
    return res.status(401).end();
  }

  // Accept the work now and post the output to the callback URL when it is done.
  res.status(202).end();
  const annotations = await detectFaces(request.media); // your model
  await postPipelineCallback(request.callback.url, {
    status: "succeeded",
    output: { metadata: { face_count: annotations.length }, annotations },
  });
});

For short work, answer with the output instead: res.json({ metadata: { … }, annotations: [ … ] }).

verifyPipelineEndpointRequest accepts a clock difference of 300 seconds by default (toleranceSeconds) and throws PipelineSignatureError when the signature is missing, stale or wrong.

Responses

An output larger than the output limit, or one that is not valid, fails the step.

Callbacks

After a 202, post one of these bodies to callback.url. The URL authenticates the attempt, so send no API key.

json
{ "status": "heartbeat" }
{ "status": "succeeded", "output": { "metadata": {}, "annotations": [] } }
{ "status": "failed", "error": { "message": "Model unavailable", "code": "model_unavailable", "retryable": true } }
  • A heartbeat extends the deadline to callback_timeout_ms from now. Send one before the deadline when work takes longer.
  • error.message has 1–1000 characters. error.code is optional: lowercase letters, digits and underscores, starting with a letter, at most 64 characters. A retryable failure starts another attempt when attempts remain.
  • A callback can arrive before the 202 response. Editframe records it.

Concurrency

Each endpoint step sends at most with.max_concurrency requests at a time, and each endpoint receives at most its own max_concurrency across all steps. An attempt that answered 202 does not hold a slot while it waits for the callback.

Versions

A pipeline has versions numbered from 1. createPipeline creates version 1, and versions cannot be changed. To change a pipeline, create a version:

js
import { createPipelineVersion } from "@editframe/api/pipelines";

const { version, created } = await createPipelineVersion(client, pipeline.id, definition);
// created is false when an existing version has the same digest; that version is returned.
bash
editframe pipelines versions create PIPELINE_ID --definition definition.json

A run uses the latest version unless you pass version. Pipeline names are unique among the pipelines of your organization that are not archived. An archived pipeline accepts no new versions or runs (409 pipeline_archived).

Pause a pipeline

Pause a pipeline to stop new work without cancelling runs, for example while your endpoint is down. A pause applies to every version of the pipeline.

js
import { pausePipeline, resumePipeline } from "@editframe/api/pipelines";

const paused = await pausePipeline(client, pipeline.id);
console.log(paused.paused_at); // when the pipeline was paused

await resumePipeline(client, pipeline.id);
bash
editframe pipelines pause PIPELINE_ID
editframe pipelines resume PIPELINE_ID

While a pipeline is paused:

  • It accepts new versions, runs and groups. New runs stay pending.
  • No pending run starts, and no step, retry attempt or segment window starts.
  • Attempts that started before the pause continue. Editframe records their endpoint callbacks and review decisions, and their runs then wait for the next step.
  • A step that has not started gets no deadline, so the pause cannot make it time out. Attempts that started keep their deadlines, and open reviews keep their expires_at.
  • You can cancel and retry runs. A retried run stays pending until you resume the pipeline.
  • A run that has not started records no usage.

When you resume the pipeline, the waiting runs and steps start immediately, within the limits of their groups and endpoints. Both requests return the pipeline. Pausing a paused pipeline, or resuming a pipeline that is not paused, changes nothing. An archived pipeline cannot be paused (409 pipeline_archived). Pause and resume send no webhooks.

Editframe records each pause and resume, with the API key or user that made it, in the change history of the pipeline in the dashboard. Editframe does not change or delete these records. A request that changes nothing records nothing.

listPipelines takes paused: true to list only paused pipelines (GET /api/v1/pipelines?paused=true). paused=false lists only the pipelines that are not paused.

Runs

Create a run with a pipeline and a video file. The Idempotency-Key header is optional, at most 255 characters, and unique in your organization: a repeated request with the same key and body returns the original run with status 200, and one with a different body returns 409 idempotency_conflict.

bash
curl -X POST https://editframe.com/api/v1/pipeline-runs \
  -H "Authorization: Bearer $EDITFRAME_API_KEY" \
  -H "Content-Type: application/json" \
  -H "Idempotency-Key: speech-check:7b8c9d0e" \
  -d '{"pipeline_id": "9a8b7c6d-…", "file_id": "7b8c9d0e-…", "external_id": "truck-1182"}'

The response is the run with all of its steps. Steps start once the file's media is available. See Pipeline runs to follow the run.

A run's metadata cannot change after the run is created. It is not the file metadata that steps write. listPipelineRuns takes metadata and returns only the runs that have every entry you give:

js
const { runs } = await listPipelineRuns(client, { metadata: { customer: "acme" } });
// GET /api/v1/pipeline-runs?metadata[customer]=acme
bash
editframe pipelines runs create PIPELINE_ID FILE_ID --metadata customer=acme --metadata truck=1182
editframe pipelines runs list --metadata customer=acme

Groups

A group holds runs of one pipeline version, for example the uploads of one night. Use a group to follow its runs together, to limit how many of them run at the same time, and to get one notification when they are all finished.

js
import {
  closePipelineGroup,
  createPipelineGroup,
  createPipelineRun,
  getPipelineGroupReport,
} from "@editframe/api/pipelines";

const { group } = await createPipelineGroup(
  client,
  {
    pipeline_id: pipeline.id,
    runs: fileIds.map((file_id) => ({ file_id })),
    max_in_flight: 50,
    metadata: { night: "2026-10-01" },
  },
  { idempotencyKey: "nightly-2026-10-01" },
);

// A run joins a group only when you create it.
await createPipelineRun(client, { group_id: group.id, file_id: lateFileId });

// Close the group after its last run, so it can complete.
await closePipelineGroup(client, group.id);

const report = await getPipelineGroupReport(client, group.id);
bash
editframe pipelines groups create PIPELINE_ID --files file-ids.txt --max-in-flight 50 --metadata night=2026-10-01
editframe pipelines runs create PIPELINE_ID FILE_ID --group GROUP_ID
editframe pipelines groups close GROUP_ID
editframe pipelines groups report GROUP_ID
  • runs has 0–1000 entries, each with a file_id or a source_url, and an optional external_id and metadata. The file_id values are distinct. Runs do not get the group's metadata. Unknown files return 404 { "error": "file_not_found", "file_ids": [...] }.
  • version is the pipeline version of every run in the group. Default: the latest version.
  • max_in_flight is 1–100,000, default 100. Other runs of the group stay pending and start oldest first as runs finish.
  • An open group does not complete, also when all of its runs finished. Close it with closePipelineGroup, or create it with close: true (--close) when the request has all of its runs. When you close a group whose runs all finished, it completes immediately. Closing a closed group changes nothing.
  • When you retry a run of a completed group, the group becomes closed again until that run finishes. completion_count is the number of times that the group completed.
  • listPipelineGroups takes status, pipeline_id and metadata filters. listPipelineRuns takes group_id.
  • In a --files file, the CLI reads one file ID per line and ignores text after #.

You can change the max_in_flight of a group in any status. When you raise it, waiting runs start immediately. When you lower it, running runs continue; waiting runs start only when fewer runs than the new limit are running. A run that you retry later uses the limit of its group at that time.

js
import { updatePipelineGroup } from "@editframe/api/pipelines";

await updatePipelineGroup(client, group.id, { max_in_flight: 200 });
bash
editframe pipelines groups update GROUP_ID --max-in-flight 200

The body must contain only max_in_flight. A missing value, an unknown field or a value out of range fails with 422 invalid_request. A group that is not in your organization returns 404. A change of max_in_flight sends no webhook.

Editframe records each close and each change of max_in_flight, with the API key or user that made it, in the change history of the group in the dashboard. Editframe does not change or delete these records. Closing a closed group, or a change to the current value, records nothing.

getPipelineGroupReport summarizes the runs of a group:

Creators

Pipelines, versions, endpoints, runs and groups tell who created them:

Both fields are null when Editframe did not record the creator. Runs and groups that an API key created before Editframe recorded creators have that API key in created_by. Other records created before then have null.

The dashboard shows the creator on the page of each record. A record that an Editframe administrator created while viewing your organization shows that an administrator created it.

created_by does not select webhooks. A run sends its webhooks to its API key: the key that created the run through the API, or the key chosen when the run was started in the dashboard.

Streamed uploads

A streamed upload sends a video as verified fragments, so a run can start before the upload finishes. Segment steps process each window as its media arrives. The file has the status receiving until the upload is sealed.

js
import { Client, createPipelineRun } from "@editframe/api/pipelines";
import { uploadFragmented } from "@editframe/api/pipelines/upload";

const result = await uploadFragmented(client, "dashcam.mp4", {
  onCreated: async (file) => {
    await createPipelineRun(
      client,
      { pipeline_id: pipeline.id, file_id: file.id },
      { idempotencyKey: `upload:${file.id}` },
    );
  },
  onProgress: (progress) => console.log(progress.watermarkMs), // verified media time
});
console.log(result.file.status); // "processing" after the seal
bash
editframe pipelines upload dashcam.mp4 --run PIPELINE_ID --watch

uploadFragmented accepts a file path, a Blob or File, or a stream. When an upload stops, resume it with fileId (SDK) or --resume FILE_ID (CLI) and the same media. A file has 1–8 tracks and at most one video track. In a browser, direct uploads need CORS on the storage bucket.

URL sources

A run can process a video that you already host at an HTTPS URL, without an upload. Editframe does not copy the media: built-in steps read the byte ranges they need from your URL, and endpoint steps receive your URL. Give source_url in place of file_id:

js
import { createPipelineRun } from "@editframe/api/pipelines";

const { run } = await createPipelineRun(
  client,
  { pipeline_id: pipeline.id, source_url: "https://media.example.com/fleet/truck-1182.mp4" },
  { idempotencyKey: "speech-check:truck-1182" },
);
console.log(run.file_id); // the file Editframe created for the URL
bash
editframe pipelines runs create PIPELINE_ID --source-url https://media.example.com/fleet/truck-1182.mp4 --watch

When you create the run, Editframe checks that it can read the URL, reads its tracks and duration, and creates a file of type video for it. The response is the usual run, and its file_id is the new file. The file is ready at once, so every window of a segment step is ready when the run starts. Windows run in parallel up to the step's and endpoint's concurrency limits; nothing waits for media to arrive, as it does with a streamed upload.

Group entries take source_url in place of file_id too:

js
import { createPipelineGroup } from "@editframe/api/pipelines";

const { group } = await createPipelineGroup(client, {
  pipeline_id: pipeline.id,
  runs: [
    { source_url: "https://media.example.com/fleet/truck-1182.mp4", external_id: "truck-1182" },
    { source_url: "https://media.example.com/fleet/truck-1183.mp4", external_id: "truck-1183" },
  ],
  close: true,
});
bash
editframe pipelines groups create PIPELINE_ID --source-url URL --source-url URL --close

When a URL cannot be read, Editframe creates nothing: not the run, and for a group request, not the group or any of its runs.

Each source_url in a run or group request creates a new file, and the URLs of one group request must differ. To process one video with several pipelines, create its file once with createFile and give its ID to each run:

js
import { createFile } from "@editframe/api";
import { createPipelineRun } from "@editframe/api/pipelines";

const file = await createFile(client, {
  type: "video",
  source_url: "https://media.example.com/fleet/truck-1182.mp4",
});
console.log(file.status, file.source_url); // "ready", and the URL after redirects

await createPipelineRun(client, { pipeline_id: speechCheck.id, file_id: file.id });
await createPipelineRun(client, { pipeline_id: redaction.id, file_id: file.id });

See Files for the fields of createFile.

Requirements

The URL must meet these requirements when you create the file, and for as long as runs use it, including retries:

  • HTTPS on a public address. Editframe follows up to 3 redirects when it creates the file and records the final URL. Steps read the recorded URL and do not follow redirects.
  • Range requests. A request with a Range header is answered with 206 Partial Content and a Content-Range header that gives the total size.
  • MP4 or MOV. The file is ISO BMFF: progressive, with the moov box anywhere in the file, or fragmented, with a sidx or mfra index.
  • A known duration.
  • Content that does not change. When it creates the file, Editframe records the size and the ETag, or the Last-Modified header when there is no ETag. A step that finds another size, ETag or Last-Modified fails with source_changed.
  • A URL that stays readable. A step that cannot read the URL fails with source_unavailable. A signed URL must not expire while runs use it.

Each track's label is its name in the file: the MP4 udta name, or else the handler name. The with.track option of transcribe, sample_frames and detect_scenes steps selects a track by its label, as for streamed uploads, so give the tracks you select names of lowercase letters, digits and underscores that start with a letter, at most 32 characters. A track whose name does not fit, or that shares its name with another track, has no label. With ffmpeg, set handler names while copying the streams:

bash
ffmpeg -i interview.mp4 -c copy -metadata:s:v:0 handler_name=camera -metadata:s:a:0 handler_name=voice interview-labelled.mp4

URL errors

A URL that cannot be read fails the request with 422 and the code as error. createFile gives the reason as message:

json
{ "error": "source_range_unsupported", "message": "The server answered a Range request with 200 instead of 206." }

createPipelineRun gives the code and the reason as an issue at source_url, and a group request gives an issue for each entry whose URL cannot be read, in entry order, with the first entry's code as error:

json
{
  "error": "source_unreachable",
  "issues": [
    { "path": "runs[3].source_url", "code": "source_unreachable", "message": "…" },
    { "path": "runs[7].source_url", "code": "source_http_error", "message": "…" }
  ]
}

Giving both file_id and source_url fails with 422 invalid_request and the issue not_allowed at source_url; the same URL twice in one group request fails with duplicate.

In the SDK, PipelineApiError has the code in code and the issues in issues, and the error that createFile throws names the code and the reason. Steps of a run whose source later changes or becomes unreadable fail with the step error codes source_changed and source_unavailable.

Outputs

A step output is a JSON object with metadata (an object, nested at most 32 levels) and annotations (an array). Both are optional. An output has at most 1 MiB and 10,000 annotations.

Keyframe boxes use normalized frame coordinates from 0 to 1, with x + w and y + h at most 1. Their t_ms values increase and are between start_ms and end_ms.

Read the outputs of a run, one page per call, with each window's output for segment steps:

js
import { getPipelineRunOutputs, getFilePipelineMetadata } from "@editframe/api/pipelines";

const page = await getPipelineRunOutputs(client, run.id, "detector");
for (const { window, output } of page.outputs) {
  console.log(window?.start_ms, output.annotations.length);
}

// The latest outputs a step wrote to a namespace on a file, from any run.
const latest = await getFilePipelineMetadata(client, fileId, "detector");

A segment output's window has its index, start_ms and end_ms, and the times its latest attempt was planned (created_at), became ready (ready_at), was dispatched (started_at), began on a worker (picked_up_at) and finished (completed_at). A time is null until it happens.

listFilePipelineMetadata(client, fileId) lists the namespaces that steps have written on a file. Use iteratePipelineRunOutputs and iterateFilePipelineMetadata to read every page.

Limits

Errors

Validation errors return 422 with the field paths and issue codes:

json
{
  "error": "invalid_definition",
  "issues": [{ "path": "steps.gate.when.path", "code": "not_upstream" }]
}

The error field is invalid_definition for definitions and invalid_request for other request bodies. Other errors return { "error": code }, for example 409 pipeline_name_taken, 404 pipeline_not_found, 404 pipeline_version_not_found or 404 file_not_found. In the SDK, failed requests throw PipelineApiError with status, code, issues and fileIds.

Routes

All routes are under https://editframe.com and use an API key as a Bearer token, except the callback route. Lists take limit and cursor and return next_cursor, which is null on the last page.

GET /api/v1/pipelines and GET /api/v1/pipeline-endpoints take include_archived=true. GET /api/v1/pipelines also takes paused=true or paused=false. To be notified of run, step, review and group changes, see Webhooks.