Skip to Content
mlab docs

Webhooks

Receive mlab.sh events on your own endpoint: the event catalog with example payloads, the signed envelope and its headers, HMAC-SHA256 verification in Python and Node, retries and testing.

mlab.sh pushes events to endpoints your organization registers: a scan finished, a monitored domain has a new vulnerability, an agent went offline, an incident changed phase, the quota is running low. Each endpoint picks the events it wants, and each delivery is retried for about seven hours if your receiver is down.

Endpoints are managed by owners and admins in Organization settings → Webhooks, or registered by an API key (see Register an endpoint with an API key). Webhooks are available on the Pro, Team and Enterprise plans.

Formats

FormatBodySigned
genericThe JSON envelope below, with the full event dataYes, HMAC-SHA256
slack{"text": "..."}, a readable summaryNo
discord{"embeds": [...]}, one embed coloured by outcomeNo
teamsA MessageCardNo

Use generic for anything a program reads. The chat formats carry a summary, not the event data, and no signature: their URL is the credential. The rest of this page is about generic.

The envelope

Every generic delivery is a POST with this body:

{
  "event": "scan.redkit.completed",
  "delivery_id": "0b7e6c2a-4f1d-4e8a-9c3b-5d2e1f0a9b8c",
  "timestamp": 1763719200,
  "org_uuid": "2f1c0e7a-9b3d-4c5e-8f6a-1b2c3d4e5f60",
  "data": {
    "domain": "example.com",
    "...": "event fields, see the catalog",
    "alert": {
      "source": "redkit",
      "target": { "type": "domain", "value": "example.com" },
      "severity": "high",
      "summary": "RedKit scan completed: example.com",
      "url": "https://mlab.sh/redkit/result/..."
    }
  }
}
FieldMeaning
eventThe event name, also in the X-Mlab-Event header.
delivery_idThis delivery's id, also in X-Mlab-Delivery. The same on every retry: deduplicate on it.
timestampUnix seconds when this attempt was signed, also in X-Mlab-Timestamp. A retry has a new one.
org_uuidThe organization the event belongs to.
dataThe event's own fields (see the catalog), plus data.alert.

data.alert is the same reading of every event, added next to the event's own fields (which are never renamed or removed):

FieldValues
sourceThe product: redkit, watchdog, domain_report, code, monitoring, infrastructure, platforms, workspaces, cases, incidents, news, quota, audit, or test for a test delivery.
target{"type": ..., "value": ...} with type domain, ip_network, workspace, case or other, or null for an event about the organization itself (quota, instances). Domains and networks are lowercased without a trailing dot.
severityThe worst severity the event carries, low, medium, high or critical; null when it carries none or all its counts are zero.
summaryOne line for a person: the event's own summary when it has one, otherwise the event label and the target.
urlWhere to look on mlab.sh, from the event's result_url or url; empty when there is none.

Headers

POST /your/endpoint HTTP/1.1
Content-Type: application/json
User-Agent: mlab-webhook/1.0
X-Mlab-Event: scan.redkit.completed
X-Mlab-Delivery: 0b7e6c2a-4f1d-4e8a-9c3b-5d2e1f0a9b8c
X-Mlab-Timestamp: 1763719200
X-Mlab-Signature: sha256=5d1c...e9a0

The four X-Mlab-* headers are sent to every format. X-Mlab-Signature is sent only to a generic endpoint.

Verify the signature

The signature is a hex HMAC-SHA256 of <timestamp>.<raw body>, keyed with the endpoint's secret (whsec_...), prefixed with sha256=. The timestamp is inside the signed material, so a captured delivery cannot be replayed later against a receiver that checks it.

To verify a delivery:

  1. Read the raw body bytes, before any JSON parsing. Re-serializing the JSON changes the bytes and breaks the signature.
  2. Compute HMAC-SHA256(secret, X-Mlab-Timestamp + "." + raw_body) and hex-encode it.
  3. Compare it with the value after sha256= in X-Mlab-Signature, in constant time.
  4. Reject the delivery if X-Mlab-Timestamp is too far from your clock. mlab does not impose a tolerance; 5 minutes is a common choice.
  5. Skip a delivery_id you already processed.

