Webhooks
Pass a webhookUrl on a job and we POST a signed event when it reaches a
terminal state — job.done or job.failed. Delivery retries with backoff.
POST your-url
X-ClipFoundry-Event: job.done
X-ClipFoundry-Signature: t=1718100000,v1=9f86d08...
{ "event": "job.done", "jobId": "…", "status": "done",
"videoUrl": "https://cdn…/clip.mp4", "tokensCharged": 1200 }Verify the signature. The header is t=<unix>,v1=<hex>. Recompute
HMAC-SHA256 over SIGNED (the string timestamp.rawBody) with your secret:
import { createHmac, timingSafeEqual } from 'node:crypto';
function verify(rawBody, header, secret) {
const [t, v1] = header.split(',').map((p) => p.split('=')[1]);
const signed = t + '.' + rawBody;
const expected = createHmac('sha256', secret).update(signed).digest('hex');
return timingSafeEqual(Buffer.from(v1), Buffer.from(expected));
}Respond 2xx to acknowledge; anything else (or a timeout) triggers a retry.