Skip to main content
Much of what Dreep does finishes after your API call returns: a presigned upload lands, a video transform completes, a document conversion runs, an import works through a bucket. Instead of polling, add a webhook endpoint and Dreep sends a signed POST to your server when each of these happens.
Webhooks are on the Starter and Pro plans.

Add an endpoint

  1. In the dashboard, open Developers > Webhooks.
  2. Click Add endpoint, enter your URL and pick the events you want.
  3. Copy the signing secret. It starts with whsec_ and is shown only once. Store it like any other secret, for example as DREEP_WEBHOOK_SECRET.
The URL must:
  • use https://
  • point at a public address (not localhost, a private IP range, or an internal hostname like *.local or *.internal)
  • not contain a username or password
  • be at most 2,048 characters
A project can have up to 10 endpoints. Each endpoint subscribes to its own set of events.

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’s Dreep-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.
By default a delivery is rejected when 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

  1. Read the raw request body and the Dreep-Signature header.
  2. Split the header on , and each part on the first = to get t and v1.
  3. Compute HMAC-SHA256 over {t}.{raw body} with your full whsec_ secret as the key, and hex-encode it.
  4. Compare it with v1 using a constant-time comparison, such as hmac.compare_digest in Python or hmac.Equal in Go.
  5. Reject the request if t is more than 300 seconds from the current time.

Respond quickly

Return any 2xx status within 10 seconds. Anything else counts as a failed delivery and is retried:
  • a non-2xx status, including redirects (3xx responses are not followed)
  • no response within 10 seconds
  • a connection error
Respond first and do slow work, like downloading the asset or updating other systems, in a background job. The first 1,024 characters of your response body are kept in the deliveries log, which helps when debugging.

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. Use createdAt 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:
Return 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 a webhook.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.

Rotate the secret

If a secret leaks, open the endpoint and rotate it. The new secret is shown once. The old one stops working immediately, with no overlap period: every delivery from that point, including retries already queued, is signed with the new secret. Update the secret on your server straight after rotating, or deliveries will fail verification until you do. Failed deliveries can be resent from the log once your server has the new secret.