Webhooks
Signed webhooks
Pass a webhook_url when you create a video and, when the job ends, we POST the same JSON GET /api/v1/videos/:id returns to that URL, once, signed with your account’s secret. Check the Webhook-Signature header before you trust it, and poll if a callback never arrives.
curl https://muse-video.dev/api/v1/videos \
-H "Authorization: Bearer $MUSE_VIDEO_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"prompt": "…",
"seconds": 5,
"aspect_ratio": "16:9"
}'Muse Video is a video model made by Meta. Muse-Video.dev is an independent API, not affiliated with or endorsed by Meta; the Muse Video name is a trademark of its owner.
Example output · City tram at night

Made with the Muse Video API
Unedited Muse Video outputs from this API.




At a glance
- Webhook-Signature header, HMAC-SHA256 over the raw body
- Events: video.succeeded and video.failed
- One attempt per video, 10-second timeout
- One signing secret (whsec_…) per account
When we send it
When a video job ends (success, failure or cancellation) we send one POST to its webhook_url. The URL must be https and may not point at a private network. Each video gets one attempt with a 10-second timeout and no automatic retry, so polling GET /api/v1/videos/:id is the dependable fallback.
What arrives
POST /hooks/muse-video HTTP/1.1
Content-Type: application/json
User-Agent: Muse-Video.dev-Webhooks/1
Webhook-Signature: t=1764321164,v1=5d2c8f…e41a
{
"type": "video.succeeded",
"data": {
"id": "3f9c2b7e-5a1d-4c8e-9b0f-2d6e8a41c7d3",
"status": "success",
"model": "muse-video",
"resolution": "720p",
"seconds": 5,
"credits": 15,
"creditsHeld": 0,
"creditsCharged": 15,
"outputs": ["https://cdn.muse-video.dev/…/video.mp4"],
…
}
}
type:video.succeeded(delivered and charged) orvideo.failed(failed or canceled; the held credits were released).data: exactly the video objectGET /api/v1/videos/:idreturns.
The signature
Webhook-Signature: t=<unix seconds>,v1=<hex signature>, where the signature is HMAC-SHA256 with your whsec_ secret over the string t + "." + raw body. To check it:
- Read the raw body, before any JSON parsing.
- Reject a
tmore than 5 minutes from your clock, which stops replays. - Compare your signature with
v1in constant time.
The secret is on Settings → API keys: one per account, shared by all its keys. Store it as an environment variable such as MUSE_VIDEO_WEBHOOK_SECRET.
Node.js (Express)
import crypto from 'node:crypto';
import express from 'express';
const app = express();
const SECRET = process.env.MUSE_VIDEO_WEBHOOK_SECRET; // whsec_…
// Keep the raw body: the signature covers the exact bytes we sent.
app.post('/hooks/muse-video', express.raw({ type: 'application/json' }), (req, res) => {
const header = req.get('Webhook-Signature') ?? '';
const match = /^t=(\d+),v1=([0-9a-f]{64})$/.exec(header);
if (!match) return res.status(400).end();
const [, t, v1] = match;
if (Math.abs(Date.now() / 1000 - Number(t)) > 300) return res.status(400).end();
const expected = crypto
.createHmac('sha256', SECRET)
.update(`${t}.${req.body.toString('utf8')}`)
.digest('hex');
if (!crypto.timingSafeEqual(Buffer.from(expected), Buffer.from(v1)))
return res.status(400).end();
const event = JSON.parse(req.body.toString('utf8'));
// event.type: "video.succeeded" | "video.failed"; event.data: the video
res.status(200).end();
});
Python (Flask)
import hashlib, hmac, os, re, time
from flask import Flask, request, abort
app = Flask(__name__)
SECRET = os.environ["MUSE_VIDEO_WEBHOOK_SECRET"].encode() # whsec_…
@app.post("/hooks/muse-video")
def muse_video_hook():
header = request.headers.get("Webhook-Signature", "")
m = re.fullmatch(r"t=(\d+),v1=([0-9a-f]{64})", header)
if not m or abs(time.time() - int(m[1])) > 300:
abort(400)
body = request.get_data() # raw bytes, before any JSON parsing
expected = hmac.new(SECRET, m[1].encode() + b"." + body, hashlib.sha256).hexdigest()
if not hmac.compare_digest(expected, m[2]):
abort(400)
event = request.get_json()
# event["type"]: "video.succeeded" | "video.failed"
return "", 200
Handling callbacks reliably
- Answer first, work later: return 2xx at once and put the download and database work on a queue.
- De-duplicate by id: a callback and your own poll can both see the result; key your work on
data.id. - Poll as a fallback: if no callback has come a few minutes after you expect one, call
GET /api/v1/videos/:id. - Keep the file: download
outputs[0]to your own storage once you have it.
Plans start at $19.69 a month (Prototype Key, 5488 credits), and failed jobs cost nothing. Compare plans and packs
Get started in 4 steps
- 01
Copy your secret
Reveal the whsec_ secret on Settings → API keys.
- 02
Pass webhook_url
Add an https URL to the create request.
- 03
Verify the signature
HMAC-SHA256 over t + "." + raw body, compared in constant time.
- 04
Answer fast
Return 2xx first and queue slow work; poll if a callback never arrives.
Questions
Do you retry failed webhooks?
No. Each video gets one attempt with a 10-second timeout. If it never arrives, poll GET /api/v1/videos/:id.
Where is the signing secret?
On Settings → API keys. It starts with whsec_ and there is one per account.
Do failed jobs send a webhook too?
Yes, as video.failed, by which time the held credits have been released.
Can the webhook URL be plain http?
No. webhook_url must be https and may not point at a private network address.
Last updated:
Build on Muse Video
with one key.
Keys, signed webhooks and per-second billing. Failed jobs cost nothing.