Leantel

Webhooks

Leantel posts a signed JSON event to your webhook URL when people sign up or their details change. Verify every request before you use it.

Set up

Set the URL and the events you want with PATCH /v1/admin/config (webhook), then create the signing secret with POST /v1/admin/webhook/secret. The secret is shown once. POST /v1/admin/webhook/test sends a ping event; answer it with 2xx like any other event. The Webhooks page in the console does the same.

The request

Each request is a POST with the headers Auth-Event-Id, Auth-Event-Type and Auth-Signature: t=<unix seconds>,v1=<hex>. The body is one event:

{"id":"evt_…","type":"user.registered","tenant_id":"ten_…","occurred_at":"2026-10-01T17:04:05Z","data":{…}}

Verify the signature

  1. Read the raw body. Don't parse and re-serialise the JSON first.
  2. Compute HMAC-SHA256 with your signing secret over <t>.<raw body> and compare it with v1 in constant time.
  3. Some proxies split headers at commas: join every Auth-Signature value with , before you parse it.
  4. Reject a t more than 5 minutes from your clock, in the past or the future.
  5. Skip events whose Auth-Event-Id you have already handled. A retry sends the same id.
  6. Reply with 2xx within 5 seconds and do the work afterwards.

In Node.js:

import { createHmac, timingSafeEqual } from "node:crypto";

export function verifyWebhook(secret, signatureHeader, rawBody, nowSeconds = Math.floor(Date.now() / 1000)) {
  const parts = Object.fromEntries(signatureHeader.split(",").map((part) => part.trim().split("=", 2)));
  const t = Number(parts.t);
  const v1 = Buffer.from(parts.v1 ?? "", "hex");
  if (!Number.isInteger(t) || v1.length !== 32) throw new Error("malformed Auth-Signature");
  if (Math.abs(nowSeconds - t) > 300) throw new Error("stale webhook");
  const expected = createHmac("sha256", secret).update(`${t}.`).update(rawBody).digest();
  if (!timingSafeEqual(expected, v1)) throw new Error("bad signature");
}

Every quickstart includes a complete webhook handler for its stack.

Event types

You receive the types you chose in the webhook settings; with none chosen, you receive all of them.

Typedata
user.registereduser_id, email?, username?, phone?, external_id?, utype, roles, profile{tenant fields}, method (password, google, github, invite, seed, authctl, import, admin)
user.email_verifieduser_id, email
user.status_changeduser_id, from, to
user.roles_changeduser_id, roles, utype
user.password_changeduser_id
user.email_changeduser_id, old_email, new_email
user.deleteduser_id
ping{}

Delivery and retries

Delivery is at least once and in any order. A delivery that doesn't get a 2xx answer is retried after 1 minute, 5 minutes, 30 minutes, 2 hours and 6 hours, then parked; retry it from the console or with POST /v1/admin/webhook/deliveries/{delivery_id}/retry. Every attempt is signed again with the current time.