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
- Resolve to a public internet address, and answer directly rather than with a
3xxredirect — redirects are not followed, so a redirect fails the delivery
Webhook URLs and signing secrets are stored encrypted. After you save a rule, the dashboard and API show the URL as its host followed by a hidden marker, and never show the signing secret again. Save the rule without editing the field to keep it; enter the URL again to replace it.
Payload schema
When an alert fires, Zespan sends a POST request withContent-Type: application/json and the following body:
The metric that crossed the threshold:
error_rate, cost_usd, latency_ms, request_count, or token_count.Direct link to the traces page for this project — include this in your Slack message for one-click investigation.
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.