Python

import hashlib
import hmac
import time

TOLERANCE_SECONDS = 300

def verify_mlab_webhook(secret: str, raw_body: bytes, headers: dict) -> bool:
    """True when the delivery was signed by mlab with this secret and is recent."""
    timestamp = headers.get("X-Mlab-Timestamp", "")
    signature = headers.get("X-Mlab-Signature", "")
    if not timestamp.isdigit() or not signature.startswith("sha256="):
        return False
    if abs(time.time() - int(timestamp)) > TOLERANCE_SECONDS:
        return False
    signed = timestamp.encode() + b"." + raw_body
    expected = hmac.new(secret.encode(), signed, hashlib.sha256).hexdigest()
    return hmac.compare_digest(expected, signature[len("sha256="):])


# Flask example
from flask import Flask, abort, request

app = Flask(__name__)
SECRET = "whsec_..."  # from the endpoint's settings page, or the create call
seen = set()  # use a persistent store in production

@app.post("/mlab-webhook")
def mlab_webhook():
    if not verify_mlab_webhook(SECRET, request.get_data(), request.headers):
        abort(401)
    delivery = request.headers["X-Mlab-Delivery"]
    if delivery in seen:
        return "", 200  # a retry of something already handled
    seen.add(delivery)
    envelope = request.get_json()
    # queue envelope for processing, answer fast
    return "", 204

Node.js

import crypto from "node:crypto";
import express from "express";

const SECRET = process.env.MLAB_WEBHOOK_SECRET; // whsec_...
const TOLERANCE_SECONDS = 300;

function verifyMlabWebhook(secret, rawBody, headers) {
  const timestamp = headers["x-mlab-timestamp"] ?? "";
  const signature = headers["x-mlab-signature"] ?? "";
  if (!/^\d+$/.test(timestamp) || !signature.startsWith("sha256=")) return false;
  if (Math.abs(Date.now() / 1000 - Number(timestamp)) > TOLERANCE_SECONDS) return false;
  const expected = crypto
    .createHmac("sha256", secret)
    .update(`${timestamp}.`)
    .update(rawBody)
    .digest("hex");
  const given = signature.slice("sha256=".length);
  return (
    given.length === expected.length &&
    crypto.timingSafeEqual(Buffer.from(given), Buffer.from(expected))
  );
}

const app = express();
const seen = new Set(); // use a persistent store in production

// express.raw keeps the exact bytes the signature covers
app.post("/mlab-webhook", express.raw({ type: "application/json" }), (req, res) => {
  if (!verifyMlabWebhook(SECRET, req.body, req.headers)) return res.sendStatus(401);
  const delivery = req.headers["x-mlab-delivery"];
  if (seen.has(delivery)) return res.sendStatus(200);
  seen.add(delivery);
  const envelope = JSON.parse(req.body.toString("utf8"));
  // queue envelope for processing, answer fast
  res.sendStatus(204);
});

app.listen(3000);

The secret is generated when the endpoint is created: shown once by the create call, and copyable from the endpoint's settings page afterwards, where an owner or admin can also rotate it.

Delivery, timeouts and retries

What mlab expects from your endpoint:

  • A 2xx within 6 seconds. Anything else is a failed attempt: another status, a timeout, a connection error. Redirects are not followed, so a 3xx is a failure too. Acknowledge first, process in the background.
  • https on port 443, a public address, no credentials in the URL. The URL is checked when you save it and again before every delivery, and the connection is pinned to the address that passed the check.

A delivery gets 6 attempts. The first is immediate, the others follow this backoff:

