Notification destinations define where STACK sends alerts. Channel rules map events to those destinations. Verify a destination before you add it to a rule.
Notification configuration is restricted to account administrators. Agent and Passport credentials cannot read or change it. A dashboard administrator can make changes directly; an API or OAuth request must be approved in the dashboard and retried with the returnedX-Governance-Approval header.
A destination is a verified address where STACK can send notifications. Three channel types are supported: email, sms, and webhook. Destinations must be verified before they can receive notifications. Every channel is available on the platform subscription; texts are charged from the Wallet at cost.
POST /v1/notifications/destinations
{
"channel_type": "email",
"destination": "alerts@example.com"
}# Email destination
curl -X POST https://api.getstack.run/v1/notifications/destinations \
-H "Authorization: Bearer YOUR_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"channel_type": "email",
"destination": "alerts@example.com"
}'
# Webhook destination
curl -X POST https://api.getstack.run/v1/notifications/destinations \
-H "Authorization: Bearer YOUR_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"channel_type": "webhook",
"destination": "https://example.com/hooks/stack"
}'
# SMS destination
curl -X POST https://api.getstack.run/v1/notifications/destinations \
-H "Authorization: Bearer YOUR_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"channel_type": "sms",
"destination": "+14155551234"
}'{
"id": "ndst_abc123",
"operator_id": "op_abc123",
"channel_type": "email",
"destination": "alerts@example.com",
"verified": false,
"created_at": "2026-04-15T10:00:00.000Z"
}Email destinations are auto-verified if the email matches the operator's registered email. Every other destination, webhook included, requires the two-step verification flow. Creating a webhook returns its webhook_secret once; store it before leaving the response. STACK then POSTs the verification code to the URL, signed with that secret. Read the code from your endpoint and submit it back. Nothing is delivered to an unverified destination.
{
"id": "ndst_webhook123",
"operator_id": "op_abc123",
"channel_type": "webhook",
"destination": "https://example.com/hooks/stack",
"verified": false,
"webhook_secret": "whsec_...",
"created_at": "2026-04-15T10:00:00.000Z"
}GET /v1/notifications/destinations
curl https://api.getstack.run/v1/notifications/destinations \
-H "Authorization: Bearer YOUR_API_KEY"DELETE /v1/notifications/destinations/:id
curl -X DELETE https://api.getstack.run/v1/notifications/destinations/ndst_abc123 \
-H "Authorization: Bearer YOUR_API_KEY"{
"deleted": true
}POST /v1/notifications/destinations/:id/rotate-secret
Replaces a webhook destination's signing secret. The replacement is returned once in the response and is never included when destinations or channel rules are listed.
curl -X POST https://api.getstack.run/v1/notifications/destinations/ndst_webhook123/rotate-secret \
-H "Authorization: Bearer YOUR_API_KEY" \
-H "X-Governance-Approval: gvr_abc123"Verification uses a code. Email and SMS receive the code directly. A webhook receives a signed request containing the code. Submit that code to complete verification.
POST /v1/notifications/destinations/:id/send-code
curl -X POST https://api.getstack.run/v1/notifications/destinations/ndst_abc123/send-code \
-H "Authorization: Bearer YOUR_API_KEY"POST /v1/notifications/destinations/:id/verify
curl -X POST https://api.getstack.run/v1/notifications/destinations/ndst_abc123/verify \
-H "Authorization: Bearer YOUR_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"code": "123456"
}'{
"verified": true
}If the code is invalid or expired, the response includes an error message.
Destinations must be verified before they can be used in notification channel rules. Creating a rule with unverified destinations returns a 400 error.
POST /v1/notifications/destinations/:id/test
Send a test notification to a verified destination to confirm it works correctly.
curl -X POST https://api.getstack.run/v1/notifications/destinations/ndst_abc123/test \
-H "Authorization: Bearer YOUR_API_KEY"Channels are rules that map event types to one or more notification destinations. When a matching event fires, STACK delivers a notification to all destinations on the rule.
POST /v1/notifications/channels
{
"destination_ids": ["ndst_abc123", "ndst_def456"],
"events": ["passport.flagged", "agent.blocked"],
"min_severity": "warning"
}curl -X POST https://api.getstack.run/v1/notifications/channels \
-H "Authorization: Bearer YOUR_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"destination_ids": ["ndst_abc123"],
"events": ["passport.flagged", "passport.blocked", "agent.blocked"],
"min_severity": "warning"
}'{
"id": "nch_abc123",
"operator_id": "op_abc123",
"channel_type": "email",
"destination": "alerts@example.com",
"destination_id": "ndst_abc123",
"destination_ids": ["ndst_abc123"],
"events": ["passport.flagged", "passport.blocked", "agent.blocked"],
"min_severity": "warning",
"verified": true,
"active": true,
"delivers": true,
"delivery_methods": [{ "id": "ndst_abc123", "channel_type": "email", "destination": "alerts@example.com", "verified": true }],
"created_at": "2026-04-15T10:10:00.000Z"
}active is the switch as stored. delivers is true only when the rule is active and has a verified delivery method, so it is the field that says whether the rule is on.
GET /v1/notifications/channels
Returns all channel rules with enriched delivery_methods array containing the full destination objects.
curl https://api.getstack.run/v1/notifications/channels \
-H "Authorization: Bearer YOUR_API_KEY"PATCH /v1/notifications/channels/:id
{
"destination_ids": ["ndst_abc123", "ndst_ghi789"],
"events": ["passport.flagged", "passport.blocked", "agent.blocked", "passport.missed_checkout"],
"min_severity": "info"
}curl -X PATCH https://api.getstack.run/v1/notifications/channels/nch_abc123 \
-H "Authorization: Bearer YOUR_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"events": ["passport.flagged", "agent.blocked"],
"min_severity": "critical"
}'DELETE /v1/notifications/channels/:id
curl -X DELETE https://api.getstack.run/v1/notifications/channels/nch_abc123 \
-H "Authorization: Bearer YOUR_API_KEY"{
"deleted": true
}These are the event types you can use in notification channel rules:
When creating rules without specifying events, the system defaults to all four event types: passport.flagged, passport.blocked, agent.blocked, and passport.missed_checkout.
When a rule fires and delivers to a webhook destination, STACK sends a POST request. Webhook destinations receive a webhook_secret on creation that can be used to verify the payload signature.
{
"id": "msg_Qx7…",
"event_type": "passport.flagged",
"severity": "warning",
"payload": {
"jti": "ppt_abc123",
"agent_id": "agt_xyz",
"flags": [
{
"type": "undeclared_service",
"severity": "warning",
"message": "Agent accessed slack but did not declare it in intent"
}
]
},
"timestamp": "2026-04-15T10:05:00.000Z"
}Every webhook request is signed as a Standard Webhooks message, the same scheme every STACK webhook uses (the full specification is spec/webhooks/SPEC.md). Three headers carry it: webhook-id (the message id, also the body's id), webhook-timestamp (unix seconds) and webhook-signature (one or more v1,<base64> signatures). Each signature is the HMAC-SHA256 of id.timestamp.body, keyed with the bytes of the webhook_secret returned when the destination was created. Refuse a request whose timestamp is more than five minutes from your clock: that is what makes a captured request useless to someone who replays it later.
webhook-id: msg_Qx7…
webhook-timestamp: 1790000000
webhook-signature: v1,3q2+7w…
signature = base64( HMAC_SHA256(key = secret bytes, message = id + "." + timestamp + "." + raw_body) )A secret issued from now on is whsec_ followed by base64; its key is the decoded bytes. A secret you already hold (64 hexadecimal characters) keeps working as it is: pass it to a Standard Webhooks library unchanged. Rotate with POST /v1/notifications/destinations/:id/rotate-secret: the new secret is returned once and the old one keeps signing beside it for 24 hours, so a request then carries two signatures and either secret verifies it.
Verify before acting on the payload, over the raw body (not a re-serialized JSON) so the bytes match what STACK signed. verifyWebhook from @getstackrun/sdk does the whole check in constant time and refuses a stale, tampered or repeated message.
import express from 'express';
import { createReplayGuard, verifyWebhook } from '@getstackrun/sdk';
const SECRET = process.env.STACK_WEBHOOK_SECRET; // your secret, or both while a rotation is live
const replayGuard = createReplayGuard();
const app = express();
// Capture the raw body for verification.
app.use(express.raw({ type: 'application/json' }));
app.post('/webhooks/stack', (req, res) => {
const check = verifyWebhook({ headers: req.headers, body: req.body, secret: SECRET, replayGuard });
if (!check.ok) return res.status(check.reason === 'replayed' ? 204 : 401).end();
// …handle check.payload, keyed on check.id…
res.status(204).end();
});import os
from flask import Flask, request, abort
from getstack import ReplayGuard, WebhookSignatureError, verify_webhook
SECRET = os.environ["STACK_WEBHOOK_SECRET"]
GUARD = ReplayGuard()
app = Flask(__name__)
@app.post("/webhooks/stack")
def stack_webhook():
try:
event = verify_webhook(request.headers, request.get_data(), SECRET, replay_guard=GUARD)
except WebhookSignatureError as error:
if error.reason == "replayed":
return "", 204
abort(401)
# …handle event…
return "", 204Webhook delivery is at most once. Return a 2xx response only after you store the event. STACK does not retry a failed or timed-out delivery.