Skip to Content
Won.dev

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.

ParameterTypeRequiredDescription
urlstringyesWhere 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)[]noThe types to send, such as ["reply.received", "email.bounced"]. Default ["*"]. Default: *.
campaign_idstringnoOnly events of this campaign.
metadataobjectnoYour 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.

FieldTypeDescription
dataobjectThe webhook, with the secret its deliveries are signed with.
data.idstringWebhook ID, such as whk_2m9x7p1q8w3e5r4k.
data.urlstring
data.eventsstring[]
data.campaign_idstring | null
data.statusenabled | disabled
data.disabled_reasonstring | null
data.metadataobjectYour own keys and values, as you gave them. Empty when none were.
data.created_atstringWhen it was created, as an ISO 8601 time in UTC.
data.signing_secretstringThe key deliveries are signed with. Store it now: it is not shown again.
noticestring | nullA plain sentence when there is something to know about this answer. Null otherwise.
usageobjectNothing is charged here. The balance, for reference.
usage.costnumberWhat this call cost, in US dollars.
usage.balancenumberThe balance left after this call, in US dollars.
usage.replayedbooleanTrue 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.

On this page