Create a webhook
Have events sent to a URL of yours as they happen. Free.
POST https://api.won.dev/v1/webhooks
Has events sent to a URL of yours as they happen, as a JSON POST with the same object GET /events returns. Answer with any 2xx within 10 seconds; anything else is tried again, eight times over about a day, and an endpoint that fails for three days is switched off. The same event can arrive twice: tell them apart by id. Each delivery carries Won-Signature: t=<unix time>,v1=<hex>, where the hex is the HMAC-SHA256 of <t>.<raw body> with the signing_secret this call returns. The secret is shown this once. * means every type except the frequent ones (email.sent, email.opened, email.clicked), which are only sent when named. Up to 10 webhooks. A webhook made with a test key gets the events of the sandbox, and only those. Free.
- Billing: Free.
Parameters
Parameters go in the JSON body.
| Parameter | Type | Required | Description |
|---|---|---|---|
url | string | yes | Where to send events: an https:// URL that is reachable from the internet. |
events | (* | sender.approved | sender.rejected | campaign.started | campaign.paused | campaign.resumed | campaign.completed | campaign.canceled | email.sent | email.opened | email.clicked | email.bounced | reply.received | recipient.unsubscribed | account.suspended | task.completed)[] | no | The types to send, such as ["reply.received", "email.bounced"]. Default ["*"]. Default: *. |
campaign_id | string | no | Only events of this campaign. |
metadata | object | no | Your own keys and values, such as {"customer_id": "c_812"}: up to 20 keys of at most 40 characters, each value a string of at most 500. Returned with the webhook. Events do not carry it: the same event goes to every webhook. |
Response
Errors are described in Errors.
| Field | Type | Description |
|---|---|---|
data | object | The webhook, with the secret its deliveries are signed with. |
data.id | string | Webhook ID, such as whk_2m9x7p1q8w3e5r4k. |
data.url | string | |
data.events | string[] | |
data.campaign_id | string | null | |
data.status | enabled | disabled | |
data.disabled_reason | string | null | |
data.metadata | object | Your own keys and values, as you gave them. Empty when none were. |
data.created_at | string | When it was created, as an ISO 8601 time in UTC. |
data.signing_secret | string | The key deliveries are signed with. Store it now: it is not shown again. |
notice | string | null | A plain sentence when there is something to know about this answer. Null otherwise. |
usage | object | Nothing is charged here. The balance, for reference. |
usage.cost | number | What this call cost, in US dollars. |
usage.balance | number | The balance left after this call, in US dollars. |
usage.replayed | boolean | True when this is a repeat of a request from the last 24 hours. Repeats are free. |
Example
curl https://api.won.dev/v1/webhooks \
-H "Authorization: Bearer $WON_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"url": "https://agent.example/hooks/won",
"events": [
"reply.received",
"email.bounced"
]
}'{
"data": {
"id": "whk_2m9x7p1q8w3e5r4k",
"url": "https://agent.example/hooks/won",
"events": [
"reply.received",
"email.bounced"
],
"campaign_id": null,
"status": "enabled",
"disabled_reason": null,
"metadata": {},
"created_at": "2026-11-18T13:58:00.000Z",
"signing_secret": "whsec_4Zb1rW8sQ0nT7vYcK3mL9xDfH2gJ6pA5"
},
"notice": null,
"usage": {
"cost": 0,
"balance": 48.08,
"replayed": false
}
}A test key (won_test_...) runs this in the sandbox: nothing is sent and nothing is charged.