AttemptSent after
1Immediately
21 minute
35 minutes
415 minutes
51 hour
66 hours
  • A delivery that used its 6 attempts becomes a dead letter. It is kept 30 days on the endpoint's page, where a member can replay it once the receiver is fixed. Delivered rows are kept 7 days.
  • 10 consecutive dead letters pause the endpoint. Dead letters are counted, not attempts, and a success resets the count. Resuming the endpoint from its page clears it.
  • Each retry has the same delivery_id, a new timestamp and a new signature.
  • After an outage, retries drain at up to 25 per minute, so a backlog arrives gradually.
  • Delivery order is not guaranteed: a retried delivery can land after a newer event. Order by the event's own data.timestamp when you need to.

Event catalog

Subscribe an endpoint to named events, or to *, which also takes every event added later. Each event's data is shown below without data.alert, which is added as described above. Timestamps inside data are RFC 3339 strings.

RedKit and scheduled scans

EventSent when
scan.redkit.completedEvery finished RedKit run, with its score and finding counts.
scan.redkit.findings.newA finished run with findings the comparable previous run did not have (new_findings above 0). Same data as scan.redkit.completed.
scan.redkit.failedA run with no result after 24 hours.
scan.redkit.flow.alertA RedKit Flow run reached a Send alert block.
scan.watchdog.triggeredA scheduled scan starts, before any result exists.
scan.watchdog.quota_exhaustedA scheduled scan was skipped because the quota was spent.

scan.redkit.completed and scan.redkit.findings.new:

{
  "scan_uuid": "8d3f...",
  "domain": "example.com",
  "modules": ["headers", "ssl", "dns"],
  "security_score": 72,
  "security_grade": "C",
  "count_critical": 0,
  "count_high": 2,
  "count_medium": 5,
  "count_low": 3,
  "total_findings": 10,
  "result_url": "https://mlab.sh/redkit/result/8d3f...",
  "has_previous": true,
  "prev_score": 80,
  "prev_grade": "B",
  "score_delta": -8,
  "prev_total_findings": 7,
  "findings_delta": 3,
  "new_findings": 3,
  "fixed_findings": 0,
  "prev_date": "2026-11-14",
  "prev_result_url": "https://mlab.sh/redkit/result/41aa...",
  "timestamp": "2026-11-21T09:00:00+00:00"
}

The prev_*, score_delta, findings_delta, new_findings and fixed_findings fields are present only when has_previous is true.

scan.redkit.failed:

{
  "scan_uuid": "8d3f...",
  "domain": "example.com",
  "status": "failed",
  "reason": "No result after 24 hours.",
  "created_at": "2026-11-20 08:00:00",
  "timestamp": "2026-11-21T08:05:00+00:00"
}

scan.redkit.flow.alert:

{
  "domain": "example.com",
  "flow": "Weekly TLS check",
  "flow_uuid": "c1e2...",
  "run": "77ab...",
  "summary": "...",
  "result_url": "https://mlab.sh/redkit/flows/FLOW_UUID?run=RUN_UUID",
  "findings": [{ "severity": "high", "title": "..." }],
  "count_low": 0,
  "count_medium": 1,
  "count_high": 1,
  "count_critical": 0
}

findings holds at most 20 entries. result_url opens the run in the flow editor. See RedKit flows.

scan.watchdog.triggered, for a domain scan, a RedKit audit and an IP range scan:

{ "domain": "example.com", "scan_type": "domain", "frequency": "weekly", "result_url": "https://mlab.sh/domain/example.com", "timestamp": "2026-11-21T06:00:00+00:00" }
{ "scan_uuid": "8d3f...", "domain": "example.com", "scan_type": "redkit", "frequency": "weekly", "result_url": "https://mlab.sh/redkit/result/8d3f...", "timestamp": "2026-11-21T06:00:00+00:00" }
{ "scan_id": "...", "range": "203.0.113.0/24", "scan_type": "ip", "frequency": "monthly", "result_url": "https://mlab.sh/redkit/ip/run/...", "timestamp": "2026-11-21T06:00:00+00:00" }

scan.watchdog.quota_exhausted:

{ "domain": "example.com", "scan_type": "domain", "frequency": "daily", "timestamp": "2026-11-21T06:00:00+00:00" }

Domain scans

