Webhooks
Register an HTTPS endpoint and we POST every subscribed lifecycle event to it — signed Stripe-style, retried on a seven-step ladder for up to 24+ hours, and replayable when you’ve fixed whatever broke on your side.
1. Register an endpoint
curl -X POST https://api.calder.click/v1/webhooks \
-H "Authorization: Bearer calder_sk_live_…" \
-H "content-type: application/json" \
-d '{"url":"https://acme.com/hooks/calder","events":["email.delivered","email.bounced"]}'The URL must be public HTTPS — loopback and private RFC1918 addresses are rejected both at registration and again at delivery time (DNS-rebinding defense). You get back the endpoint ID and a signing secret (whsec_…), shown exactly once. Rotate it any time with POST /v1/webhooks/:id/rotate; the old secret stops signing immediately.
2. What arrives
POST /hooks/calder HTTP/1.1
content-type: application/json
webhook-id: whd_9f2k41xq
webhook-signature: t=1780272000,v1=8b1a…4f2c
{
"id": "whd_9f2k41xq",
"type": "email.delivered",
"createdAt": "2026-09-24T10:00:00.000Z",
"data": { "emailId": "em_9f2k41xq", "to": "you@example.com" }
}The signature is over the timestamp plus the body: v1 = HMAC-SHA256(secret, t + "." + raw_body). The timestamp binds the signature to a point in time, which is what lets you reject replays older than five minutes.
3. Verify before trusting
Verify with a constant-time comparison and reject stale timestamps. No official SDKs are required — every example below is stdlib-only:
import crypto from "node:crypto";
// rawBody = the request body EXACTLY as received (no JSON re-stringify)
function verifyCalderWebhook(rawBody: string | Buffer, signature: string, secret: string) {
const parts = Object.fromEntries(
signature.split(",").map((kv) => [kv.split("=")[0], kv.split("=").slice(1).join("=")]),
);
const t = Number(parts.t);
if (!t || Math.abs(Date.now() / 1000 - t) > 300) return false; // 5-minute replay window
const expected = crypto
.createHmac("sha256", secret)
.update(`${t}.${rawBody}`, "utf8")
.digest("hex");
const a = Buffer.from(parts.v1 ?? "", "hex");
const b = Buffer.from(expected, "hex");
return a.length === b.length && crypto.timingSafeEqual(a, b);
}import hashlib, hmac, time
def verify_calder_webhook(raw_body: bytes, signature: str, secret: str) -> bool:
parts = dict(kv.split("=", 1) for kv in signature.split(","))
t = int(parts.get("t", "0"))
if t == 0 or abs(time.time() - t) > 300:
return False # 5-minute replay window
expected = hmac.new(
secret.encode(), f"{t}.".encode() + raw_body, hashlib.sha256
).hexdigest()
return hmac.compare_digest(parts.get("v1", ""), expected)
# Flask: verify_calder_webhook(request.get_data(), request.headers["webhook-signature"], SECRET)require "openssl"
require "rack"
def verify_calder_webhook(raw_body, signature, secret)
parts = signature.split(",").map { |kv| kv.split("=", 2) }.to_h
t = parts["t"].to_i
return false if t.zero? || (Time.now.to_i - t).abs > 300 # 5-minute window
expected = OpenSSL::HMAC.hexdigest("sha256", secret, "#{t}.#{raw_body}")
Rack::Utils.secure_compare(parts["v1"].to_s, expected)
end
# Rails: verify_calder_webhook(request.raw_post, request.headers["webhook-signature"], SECRET)function verify_calder_webhook(string $rawBody, string $signature, string $secret): bool {
$parts = [];
foreach (explode(",", $signature) as $kv) { [$k, $v] = explode("=", $kv, 2); $parts[$k] = $v; }
$t = (int)($parts["t"] ?? 0);
if ($t === 0 || abs(time() - $t) > 300) return false; // 5-minute replay window
$expected = hash_hmac("sha256", $t . "." . $rawBody, $secret);
return hash_equals($expected, $parts["v1"] ?? "");
}
// Laravel: verify_calder_webhook($request->getContent(), $request->header("webhook-signature"), $secret)4. Acknowledge fast, work later
Respond 2xx within 10 seconds. Anything else — timeout, 4xx, 5xx — counts as a failed attempt. Retries fire at 5s → 30s → 2m → 10m → 30m → 2h → 6h; after the eighth failed attempt the delivery lands in the dead-letter state (failed) and stops retrying. Deleting or disabling the endpoint fails in-flight deliveries terminally instead of burning the ladder.
5. Inspect and replay
Every attempt is recorded with HTTP status, latency, error message, and next-retry time — browse it in the dashboard (Webhooks → endpoint → Deliveries) or pull the last 25 from GET /v1/webhooks/:id/deliveries. Replay a single delivery with POST /v1/webhooks/:id/deliveries/:deliveryId/replay (or the replay button): it creates a new delivery carrying the original data. Replays are deliberately never auto-deduped — dedupe on the business id inside data (e.g. emailId) if you must.