User Webhooks
Create and manage webhooks to receive real-time notifications when debates complete, verdicts are delivered, and more.
Webhooks let you receive HTTP POST notifications whenever key events occur in your AskVerdict account — such as when a debate finishes or an outcome is recorded. Each delivery is signed with HMAC-SHA256 so you can verify requests are authentic.
HTTPS Required
Webhook URLs must use https://. Plain HTTP endpoints are rejected at creation time.
Webhook Events
When creating or updating a webhook, you subscribe to one or more of the following events:
| Event | Fired when |
|---|---|
debate.created | A new debate is created |
debate.completed | A debate finishes and a verdict is available |
debate.failed | A debate fails due to an engine or provider error |
outcome.recorded | A real-world outcome is recorded against a debate |
outcome.updated | An existing outcome is updated |
chain.created | A new debate chain is created |
chain.updated | A debate chain is updated |
Payload Signature Verification
Every webhook delivery includes an X-Verdict-Signature header containing an HMAC-SHA256 hex digest of the raw request body, signed with your webhook's secret.
Store Your Secret Securely
The signing secret is returned once at creation time and is never exposed again. If you lose it, delete the webhook and create a new one.
import { createHmac } from "crypto";
function verifySignature(
rawBody: string,
signature: string,
secret: string
): boolean {
const expected = createHmac("sha256", secret)
.update(rawBody)
.digest("hex");
return expected === signature;
}
// In your webhook handler:
const sig = req.headers["x-verdict-signature"];
const body = await req.text(); // raw body before parsing
if (!verifySignature(body, sig, process.env.WEBHOOK_SECRET)) {
return new Response("Unauthorized", { status: 401 });
}Endpoints
List Webhooks
/api/webhooksList all webhooks registered for the authenticated user, plus the supported event types.
No request body or query parameters required.
Secret Not Returned on List
The secret field is omitted from list responses. It is only returned once — immediately after creation.
Create Webhook
/api/webhooksRegister a new webhook endpoint. Returns the signing secret exactly once.
| Name | Type | Required | Description |
|---|---|---|---|
url | string | Required | HTTPS endpoint to receive event payloads. Must start with 'https://'. |
events | string[] | Required | Array of event names to subscribe to. At least one event required. See the event table above for valid values. |
description | string | Optional | Human-readable label for this webhook. Max 500 characters. |
curl -X POST https://api.askverdict.ai/api/webhooks \
-H "Authorization: Bearer vrd_your_api_key" \
-H "Content-Type: application/json" \
-d '{
"url": "https://myapp.example.com/hooks/askverdict",
"events": ["debate.completed", "debate.failed"],
"description": "Production webhook"
}'Error Responses
| Code | Error | Description |
|---|---|---|
400 | VALIDATION_ERROR | URL is not HTTPS, events array is empty, or contains unknown event names |
401 | UNAUTHORIZED | Invalid or missing API key |
Update Webhook
/api/webhooks/:idUpdate an existing webhook's URL, event subscriptions, active state, or description.
Path Parameters
| Parameter | Type | Description |
|---|---|---|
id | string | The webhook ID |
All body fields are optional. Only supplied fields are updated.
| Name | Type | Required | Description |
|---|---|---|---|
url | string | Optional | New HTTPS endpoint URL. Must start with 'https://'. |
events | string[] | Optional | Replacement list of subscribed event names. Must contain at least one event. |
active | boolean | Optional | Set to false to pause deliveries without deleting the webhook. Set to true to resume. |
description | string | null | Optional | Updated description. Max 500 characters. Pass null to clear. |
curl -X PUT https://api.askverdict.ai/api/webhooks/wh_abc123def456 \
-H "Authorization: Bearer vrd_your_api_key" \
-H "Content-Type: application/json" \
-d '{
"events": ["debate.completed", "outcome.recorded", "outcome.updated"],
"active": true
}'Error Responses
| Code | Error | Description |
|---|---|---|
400 | VALIDATION_ERROR | Invalid URL, empty events array, or unknown event name |
404 | NOT_FOUND | Webhook not found or does not belong to authenticated user |
Delete Webhook
/api/webhooks/:idPermanently delete a webhook and all its delivery history.
Path Parameters
| Parameter | Type | Description |
|---|---|---|
id | string | The webhook ID |
Delivery History Deleted
Deleting a webhook also deletes all delivery log entries via cascading foreign key. This cannot be undone.
Delivery History
List Deliveries
/api/webhooks/:id/deliveriesList delivery attempts for a webhook, with status and response details.
Path Parameters
| Parameter | Type | Description |
|---|---|---|
id | string | The webhook ID |
Query Parameters
| Parameter | Type | Default | Max | Description |
|---|---|---|---|---|
limit | integer | 20 | 100 | Number of delivery records to return |
offset | integer | 0 | — | Number of records to skip (for pagination) |
curl "https://api.askverdict.ai/api/webhooks/wh_abc123def456/deliveries?limit=20&offset=0" \
-H "Authorization: Bearer vrd_your_api_key"Automatic Retries
AskVerdict automatically retries failed deliveries up to 3 times with exponential backoff: 5 seconds, 30 seconds, then 5 minutes. After 3 failures the delivery is marked permanently failed. Use the redeliver endpoint to manually retry at any time.
Redeliver a Delivery
/api/webhooks/:id/deliveries/:deliveryId/redeliverQueue a new delivery attempt based on the original event payload of a previous delivery.
This is useful for re-processing a failed delivery or replaying a specific event after fixing your endpoint.
Path Parameters
| Parameter | Type | Description |
|---|---|---|
id | string | The webhook ID |
deliveryId | string | The delivery record ID to re-trigger |
No request body required.
curl -X POST \
"https://api.askverdict.ai/api/webhooks/wh_abc123def456/deliveries/del_uvw321/redeliver" \
-H "Authorization: Bearer vrd_your_api_key"The deliveryId in the response is the ID of the newly queued attempt. Poll the deliveries list to check its outcome.
Error Responses
| Code | Error | Description |
|---|---|---|
404 | NOT_FOUND | Webhook or delivery not found, or does not belong to authenticated user |
Send Test Ping
/api/webhooks/:id/testSend a synthetic test event to your webhook endpoint to verify connectivity and signature verification.
The test ping sends a ping event with a minimal payload. It is recorded in your delivery history like any other delivery.
Path Parameters
| Parameter | Type | Description |
|---|---|---|
id | string | The webhook ID |
No request body required.
curl -X POST https://api.askverdict.ai/api/webhooks/wh_abc123def456/test \
-H "Authorization: Bearer vrd_your_api_key"Error Responses
| Code | Error | Description |
|---|---|---|
404 | NOT_FOUND | Webhook not found or does not belong to authenticated user |
Was this page helpful?