EventSent when
scan.domain.completedA domain scan your organization launched finished.
scan.domain.partialIt finished, but at least one module did not land.
scan.domain.failedIt ended in failure.
scan.domain.changedA completed scan found changes since the previous scan of that domain (changes above 0). Sent in addition to scan.domain.completed.

Only scans launched by your organization (with a key or a member session, or by a schedule) send these. An anonymous scan notifies nobody.

{
  "domain": "example.com",
  "status": "completed",
  "result_url": "https://mlab.sh/domain/example.com",
  "timestamp": "2026-11-21T09:12:00+00:00",
  "changes": 2
}

status is completed, partial or failed. changes is present only on completed scans.

Source code scans

EventSent when
scan.code.completedA repository scan finished, with its finding counts and what is new since the previous scan.
scan.code.failedA repository scan reported a failure (repository unreachable, scanner error).

Security monitoring

EventSent when
monitoring.finding.newNew vulnerabilities or exposures on a monitored domain or network since the last check. One event per asset, each finding announced once.
monitoring.finding.escalatedA finding already reported is now exploited in the wild (CISA or ENISA KEV), or its severity rose.
{
  "domain": "example.com",
  "count": 1,
  "worst": "high",
  "summary": "CVE-2024-6387 (high) on mail.example.com OpenSSH 8.2p1",
  "result_url": "https://mlab.sh/...",
  "findings": [
    {
      "host": "mail.example.com",
      "product": "OpenSSH",
      "kind": "vulnerability",
      "ref": "CVE-2024-6387",
      "title": "...",
      "severity": "high",
      "kev": false,
      "first_seen": "...",
      "url": null,
      "reason": "new",
      "version": "8.2p1",
      "description": "...",
      "matched_by": "...",
      "cpe": "...",
      "purl": null,
      "osv_id": null,
      "cvss": 8.1,
      "epss": 0.4,
      "kev_due_date": null,
      "fixed_versions": ["9.8p1"]
    }
  ]
}

A monitored network sends network instead of domain. summary lists up to 8 findings, worst first, then and N more; findings has them all.

Assets and instances

EventSent when
infra.domain.unverifiedThe DNS TXT verification token of a domain disappeared, so it is no longer proven yours. In the catalog, but not sent for now: the nightly check removes the proof without an alert.
infra.name.newA domain or subdomain appeared in a connected cloud account. It is scanned on its own.
infra.machine.newA server, VPS or instance appeared in a connected account.
infra.address.changedA name of a connected zone now points elsewhere, or a server's public IP changed.
infra.asset.goneA name, address or machine a connected account no longer lists: released, deleted or moved.
ir.instance.down / tprm.instance.downA licensed IR or TPRM instance has not reported for 6 hours. Sent once per outage.
ir.instance.recovered / tprm.instance.recoveredThe instance reports again.
{ "domain": "example.com", "status": "unverified", "reason": "The DNS TXT verification token is no longer present.", "result_url": "https://mlab.sh/vulnerabilities/infra", "timestamp": "2026-11-21T03:30:00+00:00" }
{ "product": "ir", "client_label": "Acme SOC", "silent_for_hours": 6, "status": "down", "timestamp": "2026-11-21T10:00:00+00:00" }

The four cloud connection events (Team and Enterprise) carry domain (a name) or target (a machine or an address), and summary, for example "shop.example.com appeared in the OVHcloud account" or "vps-1.ovh.net now points to 51.68.1.3 (was 51.68.1.2)". The first sync of an account sends none. Past 10 changes of one kind in one sync, the rest come as one event with target ("N assets"), count and a summary ending in and N more in the audit log.

*.instance.recovered has the same fields with "status": "recovered" and no silent_for_hours.

Workspace agents and case sweeps

EventSent when
agent.offlineAn enrolled agent has not been seen by the relay for 15 minutes.
agent.recoveredIt is back.
agent.outdatedThe agent or one of its tools runs an older version than the published one.
agent.policy_driftWhat the agent runs no longer matches the policy saved for it.
case.sweep.hitsA case's indicators show up in a workspace's memory indexes, cluster events or images.
{ "workspace": "prod-k3s", "agent": "node-1", "agent_id": "...", "status": "alert", "summary": "...", "timestamp": "2026-11-21T10:15:00+00:00" }

