Skip to main content

Receiving Webhooks

A webhook receiver is one HTTP route. Budget Thing POSTs a JSON body to it, signs the request, and treats any 2xx answer as success.

This page describes the request and the guarantees around it. The signature itself is covered in Verifying Webhook Signatures, and you should implement both before you trust a payload.

The request​

Every delivery is:

POST /your/webhook/path HTTP/1.1
Content-Type: application/json
Accept: application/json
User-Agent: BudgetThing-Webhooks/1.0
BudgetThing-Webhook-Id: whd_4Bn8Rk2Xm7Qd5Vz1Lp9Wsk
BudgetThing-Webhook-Timestamp: 1789499532
BudgetThing-Webhook-Signature: v1=3f0b2c9d7e5a1846bd4c0f7a2e9b6d13c8a5f2e4b7d90c1a6f3e8b5d2c7a4091
BudgetThing-Webhook-Event: transaction.created
BudgetThing-Webhook-Event-Id: evt_6Hn2Kq9Xd4Rb7Mz3Wt1Vpf
BudgetThing-Webhook-Api-Version: 2026-09-01
HeaderWhat it carries
BudgetThing-Webhook-IdThe delivery id (whd_…). One attempt series to one endpoint.
BudgetThing-Webhook-TimestampWhen the delivery was signed, as Unix seconds. Part of the signed message.
BudgetThing-Webhook-SignatureOne or more v1=<hex> signatures, separated by spaces.
BudgetThing-Webhook-EventThe event type, for example transaction.created.
BudgetThing-Webhook-Event-IdThe application event id (evt_…), the same value as id in the body.
BudgetThing-Webhook-Api-VersionThe payload contract version, currently 2026-09-01.

Each attempt is given 10 seconds in total — connection, request and response. A slower answer is recorded as a timeout and retried.

Delivery id and event id are different things​

This distinction matters more than any other header:

Delivery idEvent id
HeaderBudgetThing-Webhook-IdBudgetThing-Webhook-Event-Id
Prefixwhd_evt_
IdentifiesOne delivery to one endpointOne thing that happened in the workspace
Changes on a retryNo — retries reuse the deliveryNo
Changes on a redeliveryYes — a new delivery record is createdNo
Differs per endpointYesNo

So the event id is the stable, logical identity of the change: two endpoints receive the same event id, and a manual redelivery months later still carries it. Deduplicate your business logic on the event id. Use the delivery id to identify the individual HTTP delivery — in logs, when matching a row in the delivery history, or to drop a retry of a delivery you have already answered.

The event envelope​

Every payload, whatever the event type, has the same outer shape:

{
"id": "evt_6Hn2Kq9Xd4Rb7Mz3Wt1Vpf",
"type": "transaction.created",
"api_version": "2026-09-01",
"created_at": "2026-09-15T18:32:12.123Z",
"workspace_id": "wks_3fQ0mZk8Xr2Lp9Va6Ne1Ty",
"actor": {
"type": "user",
"id": "usr_7Hn4Wc2Qd8Rk1Ub5Jm3Zx"
},
"object": {
"type": "transaction",
"id": "txn_5Kd9Pw3Mb7Rq2Nx8Hj4Zt"
},
"data": {
"transaction": {
"id": "txn_5Kd9Pw3Mb7Rq2Nx8Hj4Zt",
"kind": "expense",
"account_id": "acct_8Vb2Nq6Xz1Wm4Kd7Rj9Lt",
"payee_id": "vnd_2Rt7Km4Xb9Nz3Wq6Hd1Lp",
"amount_minor": 425000,
"transaction_date": "2026-09-15",
"memo": "January invoice",
"is_cleared": false,
"is_reconciled": false,
"splits": [
{
"id": "spl_2Kd7Pw4Mb9Rq3Nx6Hj1Zt",
"category_id": "cat_5Hn8Kq2Xd7Rb4Mz9Wt3Vp",
"category_name": "Utilities",
"amount_minor": 425000
}
],
"tags": [],
"journal_entry_id": "jrn_7Wq4Jm1Xn8Rd5Vz2Kp6Bh"
}
}
}
FieldAlways presentWhat it holds
idyesThe stable application event id. The deduplication key.
typeyesThe event type. A stable contract value, never localized.
api_versionyesThe version of the payload contract the event was produced under.
created_atyesWhen the change occurred, RFC 3339 in UTC. Use it to order events.
workspace_idyesThe workspace that produced the event.
actoryesWho caused it: {"type": "user" | "system" | "integration", "id": "…"}. id is absent for a system actor.
objectyesThe primary resource: {"type": "transaction", "id": "txn_…"}. id is absent for an event that is not about a single resource.
datayesThe event-specific payload. Its shape depends on type.
correlation_idnoGroups every event produced by one logical operation.
causation_idnoThe event that caused this one, when applicable.

correlation_id and causation_id are omitted when there is nothing to report, like every other optional field on the wire — read defensively rather than expecting null.

Grouping related events

One action often produces several events. Where Budget Thing can tell that a set of events came from the same logical operation, it stamps them with the same correlation_id; where one event was caused by another, causation_id names the earlier event. Both are hints for grouping activity in your own system, and both are optional — never require them.

