Webhooks
Instead of polling, let us tell your server when a generation has ended. Pass a webhook_url when you create it:
{"images": ["upl_…", "upl_…"], "resolution": "720p", "compose": true, "webhook_url": "https://example.com/hooks/estateclip"}
When the generation has completed or failed, we send one signed POST to that URL. The event carries IDs only:
fetch the generation with GET /v1/generations/{id} for its status, clips and download links.
The request
POST /hooks/estateclip HTTP/1.1
Content-Type: application/json
User-Agent: estateclip-webhooks/1
X-Timestamp: 1763302860
X-Signature: sha256=e7dfbc1608624bc6d98104f7adf441120e3d7321232354f46e324489751407de
{"event_id":"evt_9b1de0a6c44f4d3e8f4f6c2b1a7d5e90","type":"generation.completed","created_at":"2026-11-16T14:21:00.123Z","data":{"generation_id":"gen_3f2a9c0e5b7d4a1c9e8f7a6b5c4d3e2f"}}
With the secret aaaa… (64 times a) this example request verifies; use it to test your check.
| Field | Meaning |
|---|---|
event_id |
Unique per event, the same in every delivery attempt: use it to drop duplicates |
type |
generation.completed or generation.failed, the generation's final status |
created_at |
When the generation ended, UTC |
data.generation_id |
The generation; read it with GET /v1/generations/{id} |
There is one event per generation. A generation that completed may still have failed clips or a compose_error: read
the generation to find out.
Verify the signature
Every request is signed with your workspace's webhook secret, which the dashboard shows under API keys. Only we and you know it, so a valid signature proves the request is ours and was not changed on the way.
The signature is an HMAC-SHA256 over the timestamp, a dot and the raw body:
X-Signature = "sha256=" + hex(HMAC-SHA256(secret, X-Timestamp + "." + raw body))
- Use the raw body exactly as received, before any JSON parsing: re-serialised JSON gives other bytes.
- Use the secret as the text the dashboard shows (64 characters), not decoded.
- Compare in constant time.
- Refuse timestamps more than 5 minutes away from your clock: a recorded request cannot be replayed later. Every delivery attempt is signed anew, so retries pass.
In Python, with the standard library:
import hashlib
import hmac
import time
TOLERANCE_SECONDS = 300
def verify_webhook(secret: str, body: bytes, timestamp: str, signature: str) -> bool:
"""True if the request is ours, unchanged and recent. body: the raw request body as received."""
if not timestamp.isascii() or not timestamp.isdigit():
return False
if abs(time.time() - int(timestamp)) > TOLERANCE_SECONDS:
return False
expected = hmac.new(secret.encode(), timestamp.encode() + b"." + body, hashlib.sha256).hexdigest()
return hmac.compare_digest("sha256=" + expected, signature)
Call it with the values of your framework, for example in Django
verify_webhook(secret, request.body, request.headers["X-Timestamp"], request.headers["X-Signature"]). Answer 400
if it returns False, and do nothing else with the request.
Answer quickly
- Answer with any
2xxstatus within 5 seconds. We wait at most 6 seconds for the whole delivery, connecting included; a slower answer counts as failed. - Do the actual work afterwards, for example by putting the event in your own queue. Downloading videos inside the request takes too long.
- We do not follow redirects: a
3xxanswer counts as failed. Give the final URL. - Anything but
2xx, a timeout, a refused connection or a refused address counts as a failed attempt.
Retries and duplicates
- If an attempt fails, we try again after 1 minute, then after 10 minutes, then after 60 minutes: 4 attempts over about 71 minutes. Then we give up; the generation itself is unaffected.
- Delivery is at least once: in rare cases, for example when our worker restarts at the wrong moment, the same
event arrives twice. Drop events whose
event_idyou have processed already. - Webhooks are a convenience, not your only source: if you miss one,
GET /v1/generations/{id}or the list withstatus=processingtells you where every generation stands. Poll as a fallback every few minutes.
Rules for webhook_url
- HTTPS on port 443, no user name or password, at most 2000 characters.
- A public address. URLs that point to private, local or otherwise internal addresses are refused: when you create the
generation if the URL itself shows it (
422 validation_error,fieldwebhook_url), otherwise at every delivery, where the attempt then fails. - Query parameters are kept, so a token of your own in the URL works. Treat the URL as a secret then.
Secret rotation
The dashboard can create a new webhook secret (API keys → Create new secret). It applies from the next delivery attempt on, including retries of events from before; there is no period in which both secrets are valid. Update your receiver right after rotating.
Deleted generations
Deleting a generation drops its webhook if it has not been delivered yet. An attempt that was on its way at that moment
may still arrive; GET for its generation then answers 404.
Testing
webhook_url has to be a public HTTPS address, so localhost does not work. To receive webhooks on your own machine,
open a tunnel, for example cloudflared tunnel --url http://localhost:8765, and use the HTTPS address it prints.