API Directory › Integrate with Node.js

Integrate BetterVideo with Node.js

A working Node.js example that submits a video for enhancement, polls the job to completion, and returns the time-limited download link — against the live BetterVideo API.

🔒 Footage deleted on your schedule — with a certificate to prove it

const API = "https://api.bettervideo.io/v1";
const KEY = "bv_live_your_key_here";
const headers = { Authorization: `Bearer ${KEY}`, "Content-Type": "application/json" };
const sleep = (ms) => new Promise((r) => setTimeout(r, ms));

async function enhance() {
  // 1. Submit a video for enhancement
  let res = await fetch(`${API}/jobs`, {
    method: "POST", headers,
    body: JSON.stringify({ video_url: "https://example.com/clip.mp4", resolution: "1080p" }),
  });
  let job = await res.json();

  // 2. Poll until the job is done
  while (job.status === "queued" || job.status === "running") {
    await sleep(3000);
    job = await (await fetch(`${API}/jobs/${job.id}`, { headers })).json();
  }

  // 3. Fetch the time-limited download link
  if (job.status === "done") {
    const result = await (await fetch(`${API}/jobs/${job.id}/result`, { headers })).json();
    console.log("Enhanced video:", result.download_url);
  } else {
    console.error("Job failed:", job.error);
  }
}

enhance();

Node 18+ (built-in fetch). No dependencies. Base URL https://api.bettervideo.io/v1 · auth Authorization: Bearer bv_live_…. Grab a free sandbox key from the developer console.

What the code does

  1. SubmitPOST /v1/jobs with a public video_url and a resolution (1080p or 4k).
  2. PollGET /v1/jobs/{id} until status is done (or error). Prefer a signed webhook_url in production instead of polling.
  3. DownloadGET /v1/jobs/{id}/result returns a time-limited download_url. DELETE /v1/jobs/{id} removes it on demand.
See how BetterVideo compares to other video APIs →

Start building in Node.js

Free sandbox key, no card — build the whole integration before you spend anything.

Get your API key →