Every request Titan sends to your webhook endpoint includes anDocumentation Index
Fetch the complete documentation index at: https://docs.usetitan.app/llms.txt
Use this file to discover all available pages before exploring further.
X-Webhook-Signature header. You should verify this signature before processing any payload to confirm the request came from Titan and that its body was not tampered with in transit.
The signature is an HMAC-SHA256 digest of the raw request body, computed using the hmacKey you set when creating the webhook. The header value takes the form:
How verification works
- Read the raw request body bytes before parsing JSON. Do not use the serialized form of a parsed object — even minor whitespace differences will invalidate the signature.
- Compute
HMAC-SHA256(rawBody, hmacKey)and hex-encode the result. - Prepend
sha256=to form the expected signature string. - Compare your computed value to the
X-Webhook-Signatureheader using a constant-time comparison to prevent timing attacks.
Using the official SDKs
The Titan SDKs handle signature verification for you.- TypeScript
- Python
- Go
- PHP
Manual verification
If you are not using an SDK, you can verify signatures with standard cryptography libraries in any language.Full handler example
The example below shows how to wire up signature verification in a complete Express handler.Best practices
Use the raw request body
Use the raw request body
Read the body bytes before any JSON parsing or serialization. JSON parsers may reorder keys or change whitespace. The signature is computed over the exact bytes Titan sent, so any transformation will cause verification to fail.
Use constant-time comparison
Use constant-time comparison
Use
crypto.timingSafeEqual (Node.js), hmac.compare_digest (Python), hmac.Equal (Go), or hash_equals (PHP) rather than a regular string equality check. A simple === comparison can leak the signature length through timing differences, making a timing attack feasible.Rotate your hmacKey periodically
Rotate your hmacKey periodically
Update your webhook’s
hmacKey by calling PUT /api/webhooks/{id} with a new hmacKey value. Update your verification code to accept both the old and new keys during the transition window, then drop the old key once all in-flight deliveries have been processed.Reject requests missing the header
Reject requests missing the header
If the
X-Webhook-Signature header is absent, reject the request immediately with a 401 or 400 response. Titan always includes this header on legitimate deliveries.The
hmacKey is write-only: Titan never returns its value in API responses after creation. Store it securely in an environment variable or secrets manager when you register the webhook.