> ## Documentation Index
> Fetch the complete documentation index at: https://docs.canaryedge.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Webhooks

> Get notified when anomalies are detected

Configure webhooks to receive real-time notifications when Canary Edge detects anomalies.

## Setup via Dashboard

1. Go to [canaryedge.com/dashboard/settings](https://canaryedge.com/dashboard/settings)
2. Click the **Webhooks** tab
3. Enter your webhook URL
4. Select which events to receive:
   * `anomaly.detected` — fired when an anomaly is flagged
   * `regime.changed` — fired when a machine transitions between regimes (e.g., HEALTHY → ACTIVE)
   * `baseline.created` — fired when a new baseline is set for a machine
5. Click **Save**

## Expected Payload

When an event fires, Canary Edge sends a POST request to your endpoint:

```json theme={null}
{
  "event": "anomaly.detected",
  "timestamp": "2026-03-15T14:30:00Z",
  "data": {
    "machine_id": "pump-assembly-1",
    "regime": "SHOCK",
    "energy": 4.52,
    "z_score": 12.5,
    "point_timestamp": "2026-03-15T14:30:00Z",
    "value": 45.2
  }
}
```

## Verification

Verify webhook authenticity using the HMAC-SHA256 signature in the `X-Canary-Signature` header:

```python theme={null}
import hmac
import hashlib

def verify_webhook(payload: bytes, signature: str, secret: str) -> bool:
    expected = hmac.new(
        secret.encode(), payload, hashlib.sha256
    ).hexdigest()
    return hmac.compare_digest(f"sha256={expected}", signature)
```

## Retry Policy

Failed deliveries are retried with exponential backoff: 1min, 5min, 30min, 2hr. After 4 failures, the webhook is disabled and you receive an email notification.

## Email Notifications

As an alternative to webhooks, you can enable email notifications in the **Notifications** tab of your dashboard settings. Options include:

* Anomaly alerts (immediate)
* Weekly summary reports
* Usage warnings (approaching plan limits)