status is alert when the condition starts and recovered on agent.recovered (summary Connected to the relay again.). agent is the agent's label, or its id when it has none.

{ "case": "Phishing wave", "workspace": "prod-k3s", "count": 3, "summary": "2 of 14 indicators matched", "matched": ["evil.example", "185.220.101.47"], "timestamp": "2026-11-21T11:00:00+00:00" }

Incidents

EventSent when
incident.openedAn incident was opened, from any page, the API or an agent. Test incidents are left out of opened, severity, phase and closed.
incident.severityIts severity changed, up or down.
incident.phaseIt moved to another phase (triage, investigating, contained, resolved, or reopened).
incident.closedIt was closed, with how it ended and the closing note in summary.
incident.attentionAn S1 or S2 without an owner, no activity for a week, an overdue task or an overdue extra notice.
incident.deadlineA GDPR, NIS2 or DORA notice not marked as sent: halfway through its window, 6 hours and 1 hour before it is due, and once overdue.

incident.update is in the catalog but is sent by email to the members following an incident, never to webhooks.

incident.opened, incident.severity, incident.phase, incident.closed:

{
  "case": "Phishing wave",
  "summary": "Phishing wave: Opened · S2 High · Phishing",
  "severity": "S2 High",
  "phase": "triage",
  "type": "phishing",
  "worst": "high",
  "url": "https://mlab.sh/incidents/CASE_UUID",
  "timestamp": "2026-11-21T11:30:00+00:00"
}

severity is the label (S1 Critical, S2 High, S3 Medium, S4 Low) and worst the same on the alerting scale (critical, high, medium, low).

incident.attention:

{ "case": "Phishing wave", "summary": "...", "worst": "high", "url": "https://mlab.sh/incidents/CASE_UUID", "timestamp": "2026-11-21T12:00:00+00:00" }

worst is high for an S1 or S2 without an owner or with no activity, medium for a quiet S3 or S4 and an overdue task, critical for an overdue extra notice.

incident.deadline:

{
  "case": "Phishing wave",
  "summary": "GDPR art. 33 Personal data breach notification for “Phishing wave” is due in 1 h (2026-11-21 13:00 UTC)",
  "deadline": "gdpr",
  "framework": "GDPR art. 33",
  "stage": "1h",
  "due_at": "2026-11-21 13:00 UTC",
  "worst": "critical",
  "url": "https://mlab.sh/incidents/CASE_UUID",
  "timestamp": "2026-11-21T12:00:00+00:00"
}

worst is critical at the 1h and overdue stages, high before.

FieldValues
deadlinegdpr, nis2_early, nis2_notification, nis2_final, dora_initial, dora_intermediate, dora_final
frameworkGDPR art. 33, NIS2 art. 23, DORA
stagehalf (half the window gone, windows of 24 hours or more), 6h (windows longer than 12 hours), 1h, overdue. Each is sent once; after a delay, only the most urgent one owed is sent.
due_atYYYY-MM-DD HH:MM UTC

Deadline reminders stop when the organization turns off Remind before a reporting deadline in Incidents › Settings. An overdue notice is also emailed to the incident's owner and the organization's admins, whatever the rules. See Reporting duties.

News, quota, audit log

EventSent when
news.watch.matchNew articles on news.mlab.sh about an entry of the watchlist your organization shares there.
quota.warningThe day's usage of a scan type crosses 80 percent of the plan limit. At most once per 24 hours per scan type.
quota.reachedThe scan that uses the last of the quota. At most once per 24 hours per scan type.
audit.members, audit.access, audit.security, audit.webhooks, audit.organization, audit.licenses, audit.billing, audit.workspacesEvery entry of the organization's audit log, one event per audit group.

news.watch.match (the data is produced by news.mlab.sh; the fields below are the ones mlab.sh reads):

