Skip to content

Webhooks

Register an https endpoint in Settings > API access, pick the events you want, and a signed JSON event is posted to it the moment something changes.

  • project.ready

    A project finished processing. data.project carries it; clipsReady is false when only the transcript finished.

  • project.failed

    A project stopped with an error. data.project.error says why.

  • clip.rendered

    An export finished. data.export.download holds a signed MP4 link.

  • export.failed

    An export failed after its retries. data.export.error says why.

Verify the signature

Every delivery carries a CastKit-Signature header. v1 is the hex HMAC-SHA256 of the timestamp, a dot and the raw request body, keyed with the endpoint's signing secret (whsec_...).

CastKit-Signature: t=<unix seconds>,v1=<hex>

Compare in constant time and reject a timestamp more than five minutes away from your clock, which stops replayed deliveries.

verify.js
import { createHmac, timingSafeEqual } from "node:crypto";

const TOLERANCE_SECONDS = 5 * 60;

export function verifyCastKit(rawBody, header, secret) {
  const parts = Object.fromEntries(
    (header ?? "").split(",").map((part) => part.trim().split("=", 2)),
  );
  const t = Number(parts.t);
  if (!Number.isInteger(t) || !parts.v1) return false;
  if (Math.abs(Date.now() / 1000 - t) > TOLERANCE_SECONDS) return false;

  const expected = createHmac("sha256", secret)
    .update(`${parts.t}.${rawBody}`)
    .digest();
  const given = Buffer.from(parts.v1, "hex");
  return given.length === expected.length && timingSafeEqual(given, expected);
}

Verify the raw body, then parse

Re-serialising parsed JSON can change the bytes and break the signature. Read the body raw, verify it, then parse it.

server.js
app.post(
  "/webhooks/castkit",
  express.raw({ type: "application/json" }),
  (req, res) => {
    const rawBody = req.body.toString("utf8");
    const header = req.get("CastKit-Signature");
    if (!verifyCastKit(rawBody, header, process.env.CASTKIT_WEBHOOK_SECRET)) {
      return res.status(400).end();
    }
    const event = JSON.parse(rawBody);
    res.status(200).end();
    handle(event);
  },
);

Delivery

  • Answer with any 2xx within 10 seconds. Do slow work after you reply.
  • Anything else is retried with exponential backoff: 8 attempts over about an hour.
  • CastKit-Event-Id stays the same across retries, so use it to ignore duplicates.
  • Endpoints must use https on port 443 and resolve to a public address. A workspace can hold 5 endpoints.
  • Send test delivers a webhook.test event, and each endpoint lists its recent deliveries with a Retry button.
A delivery
POST /webhooks/castkit
CastKit-Signature: t=1791187200,v1=5f2b9c...
CastKit-Event-Id: evt_3f1c...
CastKit-Event-Type: clip.rendered

{
  "id": "evt_3f1c...",
  "type": "clip.rendered",
  "createdAt": "2026-10-05T08:00:00.000Z",
  "data": {
    "export": { "id": "...", "status": "done", "download": { "url": "...", "expiresAt": "..." } },
    "clip": { "id": "...", "title": "...", "projectId": "..." }
  }
}

Your first clip from code is one key away.

Create a key, paste the quick start into a terminal and watch the first export land. The first episode is free.