Security
Verify signatures
Verify Hooks outbound webhooks with the Standard Webhooks libraries or the legacy x-hooks scheme, and rotate the workspace signing secret without downtime.
Outbound deliveries can be signed with the workspace signing secret (Settings → Security). Each destination chooses one of two formats:
| Format | Default for | Headers |
|---|---|---|
standard-webhooks |
New destinations | webhook-id, webhook-timestamp, webhook-signature |
hooks |
Existing destinations | x-hooks-timestamp, x-hooks-delivery, x-hooks-signature |
Change the format per destination in the console (Auth tab → Workspace signature format) or with PATCH /v1/destinations/{id} and {"signingFormat": "hooks"}. Destinations that set their own signature header are never signed.
Standard Webhooks (recommended)
Section titled “Standard Webhooks (recommended)”Hooks follows the Standard Webhooks specification, the same scheme used by Svix. The signature is:
v1,<base64 HMAC-SHA256(secret, "<webhook-id>.<webhook-timestamp>.<raw body>")>webhook-id— the delivery ID, stable across retries.webhook-timestamp— Unix seconds. Reject requests older than five minutes.webhook-signature— one or more space-separatedv1,signatures. During secret rotation Hooks sends both the new and the previous signature; accept a request when any signature matches.
The signing secret starts with whsec_; the remainder is base64. Use the official library so secret decoding and constant-time comparison match the spec.
// npm install standardwebhooksimport { Webhook } from "standardwebhooks";
const webhook = new Webhook(process.env.HOOKS_SIGNING_SECRET);
export function verify(rawBody, headers) { // Throws WebhookVerificationError on a bad signature or stale timestamp. return webhook.verify(rawBody, headers);}# pip install standardwebhooksfrom standardwebhooks import Webhook
webhook = Webhook(os.environ["HOOKS_SIGNING_SECRET"])
def verify(raw_body: bytes, headers: dict[str, str]): # Raises WebhookVerificationError on a bad signature or stale timestamp. return webhook.verify(raw_body, headers)Pass the raw request body bytes. Re-serializing JSON can change whitespace or key order and break the signature.
Legacy hooks format
Section titled “Legacy hooks format”Existing destinations keep the original headers:
x-hooks-timestamp— Unix seconds.x-hooks-delivery— the delivery ID.x-hooks-signature— lowercase hex HMAC-SHA256 of<timestamp>.<deliveryId>.<raw body>, using the workspace secret string as the key.
const crypto = require("node:crypto");
function verify(rawBody, headers, secret) { const timestamp = headers["x-hooks-timestamp"]; const deliveryId = headers["x-hooks-delivery"]; const expected = crypto .createHmac("sha256", secret) .update(`${timestamp}.${deliveryId}.${rawBody}`) .digest("hex");
const received = Buffer.from(headers["x-hooks-signature"] ?? "", "hex"); return ( received.length === expected.length / 2 && crypto.timingSafeEqual(received, Buffer.from(expected, "hex")) );}Reject timestamps more than five minutes old to limit replay attacks.
Rotating the workspace secret
Section titled “Rotating the workspace secret”- Rotate in Settings → Security. Standard Webhooks destinations now receive two
v1,signatures: the new secret first, the previous secret after it. Legacy destinations receive only the new signature. - Deploy the new secret to your verifiers. Accepting both signatures means no deliveries fail during the transition.
- Finish rotation in Settings → Security (or
POST /v1/project/secret/rotate/complete). The previous signature stops immediately; make sure every verifier knows the new secret first.
The secret is non-sensitive to display but write-only in the API: reads return it only to the workspace owner, and audit logs never record it.
Generic inbound HMAC mode
Section titled “Generic inbound HMAC mode”A generic endpoint with verification mode hmac requires three headers on every request:
| Header | Content |
|---|---|
x-hooks-timestamp |
Unix seconds, when the sender signed the request. |
x-hooks-delivery |
A unique delivery ID, used to deduplicate retries. |
x-hooks-signature |
Lowercase hex HMAC-SHA256 of <timestamp>.<deliveryId>.<raw body>, keyed with the endpoint secret. |
The header names and formula match the legacy hooks outbound format above, so the same verify function works in both directions. Requests whose timestamp is older than five minutes are rejected, as are tampered bodies and wrong secrets — all with 401.
# Replace the endpoint URL and secret with your own values.URL="https://api.hooks.events/in/whk_9f3k1a"SECRET="<endpoint-secret>"BODY='{"type":"order.created","data":{"id":"ord_1042"}}'
T=$(date +%s)ID=$(uuidgen | tr 'A-Z' 'a-z')SIG=$(printf '%s.%s.%s' "$T" "$ID" "$BODY" \ | openssl dgst -sha256 -hmac "$SECRET" -hex \ | awk '{print $NF}')
curl -X POST "$URL" \ -H "Content-Type: application/json" \ -H "x-hooks-timestamp: $T" \ -H "x-hooks-delivery: $ID" \ -H "x-hooks-signature: $SIG" \ -d "$BODY"Set the mode when creating the endpoint (inbound auth: HMAC) or later with PATCH /v1/endpoints/{id} and {"verificationMode": "hmac"}. The quickstart walks through the first event.
Provider-specific inbound schemes
Section titled “Provider-specific inbound schemes”When an endpoint uses a known provider, Hooks verifies the provider’s own signature before accepting the event:
| Provider | Header | Scheme |
|---|---|---|
github |
X-Hub-Signature-256 |
sha256=<hex HMAC of raw body>. |
stripe |
Stripe-Signature |
t=<ts>,v1=<hex HMAC of "<ts>.<body>">, 5-minute tolerance, multiple v1 accepted. |
slack |
X-Slack-Signature |
v0=<hex HMAC of "v0:<ts>:<body>">, 5-minute tolerance. |
linear |
Linear-Signature |
Hex HMAC of the raw body plus a body webhookTimestamp within 60 seconds. |
Provider signatures are checked against the endpoint secret you configured in the console. Standard Webhooks sends the same scheme, so the standard-webhooks source adapter accepts it with webhook-* headers.
Generic endpoints can instead use a shared API key in a header or query parameter, or Basic Auth. See inbound authentication.
Never compare signatures with
==. Use a constant-time function and reject requests whose timestamp is more than five minutes old.