This page covers alert webhooks — notifications for error rate, latency, and cost threshold breaches. Looking for prompt webhooks (
version.created, label.assigned, version.deleted)? See Prompts → Webhooks.Webhooks are available on the Scale plan. On Pro and Team, email notifications are available but webhook delivery is not.
Configuring a webhook URL
Webhook URLs are set per alert rule. When creating or editing an alert rule in Dashboard → Alerts, enter your endpoint URL in the Webhook URL field. The URL must:- Use HTTPS
- Accept POST requests
- Respond with a 2xx status code within 10 seconds
Payload schema
When an alert fires, Zespan sends a POST request withContent-Type: application/json and the following body:
string
Always
"alert.fired" for alert webhooks.string
The ID of the alert rule that triggered.
string
The human-readable name of the alert rule, as set in the dashboard.
string
The metric that crossed the threshold:
error_rate, cost_usd, latency_ms, request_count, or token_count.string
The comparison that triggered:
">" or "<".number
The configured threshold value.
number
The actual metric value at the time of firing.
number
The aggregation window in minutes.
string
ISO 8601 UTC timestamp when the alert fired.
string
Direct link to the traces page for this project — include this in your Slack message for one-click investigation.
string
HMAC-SHA256 signature for verifying the payload. See below.
Verifying the signature
Every webhook payload includes asignature field in the format sha256=<hex_digest>. You should verify this before processing the payload to protect against spoofed requests.
The signature is computed as:
webhook_secret is the signing secret shown once when you configure the webhook URL in the dashboard. Store it as an environment variable.
- Node.js
- Python
Use the raw request body (Buffer) for signature verification, not the parsed JSON object. Parsing changes whitespace and field ordering, which invalidates the signature.
Delivery guarantees
If all 3 delivery attempts fail, the webhook is marked as failed and no further retries are made. You can see failed deliveries in Dashboard → Alerts → Webhook history.
Integration examples
Slack
Post a formatted message to a Slack channel using an incoming webhook:PagerDuty
Create a PagerDuty incident from an alert:Testing your webhook endpoint
Use the Test webhook button in the alert rule editor to send a sample payload to your endpoint. The test payload usescurrent_value equal to threshold + 1 so your handler can distinguish it from real alerts if needed (the fired_at timestamp will also be clearly recent).
Alternatively, use a tool like webhook.site to inspect raw payloads during development before wiring up your real handler.
