Skip to main content
All webhook event deliveries are signed to ensure authenticity and integrity. Your endpoint must validate the signature before processing any event. Verification requests (webhook.verification) are not signed.

Transport Requirements

Webhook endpoints must:
  • Use HTTPS
  • Support TLS 1.2 or higher
  • Present a valid certificate
Requests are delivered only over secure connections.

Signature Header

Each event delivery includes the header:
Format:
During secret regeneration, the header may include two signatures:
Where:
  • t is the Unix timestamp (seconds)
  • v1 is generated using the current secret
  • v0 is generated using the previous secret during the transition window
After a secret is rotated, Alvys keeps signing with the previous secret as v0 for 7 days. After 7 days, the header carries only v1.

Signed Payload Format

The signature is generated from:
Important:
  • Use the exact raw request body.
  • Do not reformat or reserialize JSON before verification.
  • Any change to whitespace or formatting will invalidate the signature.

Verification Process

To validate a delivery:
  1. Extract the timestamp from the X-Alvys-Signature header.
  2. Extract the signature value.
  3. Read the raw request body exactly as received.
  4. Construct the signed payload string.
  5. Compute an HMAC-SHA256 hash using your webhook secret as the key.
  6. Encode the hash as lowercase hexadecimal, and compare it to the signature(s) provided.
  7. Process the event only if a match is found.
The HMAC key is the full secret string, including the whsec_ prefix, encoded as UTF-8 bytes. Do not remove the prefix, and do not base64-decode the secret. The signatures in the header are lowercase hexadecimal. Signature comparison should use constant-time comparison to prevent timing attacks.

Replay Protection

It is recommended to reject requests where:
This helps reduce replay risk.

Secret Management

Each webhook has a unique signing secret. The secret:
  • Is generated when the webhook is created.
  • Can be regenerated using the Regenerate Secret Key option in the UI.
  • Should be stored securely.
  • Must never be exposed in client-side code or logs.

If Signature Validation Fails

If the signature cannot be verified:
  • Return HTTP 401 Unauthorized.
  • Do not process the event.
Signature validation must occur before executing any business logic.