LancelotDocs
Webhooks

Let Lancelot act

Webhooks

Every finding and fix as JSON, signed so you know it came from Lancelot. On Scale and up.

Add a Signed webhook in Settings → Notifications and copy the signing secret (it starts with whsec_).

Request

POST https://your-server.example.com/lancelot
Content-Type: application/json
User-Agent: Lancelot-Notify/1
Lancelot-Event: action.proposed
Lancelot-Delivery: <stable id, the same on every retry>
Lancelot-Signature: t=1795640000,v1=5f2c...
{
  "id": "...",
  "type": "action.proposed",
  "created_at": "2026-11-25T14:02:11Z",
  "workspace": { "id": "...", "name": "Acme" },
  "severity": 2,
  "message": { "title": "...", "body": "...", "impact": "...", "note": "...", "text": "...", "url": "https://app.lancelot.watch/..." },
  "action": {
    "id": "...", "type": "throttle", "status": "proposed", "params": { "calls_per_minute": 10 },
    "impact_micros": 107000000, "confidence": "high",
    "customer_external_id": "cus_123", "expires_at": "..."
  },
  "finding": { "id": "...", "kind": "underwater", "customer_external_id": "cus_123", "numbers": {} }
}

action or finding is null when it doesn't apply. Money is in micros: millionths of a dollar.

Event types

  • finding.new: Lancelot found a problem.
  • action.suggested, action.proposed: a fix is suggested, or waiting for approval.
  • action.executed, action.undone, action.expired, action.failed: what happened to a fix.
  • digest: a summary with an items list instead of action and finding.

Verify the signature

The signature is an HMAC-SHA256 of {t}.{raw body}, keyed with your whole whsec_... secret, in hex. Reject anything older than 5 minutes. Use the raw body, before any JSON parsing.

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

export function verify(rawBody: string, header: string | null, secret: string): boolean {
  if (!header) return false;
  const parts = Object.fromEntries(header.split(",").map((p) => p.split("=", 2) as [string, string]));
  const t = Number(parts.t);
  if (!Number.isInteger(t) || Math.abs(Date.now() / 1000 - t) > 300) return false;
  const expected = createHmac("sha256", secret).update(`${t}.${rawBody}`).digest("hex");
  const a = Buffer.from(expected);
  const b = Buffer.from(parts.v1 ?? "");
  return a.length === b.length && timingSafeEqual(a, b);
}

Retries

Answer with any 2xx within a few seconds. Anything else is retried after 1 minute, 5 minutes, 30 minutes, 2 hours and 8 hours: six attempts over about 11 hours. Lancelot-Delivery stays the same across retries, so use it to skip duplicates.