Launching soon. Sign-ups are not open yet. Join the waitlist and we will write to you when they are.

Webhooks · Overview & setup

React the moment consent changes

When a person withdraws consent, a rights request moves on, or your systems must delete data, ClearDP sends a signed HTTPS request to your server within seconds. No polling, and nothing to miss.

Launching soon

The managed service is not open yet: https://app.cleardp.in does not accept requests and accounts cannot be created. These pages describe the API as it ships. Join the waitlist to hear when it opens.

How webhooks work

A webhook endpoint is a URL on your server. You choose which events it receives; each time one of them happens, ClearDP sends it a POST with a small JSON body describing what changed.

A withdrawal, end to end
  1. Person → ClearDP: Withdraws consent for marketingprivacy portal
  2. ClearDP: Records and seals the change
  3. ClearDP → Your endpoint: POST consent.withdrawnsigned
  4. Your endpoint: Verifies the signature
  5. Your endpoint → ClearDP: 200 OKwithin 10 seconds
  6. Your endpoint → Your systems: Queues the work: stop emails, delete data

Every delivery is:

  • Signed with a secret only you and ClearDP hold, so you can prove it came from us and was not altered — see Verifying signatures.
  • Retried up to 6 times over about 14 hours if your endpoint is down or slow — see Delivery & retries.
  • Tracked in the dashboard: its status, the response your endpoint gave on the latest attempt, the URL it was sent to, the exact JSON body that was sent and a plain-language hint when something went wrong.

What you can subscribe to

There are 18 events in 4 groups, plus a test event you can send at any time. Each is documented with its fields and an example in the event reference.

Webhook event groups
GroupEventsUse it to
ConsentWhat a person agreed to, and every change to it. These are the events most integrations need first.
Rights requests and grievancesRequests to see, correct or erase personal data, and complaints. They arrive through the privacy portal, are logged by your team in the dashboard, or by your server through the API; your team handles them in the dashboard, and these events keep your own systems in step.
ErasurePersonal data your own systems must delete, and confirmation that deletion is complete.
Breach incidentsA personal-data breach recorded by your team, and the deadline for telling the people affected.

Set up an endpoint

  1. Expose an HTTPS URL that accepts POST

    Any public https:// address on your server works — for example https://api.example.in/webhooks/consent. Private and local network addresses are refused when you add the endpoint or change its URL — see Testing locally. The handler must be able to read the raw request body, byte for byte, to check the signature.

  2. Add the endpoint in the dashboard

    Go to Webhooks → Add endpoint, paste the URL, and choose the events it should receive, or apply the Recommended preset. Managing endpoints needs administrator access.

  3. Copy the signing secret

    After you save, the endpoint's signing secret (it begins whsec_) is shown once. Store it in your secret manager or in an environment variable such as CLEARDP_WEBHOOK_SECRET. If you lose it, rotate it from the endpoint's page.

  4. Verify signatures and answer quickly

    Check the X-ClearDP-Signature header on every request, then reply 2xx within 10 seconds and do the real work afterwards. The receiver below does both.

  5. Send a test ping

    From the endpoint's menu choose Send test ping. When it shows as Success under Deliveries, your URL and secret are right and you are live.

A minimal receiver

Verify, deduplicate, queue, answer. Below in Node.js, Python and Go; PHP, Java, Ruby and C# are on Verifying signatures.

Node.js server.js · Express

const crypto = require("node:crypto");
const express = require("express");

const SECRET = process.env.CLEARDP_WEBHOOK_SECRET; // whsec_…
const TOLERANCE_MS = 5 * 60 * 1000;

function verifySignature(rawBody, header, secret) {
  const parts = {};
  for (const item of String(header || "").split(",")) {
    const i = item.indexOf("=");
    if (i > 0) parts[item.slice(0, i).trim()] = item.slice(i + 1).trim();
  }
  const t = Number(parts.t);
  if (!Number.isInteger(t) || !parts.v1) return false;
  if (Math.abs(Date.now() - t) > TOLERANCE_MS) return false; // stale or replayed

  const expected = crypto
    .createHmac("sha256", secret)
    .update(`${parts.t}.`)
    .update(rawBody)
    .digest("hex");
  const a = Buffer.from(expected);
  const b = Buffer.from(parts.v1);
  return a.length === b.length && crypto.timingSafeEqual(a, b);
}

const app = express();

// express.raw keeps the exact bytes received; a parsed-and-reserialised body fails.
app.post("/webhooks/consent", express.raw({ type: "application/json" }), (req, res) => {
  if (!verifySignature(req.body, req.get("X-ClearDP-Signature"), SECRET)) {
    return res.sendStatus(401);
  }
  const deliveryId = req.get("X-ClearDP-Delivery"); // skip ids you have already processed
  const event = JSON.parse(req.body.toString("utf8"));
  // Queue event for processing, then answer quickly.
  res.sendStatus(200);
});

app.listen(8080);

Python app.py · Flask

import hashlib
import hmac
import os
import time

from flask import Flask, abort, request

SECRET = os.environ["CLEARDP_WEBHOOK_SECRET"]  # whsec_…
TOLERANCE_MS = 5 * 60 * 1000


def verify_signature(raw_body: bytes, header: str, secret: str) -> bool:
    parts = {}
    for item in (header or "").split(","):
        key, sep, value = item.partition("=")
        if sep:
            parts[key.strip()] = value.strip()
    t, v1 = parts.get("t", ""), parts.get("v1", "")
    if not t.isdigit() or not v1:
        return False
    if abs(time.time() * 1000 - int(t)) > TOLERANCE_MS:
        return False  # stale or replayed

    expected = hmac.new(secret.encode(), f"{t}.".encode() + raw_body, hashlib.sha256).hexdigest()
    return hmac.compare_digest(expected, v1)


