BobaBanana API
Docs / API / Webhooks

Webhooks: get notified when a job finishes

Add "webhook_url": "https://your-server/hooks/bobabanana" to any create request and BobaBanana sends one signed POST to that URL when the job succeeds, fails or is canceled. No polling needed.

The webhook event#

POST /hooks/bobabanana
Content-Type: application/json
BobaBanana-Signature: t=1795660420,v1=5f2b7c...
{
  "id": "evt_a81c2e0d9f11",
  "object": "event",
  "type": "job.succeeded",
  "created": 1795660420,
  "data": { "id": "x_8d21c0f4a9b3", "object": "job", "type": "video", "status": "succeeded", "output": {"video": {"url": "...", "content_type": "video/mp4"}} }
}

Event types: job.succeeded, job.failed, job.canceled. data is the same job object that GET /v1/jobs/{id} returns.

Verify the signature#

Each key has a webhook signing secret (whsec_..., in Settings → API keys). The signature is HMAC-SHA256(secret, "{t}.{raw request body}") in hex.

import hmac, hashlib, time

def verify(raw_body: bytes, header: str, secret: str, tolerance=300) -> bool:
    parts = dict(p.split("=", 1) for p in header.split(","))
    expected = hmac.new(secret.encode(), parts["t"].encode() + b"." + raw_body, hashlib.sha256).hexdigest()
    return hmac.compare_digest(expected, parts["v1"]) and abs(time.time() - int(parts["t"])) < tolerance
import crypto from "node:crypto";

export function verify(rawBody, header, secret, tolerance = 300) {
  const parts = Object.fromEntries(header.split(",").map((p) => p.split("=")));
  const expected = crypto.createHmac("sha256", secret).update(`${parts.t}.${rawBody}`).digest("hex");
  const fresh = Math.abs(Date.now() / 1000 - Number(parts.t)) < tolerance;
  return fresh && expected.length === parts.v1?.length && crypto.timingSafeEqual(Buffer.from(expected), Buffer.from(parts.v1));
}

Always verify against the raw body bytes, before parsing JSON.

Delivery and retries#

  1. Your endpoint must answer with a 2xx status within 10 seconds.
  2. On failure BobaBanana retries after 10 seconds, 1 minute, 5 minutes, 30 minutes and 2 hours (6 attempts in total), then gives up. Deliveries are stored, so a retry is never lost when BobaBanana restarts.
  3. Webhook URLs must be https and resolve to a public address.
  4. Treat delivery as at least once: use the event's id to ignore duplicates.
  5. If the API key is revoked or the workspace is suspended, pending deliveries are not sent.

The job object shows the delivery: "webhook": {"status": "pending" | "delivered" | "failed" | "suppressed", "attempts": 2, "last_status": 502}.

Replaying a webhook#

POST /v1/jobs/{id}/webhook/replay sends a finished job's event again from the first attempt, with fresh download links and the same event id. Use it after fixing your endpoint. It returns the webhook object; a job created without webhook_url gets 409 no_webhook, and an unfinished job 409 job_active.

Webhook best practices#

Frequently asked questions#

Is there one webhook URL per account?#

No. You choose the URL per request, so different jobs can notify different endpoints.

Can I test webhooks locally?#

Use a public https tunnel to your machine. Local and private addresses are refused.

Last updated 2026-11-27 · View as Markdown