Kuma for developers Early access API reference Manage keys

Webhooks

Instead of asking Kuma over and over, let Kuma tell you: it POSTs each event to your URL as it happens.

Events

EventWhenNeeds
case.createdA moderation case was opened (a warning, mute, kick, ban, AutoMod action…).cases:read
case.updatedA case's status or reason changed (appealed, resolved, reason edited).cases:read
member.level_upA member reached a new level.levels:read
member.coins_changedSomeone's coins were changed by staff (!coins give, take or set, or the dashboard) or through the API. Not sent for coins earned by chatting.economy:read
member.erasedSomeone asked Kuma to erase their data. Delete what you hold about them. Always sent.always sent
pingSent when you press "Send test".always sent

Like a key, a webhook only gets events the person who added it could read, and stops getting them if they lose that permission or the server switches the feature off.

Set one up

  1. On the dashboard, under Developer API → Add a webhook, enter an https:// URL and tick the events.
  2. Copy the signing secret (whsec_…). Kuma shows it once.
  3. Press Send test: your endpoint gets a ping, and the log shows whether it arrived.

What arrives

Request
POST /kuma HTTP/1.1
Content-Type: application/json
Kuma-Event-Id: evt_5b2c…
Kuma-Event-Type: case.created
Kuma-Delivery-Id: dlv_81fe…
Kuma-Delivery-Attempt: 1
Kuma-Signature: t=1795354971,v1=4f0c…

{
  "id": "evt_5b2c…",
  "type": "case.created",
  "api_version": "v1",
  "created_at": "2026-11-22T14:22:51.000Z",
  "server_id": "01HQ8…",
  "data": { "case": { "id": 412, "action": "warn", "reason": "Spam", "user": { … }, "moderator": { … }, … } }
}

Check it's really from Kuma

Kuma-Signature is t=<unix seconds>,v1=<signature>. The signature is the hex HMAC-SHA256 of <t>.<raw body> using your signing secret. Check it over the raw body, before parsing the JSON, and refuse anything more than five minutes old.

Node + Express
import crypto from "node:crypto";
import express from "express";

function fromKuma(secret, header, rawBody) {
  const parts = Object.fromEntries(String(header).split(",").map((p) => p.split("=")));
  if (!parts.t || !parts.v1 || Math.abs(Date.now() / 1000 - Number(parts.t)) > 300) return false;
  const want = crypto.createHmac("sha256", secret).update(`${parts.t}.${rawBody}`).digest();
  const got = Buffer.from(parts.v1, "hex");
  return got.length === want.length && crypto.timingSafeEqual(got, want);
}

const seen = new Set(); // use your database in real life

const app = express();
app.post("/kuma", express.raw({ type: "application/json" }), (req, res) => {
  if (!fromKuma(process.env.KUMA_WEBHOOK_SECRET, req.get("Kuma-Signature"), req.body)) {
    return res.sendStatus(401);
  }
  const event = JSON.parse(req.body);
  res.sendStatus(200);                 // answer first...
  if (seen.has(event.id)) return;      // ...ignore repeats...
  seen.add(event.id);
  handle(event);                       // ...then do the work
});
Python + Flask
import hashlib, hmac, json, os, time
from flask import Flask, request, abort

app = Flask(__name__)
SECRET = os.environ["KUMA_WEBHOOK_SECRET"].encode()

def from_kuma(header, raw):
    parts = dict(p.split("=", 1) for p in (header or "").split(",") if "=" in p)
    if "t" not in parts or "v1" not in parts or abs(time.time() - int(parts["t"])) > 300:
        return False
    want = hmac.new(SECRET, f"{parts['t']}.".encode() + raw, hashlib.sha256).hexdigest()
    return hmac.compare_digest(want, parts["v1"])

@app.post("/kuma")
def kuma():
    if not from_kuma(request.headers.get("Kuma-Signature"), request.get_data()):
        abort(401)
    event = json.loads(request.get_data())
    # ... handle event, skipping ids you've seen ...
    return "", 200

Delivery rules