1. Home
  2. Platform Guide
  3. ET Agent
  4. Webhook Security

Platform Guide ยท Webhook signature verificationWebhook Security

Every webhook request from Elevating Traders includes an HMAC signature. Verifying this signature on your server confirms the request originated from us. This guide explains how to extract the signature, compute the expected hash, and prevent replay attacks.

On this page 1. Find Secret 2. Read Headers 3. Compute Hash 4. Compare Signatures 5. Prevent Replays
Related ET Agent Guide API Key Rotation
1

Find your webhook secret

Retrieve the unique secret key for your webhook endpoint.

Instructions

  • Go to the Webhooks tab.
  • Locate the webhook you want to secure.
  • Click the eye icon to reveal the secret key.
  • Copy the secret and store it securely on your server.
Webhook Details
whsec_abc123def456ghi789...

Sample data for illustration

2

Read the headers

Extract the timestamp and signature from the incoming request.

Instructions

  • Look for the X-ET-Signature header.
  • Look for the X-ET-Timestamp header.
  • The signature value contains a timestamp and a versioned hash.
The raw request body is required to compute the signature. If your framework parses JSON automatically, you may need to access the raw buffer before parsing.
HTTP Headers
POST /your-endpoint HTTP/1.1 Host: api.myapp.com Content-Type: application/json X-ET-Timestamp: 1678886400 X-ET-Signature: t=1678886400,v1=abc123...

Sample data for illustration

3

Compute the expected signature

Generate the HMAC-SHA256 hash using your secret and the request data.

Instructions

  • Create a string combining the timestamp, a period, and the raw body.
  • Compute the HMAC-SHA256 hash using your webhook secret as the key.
  • Convert the hash to a hexadecimal string.
Python Example
import hmac import hashlib # Extract from headers timestamp = request.headers['X-ET-Timestamp'] signature = request.headers['X-ET-Signature'] # Compute expected HMAC payload = timestamp + '.' + request.data expected = hmac.new( webhook_secret.encode(), payload.encode(), hashlib.sha256 ).hexdigest()

Sample data for illustration

4

Compare signatures securely

Use a constant-time comparison to prevent timing attacks.

Instructions

  • Extract the hash value from the signature header.
  • Use a constant-time comparison function (such as hmac.compare_digest).
  • If the hashes match, process the request. If not, reject it.
Python Example
if hmac.compare_digest(expected, signature.split('v1=')[1]): # Valid request, process payload process_signal(json.loads(request.data)) else: return "Invalid signature", 401

Sample data for illustration

5

Prevent replay attacks

Reject requests that are older than a specified threshold.

Instructions

  • Compare the X-ET-Timestamp to your current server time.
  • Reject the request if the timestamp is older than a set limit (such as 5 minutes).
  • This prevents an attacker from capturing a valid request and sending it again later.
Python Example
import time current_time = int(time.time()) request_time = int(timestamp) if abs(current_time - request_time) > 300: # 5 minutes return "Request expired", 400

Sample data for illustration

Security Notes

Use the raw bodyCompute the hash against the raw request body. Parsing the JSON before computing the hash will likely change the string and cause verification to fail.
Rotate secretsYou can generate a new secret on the Webhooks tab without changing the endpoint URL.
Log failuresLog requests that fail verification. Repeated failures can indicate an unauthorized party attempting to send requests to your endpoint.
Keep exploring

Where traders go next

Signal API Full webhook referenceAPI Partners Integration overviewTrade Automation Delivery channelsPricing 500 webhooks included

Related Guides

Guides that explain how to use the tools referenced on this page.

ET Agent Guide

Overview of the ET Agent and signal delivery.

API Key Rotation

Learn how to rotate your API key securely.

Onboarding Checklist

The steps to connect your accounts.