Every webhook Capa sends is signed with your webhook secret, so you can confirm that it comes from Capa and was not modified. Each delivery carries two signatures:
Both are HMAC-SHA256, hex-encoded (lowercase), keyed with your webhook secret. We recommend verifying
capa-signature-v2: it also binds the timestamp and delivery id, so you can reject old or replayed deliveries.
Step 1: Keep the Raw Body
Configure your framework to give you the unparsed body for the webhook route. For example, in Express:Step 2: Compute the Expected Signature
- Key: your webhook secret, used as-is as a UTF-8 string. It looks like a hex string, but do not hex-decode it.
- Message (v2): the
capa-timestampheader, a., thecapa-delivery-idheader, a., then the raw body. - Message (v1): the raw body alone.
Step 3: Compare in Constant Time
hmac.compare_digest(expected, received).
Step 4: Check the Timestamp (Optional, Recommended)
capa-timestamp is the Unix time in seconds of the delivery attempt and is regenerated on every retry. With capa-signature-v2 you can reject a delivery whose timestamp is too far from your current time (for example more than 5 minutes) to protect against replays. Keep your server clock in sync if you do.
Step 5: Process the Event
- If the signature does not match, reject the request (for example with
401) and do not process it. - If it matches, deduplicate on
capa-delivery-id(the same notification can be delivered more than once), then answer with a2xxstatus. See Delivery Semantics.
Whatβs Next