Webhooks
Receive signed Events at your own endpoint as things happen in your Account.
A webhook sends an HTTPS POST to your endpoint each time an Event you chose happens, such as ledger_entry.posted when money moves in a Fund. Each delivery is signed under Standard Webhooks, so you can check it came from Daffodil with any Standard Webhooks library.
Add a webhook
An Admin on your Account adds webhooks in Mission Control, under Settings → Destinations → Webhooks.
- Select Add webhook and enter your endpoint URL.
- Choose the Events it receives. Every Event is listed in the reference.
- Copy the signing secret, which starts with
whsec_. It is shown only once. Store it with your other secrets.
The URL must start with https:// and resolve to a public address. Daffodil refuses URLs with credentials in them and URLs at private, loopback, or link-local addresses, both when you save the URL and each time it sends.
From the same page you can edit a webhook's URL and Events, disable it, rotate its secret, or delete it. Each webhook has a delivery log with every attempt and its response.
The Event envelope
The request body is an Event. Every Event has the same four fields, and data.object is the API object exactly as GET returned it when the Event happened:
{
"id": "evt_2qImcJpR8479lCVSUosM0S",
"type": "ledger_entry.posted",
"created_at": "2026-11-11T21:42:00Z",
"data": {
"object": {
"id": "le_1Ji3bmQbexJ4j64cam7eFp",
"fund_id": "fund_2JqSDJkaCfO4pnMMD5na5G",
"type": "contribution",
"amount": 25000,
"currency": "USD",
"balance_after": 1250000,
"posted_at": "2026-11-11T21:42:00Z",
"effective_at": "2026-11-11T21:40:00Z",
"source": { "type": "contribution", "id": "contrib_4jV68U95QzmwbX04gqFKu5" }
}
}
}| Field | Description |
|---|---|
id | Unique per Event. The same value is sent in the webhook-id header. |
type | What happened, such as ledger_entry.posted. Branch on this. |
created_at | When the Event happened, in UTC. |
data.object | A snapshot of the object at that moment. A retry or replay sends the same snapshot, even if the object has changed since. To act on the latest state, GET the object by its id. |
Handle Event types you do not recognize by ignoring them with a 2xx. New types are added within /v1.
Verify signatures
Each request has three headers:
| Header | Description |
|---|---|
webhook-id | The Event's id. |
webhook-timestamp | Unix seconds when this attempt was signed. |
webhook-signature | v1, then the base64 HMAC-SHA256 of {webhook-id}.{webhook-timestamp}.{body}. The key is the base64-decoded part of your secret after whsec_. The header can hold more than one space-separated signature; accept the request if any of them matches. |
Verify against the raw request body, byte for byte, before you parse it. Reject requests whose timestamp is more than five minutes from your clock, so a captured request cannot be replayed later.
import express from 'express';
import { Webhook } from 'standardwebhooks';
const webhook = new Webhook(process.env.DAFFODIL_WEBHOOK_SECRET);
const app = express();
app.post('/webhooks/daffodil', express.raw({ type: 'application/json' }), (req, res) => {
let event;
try {
// Checks the signature and the five-minute timestamp window.
event = webhook.verify(req.body.toString('utf8'), req.headers);
} catch {
return res.status(400).end();
}
// Queue the work, then answer quickly.
res.status(200).end();
});import base64, hashlib, hmac, os, time
SECRET = base64.b64decode(os.environ["DAFFODIL_WEBHOOK_SECRET"].removeprefix("whsec_"))
def verify(body: bytes, headers) -> bool:
msg_id = headers["webhook-id"]
timestamp = headers["webhook-timestamp"]
if abs(time.time() - int(timestamp)) > 300:
return False
signed = f"{msg_id}.{timestamp}.".encode() + body
expected = base64.b64encode(hmac.new(SECRET, signed, hashlib.sha256).digest()).decode()
return any(
hmac.compare_digest(expected, sig.removeprefix("v1,"))
for sig in headers["webhook-signature"].split(" ")
if sig.startswith("v1,")
)Respond, retries, and failures
Answer with any 2xx status within 15 seconds. Anything else counts as a failure: another status, a timeout, or a refused connection. Redirects are not followed, so a 3xx is a failure too.
A failed delivery is retried with backoff, eight attempts in all over about 28 hours:
| Attempt | After the previous one |
|---|---|
| 1 | Right away |
| 2 | 5 seconds |
| 3 | 5 minutes |
| 4 | 30 minutes |
| 5 | 2 hours |
| 6 | 5 hours |
| 7 | 10 hours |
| 8 | 10 hours |
After the eighth failure the delivery is marked Failed in the delivery log. Disabling a webhook stops its new deliveries and cancels its pending retries.
Every attempt sends the stored Event unchanged, with the same webhook-id. Only webhook-timestamp and webhook-signature are new, signed with the webhook's current secret.
Replay
An Admin can replay any delivery from the webhook's delivery log in Mission Control. A replay sends the original Event again, with the same webhook-id and data.object snapshot, as one more logged attempt. Use it after you fix your endpoint, to recover deliveries that failed.
Build an idempotent receiver
Daffodil delivers each Event at least once, and does not guarantee order. Retries, replays, and network failures can bring the same Event to you more than once, and a later Event can arrive before an earlier one.
- Drop duplicates by
webhook-id. Record eachidyou have processed, with a unique constraint, in the same transaction as the work it triggers. If theidis already there, answer200and do nothing. - Answer fast, work later. Verify, record the Event, answer
2xx, then do slow work in a background job. A slow response is retried as a failure. - Do not rely on order. Compare timestamps such as
posted_at, orGETthe object for its current state, before you overwrite newer data with an older snapshot.
Rotate the secret
Select Rotate secret on the webhook in Mission Control. The new secret is shown once, and takes effect right away: every attempt from then on, retries included, is signed with it. Update your endpoint's secret as soon as you rotate.