Webhooks
Signed calls from NexGuard to your systems: incident notifications and response instructions.
NexGuard calls your systems in two situations. Both are POST requests with a JSON body, signed with a secret only you and NexGuard hold, so your endpoint can prove a request came from us before acting on it.
- Incident notifications — a high-severity incident, or a periodic summary of the rest. Use them to open a ticket, page someone or post to a chat channel, instead of polling.
- Response instructions — an action one of your approvers accepted in the console, such as asking a user for a one-time code. Your system carries it out. NexGuard never acts on your users by itself.
Setting up an endpoint
- Notifications: in the console, open Notifications, choose Webhook and enter your URL. It must be
httpsand carry no query string. The signing secret is shown once, right after saving; store it in your secret manager. Saving the webhook again issues a new secret and the old one stops working. - Response instructions: in the console, open Settings → Response endpoint and enter your URL. The same rules apply:
https, no query string, no credentials in the URL. The signing secret is shown once, right after saving. Saving again — or Rotate signing secret — issues a new secret and the old one stops working at once. Only an owner or administrator of the organisation can change it, and every change is in the audit log. - Plans: webhook, Teams and Slack notifications are part of Starter and above; response instructions are part of Growth and above. Email notifications are in every plan. Something already set up keeps working if the plan changes; only adding a new one needs the plan.
- NexGuard does not follow redirects. A
301or302from your endpoint counts as not delivered, so give the final URL. - Your endpoint has 10 seconds to answer.
Sending a test
Every configured channel and the response endpoint has a Send a test button. It sends one request now, signed exactly like a real one, and shows what came back: delivered or not, the HTTP status, how long it took and why it failed. A test is sent even when the destination is switched off, so you can check it before switching it on. Each destination can be tested five times in ten minutes; after that the console says how long to wait.
A test always says it is one: the header X-NexGuard-Test: true, and "test": true in the body, with event set to notification.test or response.test. A response-endpoint test carries no proposal_id, action or target: there is nothing in it to carry out. Answer it with 2xx once the signature verifies.
Headers on every request
| Header | Meaning |
|---|---|
X-NexGuard-Timestamp | Unix time in seconds when the request was signed. |
X-NexGuard-Nonce | A random value, different on every request. |
X-NexGuard-Signature | v1= followed by the lowercase hex HMAC-SHA256 described below. |
X-NexGuard-Event | Notifications only: incident.notification or incident.digest, the same as the body's event. |
X-NexGuard-Delivery | Webhook notifications only: one id per notification, the same as the body's delivery_id and the same on every attempt. Use it to drop a retry you already processed. |
X-NexGuard-Attempt | Webhook notifications only: 1 for the first attempt, then 2 and 3 for retries. |
X-NexGuard-Test | true on a test sent from the console; absent otherwise. |
X-NexGuard-Proposal | Response instructions only: the instruction's id, the same as the body's proposal_id. |
Verifying the signature
The signature is the same scheme NexGuard uses to check your signed requests (see request signing), so one piece of code does both. The signed message is four lines joined by \n:
v1
<X-NexGuard-Timestamp>
<X-NexGuard-Nonce>
<lowercase hex SHA-256 of the raw body>Compute HMAC-SHA256 of it with your signing secret, write it as lowercase hex, put v1= in front and compare with X-NexGuard-Signature in constant time. Refuse the request if the timestamp is more than 300 seconds from your clock, or if you have already seen the nonce.
import hashlib, hmac, time
def verify(secret: str, headers, body: bytes, seen_nonces: set[str]) -> None:
"""Raise unless the request came from NexGuard. Call it on the raw body."""
timestamp = headers["X-NexGuard-Timestamp"]
nonce = headers["X-NexGuard-Nonce"]
signature = headers["X-NexGuard-Signature"]
if abs(time.time() - int(timestamp)) > 300:
raise ValueError("too old or from the future")
if nonce in seen_nonces:
raise ValueError("replayed")
digest = hashlib.sha256(body).hexdigest()
message = f"v1\n{timestamp}\n{nonce}\n{digest}".encode()
expected = "v1=" + hmac.new(secret.encode(), message, hashlib.sha256).hexdigest()
if not hmac.compare_digest(expected, signature):
raise ValueError("bad signature")
seen_nonces.add(nonce) # keep for at least 10 minutesimport { createHash, createHmac, timingSafeEqual } from "node:crypto";
// Use the raw request body (a Buffer), not a re-serialised JSON object.
export function verify(secret, headers, rawBody, seenNonces) {
const timestamp = headers["x-nexguard-timestamp"];
const nonce = headers["x-nexguard-nonce"];
const signature = headers["x-nexguard-signature"] ?? "";
if (Math.abs(Date.now() / 1000 - Number(timestamp)) > 300) throw new Error("too old");
if (seenNonces.has(nonce)) throw new Error("replayed");
const digest = createHash("sha256").update(rawBody).digest("hex");
const expected = "v1=" + createHmac("sha256", secret)
.update(`v1\n${timestamp}\n${nonce}\n${digest}`)
.digest("hex");
const a = Buffer.from(expected);
const b = Buffer.from(signature);
if (a.length !== b.length || !timingSafeEqual(a, b)) throw new Error("bad signature");
seenNonces.add(nonce); // keep for at least 10 minutes
}Slack and Microsoft Teams
If your team lives in chat, you do not need to run an endpoint. Under Notifications choose Slack or Microsoft Teams and paste the incoming-webhook URL that the chat service gave you. The same incident notifications and digests arrive as a message: Block Kit in Slack, an Adaptive Card in Teams.
- Slack: an incoming webhook URL created in your workspace for the channel your security team watches, on
hooks.slack.com, with no query string. - Teams: a channel's incoming webhook, or the URL of a Workflows flow built from the template “Post to a channel when a webhook request is received”. It must be on
webhook.office.com,logic.azure.com,powerplatform.comorpowerautomate.com. - The URL must be
httpsand must not carry credentials. Any other host is refused when you save; for your own server use the signed webhook above. - The URL is itself a credential, since anybody holding it can post into the channel. NexGuard stores it sealed and shows back only the host and the last four characters.
- These messages are not signed (the chat service does the authenticating), so there is nothing to verify on your side. Incident messages carry no personal data beyond what a notification already holds: a severity, a count and a link to the console.
Incident notifications
A high-severity incident is sent at once, and the same incident is not sent again for 4 hours however much it grows. Everything else waits for the summary, which by default covers 24 hours. The body carries a severity, a count and a link to the console — never findings, user identifiers or reasoning, because a webhook endpoint is outside our boundary and may be logged anywhere. Open the link, or call the read API with the incident_id, for the details.
POST /your/notification/endpoint
Content-Type: application/json
X-NexGuard-Event: incident.notification
X-NexGuard-Attempt: 1
X-NexGuard-Delivery: 9b0e2c7a-51d4-4f0e-8a3c-6d1f2e4b7a90
X-NexGuard-Timestamp: 1793349243
X-NexGuard-Nonce: 3q2-7wEXAMPLEnonce
X-NexGuard-Signature: v1=5f0c…
{
"event": "incident.notification",
"incident_id": "3f1c6a0e-8d2b-4c55-9a51-2f7e0b6d4c11",
"severity": "high",
"finding_count": 4,
"correlation_kind": "account",
"link": "https://securiteagi.com/incidents/3f1c6a0e-8d2b-4c55-9a51-2f7e0b6d4c11",
"at": "2026-10-30T09:14:03+00:00",
"delivery_id": "9b0e2c7a-51d4-4f0e-8a3c-6d1f2e4b7a90"
}{
"event": "incident.digest",
"period_start": "2026-10-29T09:00:00+00:00",
"period_end": "2026-10-30T09:00:00+00:00",
"counts": { "high": 1, "medium": 3, "low": 7 },
"link": "https://securiteagi.com/incidents"
}Answer with any 2xx. Every other answer, a timeout or a redirect is a failed attempt, and a failed webhook, Teams or Slack notification is retried: three attempts in all, the second about a minute after the first and the third about four minutes after that. Each retry sends the same body — the same delivery_id — with a fresh timestamp, nonce and signature, so it passes your replay check and you can still tell it is the same notification. After the third failure it is given up on.
Every attempt is recorded on the console's Notifications page: the delivery shows as retrying, then as sent or failed with the number of attempts, and the channel shows how many deliveries are waiting for another try. Email is not retried by NexGuard. If missing a notification would matter, poll the read API as a backstop.
Response instructions
Sent when an approver in your organisation accepts a proposed action. Carry it out, then answer.
POST /your/response/endpoint
Content-Type: application/json
X-NexGuard-Proposal: 9b2e4c1a-5d3f-4e8a-b7c6-1f0a2d3e4b5c
X-NexGuard-Timestamp: 1793349243
X-NexGuard-Nonce: kT9-EXAMPLEnonce2
X-NexGuard-Signature: v1=a81d…
{
"version": "1",
"proposal_id": "9b2e4c1a-5d3f-4e8a-b7c6-1f0a2d3e4b5c",
"action": "require_step_up",
"target": { "kind": "account", "value": "user-42" },
"approved_at": "2026-10-30T09:20:41+00:00",
"expires_at": "2026-10-30T10:20:41+00:00"
}action | target.kind | What your system does |
|---|---|---|
flag_account | account | Mark the account for a second look. Nothing changes for the person. |
queue_for_review | account | Put it in front of one of your reviewers. |
require_step_up | account | Ask for extra proof (for example a one-time code) on the next attempt. |
force_reauthentication | account | End current sessions so the next action needs a fresh sign-in. |
revoke_sessions | account | End every session now. |
throttle_origin | ip | Slow requests from an address without cutting it off. |
block_device_signup | device | Stop a device creating more accounts. |
block_origin | ip | Refuse an address entirely, for a bounded time. |
suspend_account | account | Suspend the account until a person restores it. |
target.value is the identifier you sent in the event's subject — your own user id, an IP address or a device id — so you can act on it without a lookup.
How your answer is read
2xx— done. Recorded as delivered.4xx— your system declined. Recorded as refused; it is your decision and is not argued with.5xx, a timeout or a redirect — unknown. The request may have arrived, so it is not retried automatically: retrying could suspend somebody twice. It shows in the console for a person to check.
Rules for your endpoint
- Treat
X-NexGuard-Proposalas an idempotency key. The same id twice is one instruction. - Do not act after
expires_at: refuse with a4xxinstead. - Refuse any
actionyou have not implemented with a4xx. New actions may be added; unknown fields in the body can be ignored.