Documentation

A documentation page with grouped navigation and search, readable prose with a code sample, a callout and a steps list, previous / next links and an “On this page” outline that follows your scroll.

Driftbox Docsv3.4

GuidesWebhooks

Webhooks

Get a request on your server the moment something changes in a Driftbox workspace — a file syncs, a folder is shared or storage runs low — instead of polling the API.

6 min read Updated Oct 2, 2026

How webhooks work

A webhook is an HTTPS endpoint on your server. When an event happens, Driftbox sends it a POST request with a JSON body describing the event. Your endpoint answers with any 2xx status within 10 seconds to confirm delivery.

Every request carries a Driftbox-Signature header, so you can check that it really came from Driftbox before you act on it.

Create an endpoint

  1. Add a route. Accept POST requests and keep the raw body — the signature is computed over the exact bytes.
  2. Register the URL. In Settings → Developers → Webhooks, add the URL and pick the events you need.
  3. Store the secret. Copy the signing secret into an environment variable such as DRIFTBOX_SECRET.
server.js
import express from "express";
import { verifyWebhook } from "@driftbox/sdk";

const app = express();

app.post(
  "/webhooks/driftbox",
  express.raw({ type: "application/json" }),
  (req, res) => {
    const event = verifyWebhook(
      req.body,
      req.header("Driftbox-Signature"),
      process.env.DRIFTBOX_SECRET,
    );
    if (event.type === "file.synced") {
      console.log("Synced", event.data.path);
    }
    res.sendStatus(200);
  },
);

Verify the signature

The signature is an HMAC-SHA256 of the timestamp and the raw body, keyed with your signing secret. The SDKs do the check for you and throw when it fails or when the timestamp is older than five minutes.

Never skip verification

Anyone can send a request to a public URL. Reject a request whose signature does not match with a 400 and do nothing else.

Retries and timeouts

When your endpoint times out or answers with an error, Driftbox retries with a growing delay. After the fifth failed retry the event is marked as failed and you can replay it from the dashboard.

Retry schedule
AttemptDelay after the previous one
1st retry1 minute
2nd retry10 minutes
3rd retry1 hour
4th retry6 hours
5th retry24 hours

Event types

Subscribe only to the events you handle. The most common ones:

file.synced
A file finished syncing to every device.
file.deleted
A file was moved to the trash.
folder.shared
Someone shared a folder with a teammate.
quota.warning
The workspace passed 90% of its storage.