X-Yotel-Signature header. Your
handler must verify it before trusting the payload. Without
verification, anyone can POST a fake call.ended to your endpoint.
The contract
- no
sha256=token inX-Yotel-Signaturematchesexpected(timing-safe compare), OR |now - X-Yotel-Timestamp| > 300seconds (replay protection)
X-Yotel-Signature is a comma-separated list of sha256=<hex> tokens.
Today it usually holds one, but during a signing-secret rotation’s grace
window it holds two (sha256=OLD,sha256=NEW, see
Rotate the signing secret). Split the
header on , and accept the request if any token matches. A handler that
compares the whole header to one value rejects every delivery in that window.
Reference implementations
Critical gotchas
Read the raw body BEFORE parsing JSON
Read the raw body BEFORE parsing JSON
Many frameworks (Express, FastAPI) auto-parse JSON bodies. If you
sign the parsed-then-reserialized body, whitespace or key-order
drift breaks the signature. Always sign the raw bytes.
Sync your server's clock
Sync your server's clock
The 5-minute replay window requires NTP sync on your host. A drift
of more than ±5 min rejects every delivery. If you see
401: Replay window exceeded, check your server’s clock first.Use timing-safe compare
Use timing-safe compare
Don’t use
== to compare signatures — it short-circuits on the
first different byte and leaks information to an attacker probing
your endpoint. Use hmac.compare_digest / crypto.timingSafeEqual
as shown above.Handle duplicate deliveries (event_id)
Handle duplicate deliveries (event_id)
Retries use the same
event_id. Your handler should key on that
— store a seen_event_ids set (Redis + TTL matches our 7.5h retry
window) and skip duplicates. Skipping is fine: respond 200 without
reprocessing.
