Niravi Docs
npm ↗ Get a key ↗

Webhooks

Niravi calls your HTTPS URL when a file is ready to search, or when it fails. You do not need to poll GET /api/v1/videos/{id}.

Add an endpoint on platform.niravi.io › Webhooks. Only workspace owners and admins can add, change or delete endpoints. A workspace can have 10 endpoints. Niravi shows the signing secret one time, when you add the endpoint. Keep it in your server’s secret store.

Events

TypeWhen
video.processedA video, image or document is ready to search. data.reindex is true when it was indexed again.
video.failedProcessing stopped. data.error says why.

An endpoint gets both types unless you choose one. Send test on the endpoint sends a webhook.test event, or a sample of either type, with "is_test": true.

Payload

Every request is a POST with a JSON body:

{
  "id": "evt_3f2c9a0b7e4d41c6a1b2c3d4e5f60718",
  "type": "video.processed",
  "api_version": "1",
  "created_at": "2026-11-01T12:00:03Z",
  "workspace_id": "your_workspace",
  "data": {
    "video": {
      "id": "v_0123456789ab",
      "filename": "ep01.mp4",
      "name": "Episode 1",
      "status": "completed",
      "search_status": "searchable",
      "engine": "arrow",
      "kind": "video",
      "duration_seconds": 1312.4,
      "created_at": "2026-11-01T11:41:10Z",
      "processed_at": "2026-11-01T12:00:02Z",
      "source": { "platform": "upload", "id": null },
      "url": "https://api.niravi.io/api/v1/videos/v_0123456789ab"
    },
    "reindex": false
  }
}

For video.failed, data.error replaces data.reindex:

"error": {
  "code": "unreadable_file",
  "message": "The file cannot be read. Upload it again.",
  "detail": "keyframe extraction failed: moov atom not found"
}

code and message are the same as on the Jobs page. detail is the worker’s text with paths, host names, links and secrets removed. It can be missing.

codeMeaningRetry helps
unreadable_fileThe file is damaged or is not a whole file.No. Upload it again.
no_framesNo frames could be read from the video.No
unsupported_fileThis type of file cannot be processed.No
upload_incompleteThe upload did not finish.No. Upload it again.
sovereignSovereign videos are processed on your Mac, not in the cloud.No
service_unavailableA model service was not available.Yes
source_unavailableThe source file could not be fetched.Yes
worker_lostProcessing stopped 3 times.Yes
cancelledProcessing was cancelled.No
unknownAny other failure.Yes

Retry a failed file on platform.niravi.io › Jobs.

Headers

HeaderValue
webhook-idThe event id. It is the same on every retry of the event: use it to drop duplicates.
webhook-timestampUnix seconds when this attempt was signed.
webhook-signaturev1,<base64 signature>. Two values, separated by a space, while a secret rotation runs.
niravi-event-typeThe event type.
niravi-delivery-idThe delivery id, as shown in the endpoint’s delivery log.
niravi-delivery-attempt1 for the first attempt, then 2, 3 …
user-agentNiravi-Webhooks/1 (+https://docs.niravi.io/webhooks)

Check the signature

Niravi signs with the Standard Webhooks scheme (symmetric, v1). Libraries for it (standardwebhooks, svix) accept our requests. To check by hand:

  1. Take the raw request body, as bytes. Do not parse and dump the JSON again.
  2. Sign {webhook-id}.{webhook-timestamp}.{body} with HMAC-SHA256. The key is the base64-decoded part of the secret after whsec_.
  3. Compare the base64 result with each v1, value in webhook-signature, in constant time.
  4. Refuse a webhook-timestamp more than 5 minutes from your clock.
import base64, hashlib, hmac, time

def verify(secret: str, headers: dict, body: bytes) -> bool:
    msg_id, ts = headers["webhook-id"], headers["webhook-timestamp"]
    if abs(time.time() - int(ts)) > 300:
        return False
    key = base64.b64decode(secret.removeprefix("whsec_"))
    signed = msg_id.encode() + b"." + ts.encode() + b"." + body
    want = base64.b64encode(hmac.new(key, signed, hashlib.sha256).digest()).decode()
    sigs = [s.split(",", 1)[1] for s in headers["webhook-signature"].split() if s.startswith("v1,")]
    return any(hmac.compare_digest(want, s) for s in sigs)
import { createHmac, timingSafeEqual } from "node:crypto";

export function verify(secret: string, headers: Record<string, string>, body: Buffer): boolean {
  const id = headers["webhook-id"], ts = headers["webhook-timestamp"];
  if (Math.abs(Date.now() / 1000 - Number(ts)) > 300) return false;
  const key = Buffer.from(secret.replace(/^whsec_/, ""), "base64");
  const want = createHmac("sha256", key).update(`${id}.${ts}.`).update(body).digest();
  return headers["webhook-signature"].split(" ")
    .filter((s) => s.startsWith("v1,"))
    .map((s) => Buffer.from(s.slice(3), "base64"))
    .some((got) => got.length === want.length && timingSafeEqual(got, want));
}

Answer, retries and turn-off

  • Answer with any 2xx within 10 seconds. Do the work after you answer. Niravi does not follow redirects: a 3xx counts as a failure.
  • A failed attempt is sent again after 30 seconds, 2 minutes, 10 minutes, 30 minutes, 1 hour, 3 hours, 6 hours, 12 hours and 24 hours (each gap ±20 %). Attempt 10, about 2 days after the first, is the last.
  • A 429 or 503 with Retry-After sets the next gap, up to 1 hour.
  • An answer of 410 Gone turns the endpoint off at once. An endpoint that fails for 72 hours is turned off too. Turn it on again on the endpoint page.
  • Events can arrive out of order and more than once. Use webhook-id and data.video.status.
  • The delivery log keeps each request and answer for 30 days. Redeliver sends one again.

Rotate the secret

Rotate secret makes a new secret and shows it one time. For 24 hours (you can choose 0 to 168), each request carries two signatures: one with the new secret and one with the old. Change the secret on your server in that time. After it, only the new secret signs.

URL rules

  • https only. No user name or password in the URL. Any port.
  • The host must resolve to public addresses only. Private, loopback, link-local and cloud metadata addresses are refused, and so are localhost, *.local, *.internal and niravi.io hosts.
  • Niravi checks the address again before each send.

When you delete a video for good, or a privacy deletion removes it, Niravi also deletes its webhook events and delivery log.