POST to your server when each of these happens.
Webhooks are on the Starter and Pro plans.
Add an endpoint
- In the dashboard, open Developers > Webhooks.
- Click Add endpoint, enter your URL and pick the events you want.
- Copy the signing secret. It starts with
whsec_and is shown only once. Store it like any other secret, for example asDREEP_WEBHOOK_SECRET.
- use
https:// - point at a public address (not
localhost, a private IP range, or an internal hostname like*.localor*.internal) - not contain a username or password
- be at most 2,048 characters
Events
asset.* events cover files you upload, whether directly, through a presigned upload or by import. Files Dreep creates for you, like a converted document or a background-removed image, send their own event (conversion.completed, bg_remove.completed) instead of asset.ready.
A video uploaded with a transform sends asset.ready once its final file is in place, together with video.variant.ready, or with video.variant.failed if the transform failed and the original was kept.
An import job is import.failed only when nothing in it imported. A partial import is import.completed, with the number that failed.
usage.limit_reached is sent at most once a day for each feature and limit, not on every blocked request.
There’s also webhook.test, which only the Send test event button sends. You can’t subscribe to it.
Payload
Every delivery is a JSON object with the same envelope:
Don’t rely on the order of keys in the body.
Asset events
asset.ready, asset.failed, conversion.completed, video.variant.ready, video.variant.failed and bg_remove.completed carry the asset:
conversion.failed adds an error next to the asset: unconvertible, page_out_of_range or conversion_failed.
asset.deleted
The asset no longer exists, so only its id and type are sent:Import events
import.completed and import.failed carry the import job. provider is cloudinary, s3 or r2.
usage.limit_reached
featureKey is the plan feature that ran out, such as storage_bytes or transformations_monthly. limit is the limit that was hit, including any add-ons, and used is the usage at that point.
webhook.test
Headers
Verify the signature
Anyone can send a request to your endpoint, so check every delivery’sDreep-Signature before acting on it. The header looks like this:
t is when the delivery was signed, in Unix seconds. v1 is a hex HMAC-SHA256 of `${t}.${rawBody}`, keyed with your endpoint’s full secret, whsec_ included. Each retry is signed again with a fresh t.
Verify against the raw request body, byte for byte. If your framework has already parsed the JSON, re-serialising it won’t give back the same bytes (key order, spacing and escaping can differ) and the signature won’t match.
With the Node SDK
verifyWebhook checks the signature and the timestamp and returns the parsed event. It throws DreepWebhookSignatureError if anything is wrong.
t is more than 300 seconds from your server’s clock, in either direction. Pass toleranceSeconds to change that.
With Node’s crypto module
Other languages
- Read the raw request body and the
Dreep-Signatureheader. - Split the header on
,and each part on the first=to gettandv1. - Compute HMAC-SHA256 over
{t}.{raw body}with your fullwhsec_secret as the key, and hex-encode it. - Compare it with
v1using a constant-time comparison, such ashmac.compare_digestin Python orhmac.Equalin Go. - Reject the request if
tis more than 300 seconds from the current time.
Respond quickly
Return any2xx status within 10 seconds. Anything else counts as a failed delivery and is retried:
- a non-
2xxstatus, including redirects (3xxresponses are not followed) - no response within 10 seconds
- a connection error
Retries and auto-disable
A failed delivery is tried up to 8 times in total. The waits between tries grow from 1 minute to about 12 hours (1m, 3m, 9m, 27m, 81m, about 4h, about 12h, each give or take 10%), so Dreep keeps trying for about 18 hours before giving up on a delivery. If 10 deliveries in a row to the same endpoint use up all their tries, Dreep disables the endpoint and stops sending to it. Any successful delivery resets the count. Events that happen while an endpoint is disabled aren’t sent to it and can’t be resent later, and retries still queued for it are marked as failed. To switch a disabled endpoint back on, fix the problem, use Send test event to check it, then enable it in Developers > Webhooks. Deliveries can arrive out of order, and a retry can arrive after a later event. UsecreatedAt or fetch the current state from the API if order matters to you.
Handle duplicates
The same event can reach you more than once, for example when your server handled it but the response timed out, or when someone resends it from the dashboard. The event id (id in the body and the Dreep-Event-Id header) never changes for an event, so use it to skip work you’ve already done:
2xx for a duplicate too, or Dreep will keep retrying it.
Test an endpoint
In Developers > Webhooks, open an endpoint and click Send test event. Dreep sends awebhook.test delivery straight away and shows your server’s response. Test events are tried once, never retried, don’t count towards auto-disable, and are sent even when the endpoint is disabled.
Each endpoint has a deliveries log with every attempt’s status code, response body, error and duration. Deliveries are kept for 30 days. Click Resend on any delivery to send the same event again. A resend has the same event id and body and a new Dreep-Delivery-Id.