1. Find a calculator
  2. Enter numbers and units
  3. Read and trust the result
  4. Save, share and embed
  5. Build with the API
  6. Account and plan
  7. Privacy and your data
  8. Fix a problem

Verifying a webhook signature

Build the string t.body from the X-CalcLib-Signature header, compute HMAC-SHA256 with your secret, and compare before you act on the delivery.

API tokens, usage, the MCP server for AI agents, and webhooks.

A webhook endpoint added in Webhooks receives a signed POST each time someone runs your embed. Every delivery carries an X-CalcLib-Signature header of the form t=<unix time>,v1=<signature>.

Verify before you parse

  1. Read the raw request body. Parsing and re-serialising the JSON changes the bytes, and the signature will never match.
  2. Take t from the header and build the string t.body: the timestamp, a dot, then the raw body.
  3. Compute HMAC-SHA256 of that string with your endpoint secret, as hex.
  4. Compare it with each v1 value in constant time. While you rotate a secret, the header can carry two v1 values; either may match.
  5. Reject the delivery if t is more than 5 minutes from your clock.

Deliveries that fail

They are retried after 1 minute, 5 minutes, 30 minutes, 2 hours and 8 hours. An endpoint that fails 20 times in a row is disabled and we email you, following the product switch in Notifications.

Was this article helpful?

Still stuck? Contact support · Help centre