● nureta
Docs

Webhooks

Get the finished task at your own URL instead of polling, and check its signature with Python or Node.js.

Add callback_url (HTTPS) and callback_secret (8–256 characters) to any create request. When the task ends, the API POSTs the task view to your URL, signed with your secret.

{"model": "seedance2.0-fast", "resolution": "480p", "duration": 5,
 "content": [{"type": "text", "text": "..."}],
 "callback_url": "https://your-server.example/webhooks/nureta",
 "callback_secret": "a-long-random-secret"}

Check the signature on every call: compute an HMAC-SHA256 of X-Nureta-Timestamp + "." + raw body with your secret, and compare it with X-Nureta-Signature without its sha256= prefix. Use the raw body bytes: parsing and re-encoding the JSON changes them.

Receiver in Python (Flask)

import hashlib, hmac, os, time
from flask import Flask, abort, request

app = Flask(__name__)
SECRET = os.environ["NURETA_CALLBACK_SECRET"].encode()
seen = set()  # use your database in production

@app.post("/webhooks/nureta")
def nureta_webhook():
    ts = request.headers.get("X-Nureta-Timestamp", "")
    sig = request.headers.get("X-Nureta-Signature", "").removeprefix("sha256=")
    want = hmac.new(SECRET, ts.encode() + b"." + request.get_data(), hashlib.sha256).hexdigest()
    if not hmac.compare_digest(sig, want) or abs(time.time() - int(ts or 0)) > 300:
        abort(401)
    delivery = request.headers["X-Nureta-Delivery"]
    if delivery in seen:          # deliveries can repeat: at least once
        return "", 200
    seen.add(delivery)
    event = request.headers["X-Nureta-Event"]
    task = request.get_json()
    if event == "generation.task.completed":
        print(task["id"], task["status"], (task.get("content") or {}).get("video_url"))
    return "", 200                # answer 2xx within 5 seconds

Receiver in JavaScript (Node.js, Express)

import crypto from "node:crypto";
import express from "express";

const SECRET = process.env.NURETA_CALLBACK_SECRET;
const app = express();

app.post("/webhooks/nureta", express.raw({ type: "application/json" }), (req, res) => {
  const ts = req.get("X-Nureta-Timestamp") ?? "";
  const sig = (req.get("X-Nureta-Signature") ?? "").replace(/^sha256=/, "");
  const want = crypto.createHmac("sha256", SECRET).update(`${ts}.`).update(req.body).digest("hex");
  const ok = sig.length === want.length && crypto.timingSafeEqual(Buffer.from(sig), Buffer.from(want));
  if (!ok || Math.abs(Date.now() / 1000 - Number(ts)) > 300) return res.sendStatus(401);
  const task = JSON.parse(req.body.toString("utf8"));
  console.log(req.get("X-Nureta-Event"), task.id, task.status);
  res.sendStatus(200);
});

app.listen(3000);
  • Events: generation.task.completed (the task ended), generation.task.planned (an edit-mode draft is ready, sent once, not retried) and generation.task.rerender.completed (a fix run ended; the body is {event, task_id, rerender, task}).
  • A delivery that does not get a 2xx answer within 5 seconds is retried, up to 5 attempts, at least 30 seconds apart.
  • Your URL must be HTTPS on a public host: no localhost and no private IP address. To test on your own machine, use a tunnel with a public HTTPS URL.