Inside data​

data carries a snapshot of the resource as it stood when the event happened, keyed by the resource name — transaction above. A snapshot is not a reference: a transaction.deleted event still describes the transaction in full, because the row is gone by the time you read it, and a redelivered event describes the resource as it was, not as it is now.

Snapshots hold stored values only. Dates are YYYY-MM-DD, and computed display values such as formatted amounts, payee labels or running balances are deliberately absent — read them from the API when you need them.

Amounts in events​

Every amount in an event (any field ending in _minor, such as amount_minor, expected_amount_minor or ending_balance_minor) is an integer at a fixed scale of 4: ten-thousandths of a currency unit, whatever the workspace's currency or currencyPrecision. Divide by 10,000 to get currency units: the $42.50 expense above arrives as 425000.

const amount = envelope.data.transaction.amount_minor / 10000; // 42.5
Events differ from the REST API

REST responses scale amounts to the workspace: amountMinor and Money.minor follow the workspace's currencyPrecision, so the same $42.50 is 4250 from GET .../transactions in a two-decimal workspace (see Amounts and dates). Events don't, because they are durable records: a workspace can change its precision later, and a fixed scale means a past event reads the same way no matter when you process it. Don't reuse REST amount handling for event payloads.

The rule is the same for webhooks, the event history and the event stream, which all carry the same envelope.

Update events additionally carry changes, with one entry per field that actually moved:

{
"type": "transaction.updated",
"data": {
"transaction": {"id": "txn_5Kd9Pw3Mb7Rq2Nx8Hj4Zt", "amount_minor": 510000},
"changes": {
"amount_minor": {"old": 425000, "new": 510000},
"memo": {"old": "January invoice", "new": "January invoice (revised)"}
}
}
}

A field that did not change is absent from changes, so you can react to a re-priced transaction without diffing two snapshots yourself.

What to respond​

Any 2xx status means Budget Thing considers the delivery successful — 200 and 204 are both fine, and the response body is ignored (only the first 4 KiB is kept, for the delivery history).

A receiver should:

  1. read the raw body and verify the signature;
  2. check whether it has already processed this event id, and stop if it has;
  3. enqueue the event, or do the small amount of work that is genuinely fast;
  4. return 2xx immediately.
Do not do slow work before answering

The attempt is abandoned after 10 seconds, and the delivery is then retried — so a slow handler turns one event into several deliveries of the same event, all of them still working. Acknowledge first, process afterwards.

Anything that is not 2xx is a failure and is retried, including 3xx: redirects are not followed. If you must move the endpoint, register the new URL rather than redirecting to it.

Delivery guarantees​

What the delivery pipeline promises, and what it deliberately does not:

GuaranteeWhat it means for your receiver
AsynchronousEvents are published when the change is committed and delivered by a background worker. The API call that caused the event does not wait for you.
DurableA delivery is recorded before it is attempted, so it survives a restart and is not lost if your endpoint is down.
At least onceThe same event may arrive more than once. Deduplicate.
RetriedA failure is retried with backoff, then marked failed. See Webhook Deliveries.
UnorderedA later event may arrive before an earlier one.
ConcurrentSeveral deliveries to the same endpoint can be in flight at once.

At least once, never exactly once​

Retries, redeliveries and network failures where your 2xx never arrived all mean the same event can reach you twice. Make the handler idempotent:

  • keep a record of processed id values, and return 2xx without re-applying anything when you see one again;
  • give that record a retention window longer than the retry schedule — a day or two covers the full 24-hour final retry, and longer if you also want manual redeliveries to be caught;
  • if you deduplicate on the delivery id instead, you will process a manual redelivery a second time, because a redelivery is a new delivery of the same event.

Ordering is not guaranteed​

Do not treat arrival order as the order things happened. A retried delivery arrives minutes or hours after later events, and concurrent delivery can reorder two events that were published a moment apart.

Order on created_at, or on the state of the resource itself:

  • ignore an update whose created_at is older than the state you have already stored;
  • for anything where the current value matters more than the history, read the resource back from the API on receipt and store that;
  • never assume a *.created event arrives before the *.updated event for the same resource.

Concurrency​

Budget Thing may have several requests to your endpoint in flight at the same time, including two attempts for different events about the same resource. Handlers must be safe to run concurrently: guard per-resource work with a lock or a queue keyed on the resource id, and make the deduplication check atomic rather than a read followed by a write.

Security checklist​

  • Serve the endpoint over HTTPS, with a valid certificate.
  • Keep the signing secret server-side — never in client code, never in source control.
  • Verify the signature on every request, before you look at the body.
  • Verify against the raw body bytes, not a re-serialized copy.
  • Compare signatures in constant time.
  • Reject stale timestamps — a tolerance of a few minutes is right.
  • Deduplicate on the event id, and keep handlers idempotent.
  • Return 2xx promptly and do the work afterwards.
  • Rotate the signing secret periodically, and after any suspected exposure.
  • Never log a full signing secret; log secretPrefix and the delivery id instead.
  • Do not rely on the source IP address as authentication. The signature is the authentication.

Next​