app = Flask(__name__)


@app.post("/webhooks/consent")
def consent_webhook():
    raw_body = request.get_data()  # the exact bytes received
    if not verify_signature(raw_body, request.headers.get("X-ClearDP-Signature", ""), SECRET):
        abort(401)
    delivery_id = request.headers.get("X-ClearDP-Delivery")  # skip ids you have already processed
    event = request.get_json()
    # Queue event for processing, then answer quickly.
    return "", 200

Go main.go · net/http

package main

import (
	"crypto/hmac"
	"crypto/sha256"
	"encoding/hex"
	"io"
	"net/http"
	"os"
	"strconv"
	"strings"
	"time"
)

const tolerance = 5 * time.Minute

func verifySignature(rawBody []byte, header, secret string, now time.Time) bool {
	var t, v1 string
	for _, item := range strings.Split(header, ",") {
		key, value, ok := strings.Cut(item, "=")
		if !ok {
			continue
		}
		switch strings.TrimSpace(key) {
		case "t":
			t = strings.TrimSpace(value)
		case "v1":
			v1 = strings.TrimSpace(value)
		}
	}
	ms, err := strconv.ParseInt(t, 10, 64)
	if err != nil || v1 == "" {
		return false
	}
	if age := now.Sub(time.UnixMilli(ms)); age > tolerance || age < -tolerance {
		return false // stale or replayed
	}

	mac := hmac.New(sha256.New, []byte(secret))
	mac.Write([]byte(t + "."))
	mac.Write(rawBody)
	expected := hex.EncodeToString(mac.Sum(nil))
	return hmac.Equal([]byte(expected), []byte(v1))
}

func consentWebhook(w http.ResponseWriter, r *http.Request) {
	rawBody, err := io.ReadAll(io.LimitReader(r.Body, 1<<20)) // the exact bytes received
	if err != nil {
		http.Error(w, "unreadable body", http.StatusBadRequest)
		return
	}
	secret := os.Getenv("CLEARDP_WEBHOOK_SECRET") // whsec_…
	if !verifySignature(rawBody, r.Header.Get("X-ClearDP-Signature"), secret, time.Now()) {
		http.Error(w, "bad signature", http.StatusUnauthorized)
		return
	}
	deliveryID := r.Header.Get("X-ClearDP-Delivery") // skip ids you have already processed
	_ = deliveryID
	// Queue rawBody for processing, then answer quickly.
	w.WriteHeader(http.StatusOK)
}

func main() {
	http.HandleFunc("/webhooks/consent", consentWebhook)
	http.ListenAndServe(":8080", nil)
}

Testing locally

ClearDP sends events from the internet, so it can never reach localhost. To receive them while you develop, put a tunnel in front of your local receiver: a tool that gives it a temporary public https address.

  1. Run your receiver on a local port

    Start the receiver from the previous section (the samples above listen on port 8080; for Python run flask --app app run --port 8080). It cannot verify signatures yet; the signing secret comes in step 3.

  2. Open a tunnel to that port

    Any tunnel that gives you a public https:// address works. Two common ones:

    ngrok http 8080
    # or
    cloudflared tunnel --url http://localhost:8080

    The tool prints the public address. Keep it running while you test.

  3. Register the tunnel address

    In Webhooks → Add endpoint, enter the tunnel address followed by your handler's path, for example https://<tunnel-address>/webhooks/consent. Copy the signing secret, set it as CLEARDP_WEBHOOK_SECRET and restart your receiver so it can verify signatures.

  4. Send a test ping

    From the endpoint's menu choose Send test ping. The request shows up in your receiver's log, and the delivery shows as Success under Deliveries. Anything else is explained in Troubleshooting.

  • The address changes. Many tunnels give you a new address each time they start. Choose Edit endpoint from the endpoint's menu and paste the new one.
  • Use a development property. An endpoint receives the events of its whole property. Register your tunnel on a property you made for development, so that no real person's events reach your laptop. A second property needs the Standard plan or above; on a one-property plan, subscribe the endpoint only to the events you are testing. Switch the endpoint off, or choose Delete endpoint, when you are done.
  • Check your clock. A delivery whose timestamp is more than 5 minutes from your machine's clock fails the replay check.
  • Running ClearDP yourself? A self-hosted installation in production mode refuses private addresses too, unless its operator sets CLEARDP_WEBHOOK_ALLOW_PRIVATE=true.

Production checklist

  • Reject any request whose signature does not verify, with 401.
  • Answer 2xx within 10 seconds and move slow work — deletion jobs, emails — to a queue.
  • Deduplicate on the X-ClearDP-Delivery header. Retries and redeliveries reuse it, so the same delivery can arrive more than once.
  • Do not depend on arrival order. When the current state matters, read it from the API.
  • Answer 2xx to event types you do not handle yet, and ignore fields you do not recognise, so additions never break your receiver.
  • Keep the signing secret out of source control, and rotate it if it may have leaked.
  • Watch Deliveries in the dashboard for failed or dead deliveries, or alert on your own handler's error rate.

Start with proof, not promises

Accounts open soon: join the waitlist and we will write to you when yours can be created. The trial is 21 days, no card, starting on Growth. Or answer 8 questions and see your top-3 DPDP risks in 2 minutes.