{ "watch": "Company: Acme", "articles": 2, "worst": "critical", "summary": "2 new articles about Acme", "result_url": "https://news.mlab.sh/news?company=Acme" }

quota.warning and quota.reached:

{ "scan_type": "domain", "used": 80, "limit": 100, "remaining": 20, "percent_used": 80, "timestamp": "2026-11-21T13:00:00+00:00" }

audit.*:

{ "action": "webhook.created", "label": "Webhook created", "target": "SOC channel", "actor_uuid": "..." }

actor_uuid is null when mlab itself acted. The IP address of the actor is not included.

Test deliveries

The Send test button of an endpoint's page delivers webhook.test once, never retried. It is not in the catalog and nobody subscribes to it:

{ "domain": "example.com", "message": "This is a test delivery from mlab.sh.", "timestamp": "2026-11-21T14:00:00+00:00" }

domain is your organization's domain. A test counts towards the endpoint's health like any delivery.

MSSP endpoints

When an MSSP relays its clients' events to its own endpoints, each relayed data also carries "mssp_client": {"id": "...", "name": "..."}, the client it came from.

Filters

Each endpoint can also narrow what it receives, on its settings page:

  • Targets: domains or networks. A domain also covers its subdomains. An event with no domain or network target (quota, instances, workspaces, cases) is never held back by this list.
  • Minimum severity: low, medium, high or critical, read from data.alert.severity. An event without a severity (a scan finished) is never held back by it.
  • Mute until a date: nothing is sent before.

Register an endpoint with an API key

An API key with the webhooks.manage permission can register generic endpoints, list them and delete them. This permission is not part of full access: it has to be ticked by name. A key sees and deletes only the endpoints it created. Editing, testing, the delivery log, replays and secret rotation stay with members. This is how the n8n trigger node registers itself.

# Register a signed endpoint for two events
curl -X POST -H "Authorization: Bearer YOUR_API_KEY" -H "Content-Type: application/json" \
    -d '{"label":"SOC automation","url":"https://hooks.example.com/mlab","format":"generic","events":["scan.redkit.completed","monitoring.finding.new"]}' \
    "https://mlab.sh/api/v1/orga/webhooks/create"
# {"status":"success","uuid":"...","secret":"whsec_..."}

# List the endpoints this key created, with the event catalog
curl -H "Authorization: Bearer YOUR_API_KEY" "https://mlab.sh/api/v1/orga/webhooks"

# Delete one
curl -X POST -H "Authorization: Bearer YOUR_API_KEY" -H "Content-Type: application/json" \
    -d '{"uuid":"WEBHOOK_UUID"}' "https://mlab.sh/api/v1/orga/webhooks/delete"

The secret is returned once, by the create call: store it then. "events": ["*"] subscribes to everything. GET /api/v1/orga/webhooks also returns the event catalog (event, label, group, hint), the formats and the per-organization maximum (10 endpoints).

RefusalStatus
Plan without webhooks400 "Outbound webhooks are available on the Pro, Team and Enterprise plans."
A format other than generic from a key400 "An API key can only register Generic (signed) endpoints."
10 endpoints already400 "An organization can register at most 10 endpoints."
URL not https, not on port 443, with credentials, or resolving to an internal address400 with the reason, for example "Endpoint must use https."

Test locally

The endpoint must be reachable on the public internet over https, on port 443: localhost, private addresses and custom ports are refused. To develop against a receiver on your machine:

Run your receiver locally, for example the Flask or Express example above.

Expose it through an https tunnel that gives you a public URL on port 443.

Create a generic endpoint with that URL in Organization settings → Webhooks and copy its secret.

Press Send test. The page shows the status your receiver answered, and the delivery appears in the endpoint's log with its payload.

Trigger a real event, for example a domain scan launched with your key: scan.domain.completed follows when it ends.

To unit-test your verification without mlab, sign a body yourself with the same scheme: sha256= + hex HMAC-SHA256 of <timestamp>.<body> with your secret.

On this page