API Reliability

API HMAC Request Signing Guide

Debug HMAC request signatures by making canonical input, body bytes, timestamps and constant-time verification explicit. Last updated September 16, 2026.

Debug HMAC request signatures by making canonical input, body bytes, timestamps and constant-time verification explicit. This reference is written for developers who need practical validation behavior, reviewable rules and safe examples rather than copied snippets with no explanation.

Recommended workflow

StepWhy it matters
Write the signing contractDocument encoding, separators, header names, timestamp units and the exact body representation.
Log safe intermediatesCompare hashes and canonical string length without printing the shared secret.
Verify freshnessReject requests outside a small clock-skew window before accepting a valid old signature.
Rotate secretsSupport overlapping keys briefly and identify which key verified the request.

Starter snippet

signature = HMAC-SHA256(secret, timestamp + '.' + raw_body)
compare decoded bytes in constant time

Review checks

Common mistakes

Validation should help users correct input while protecting systems from bad data. Keep syntax checks, product policy, security review and deliverability checks separate.

Related Formalint references

Continue with Webhook Signature Verification Guide, Secrets Redaction Checklist, Api Key Rotation Guide.