---
title: HMAC Signed AI Webhook Callbacks | APIkit
description: Secure every outbound AI webhook callback with timestamped HMAC-SHA256 signatures and rotating signing secrets.
canonical: "https://apikit.ai/j/sign-outbound-webhook-hmac-headers"
modified: 2026-11-14
author: apikit.ai editorial team
source: "https://apikit.ai"
category: Webhook & Async Event Pipelines
category_url: "https://apikit.ai/j#group-webhook-event-pipelines"
---

# Sign and verify AI webhook callbacks with HMAC headers

> Protect downstream endpoints from forged callbacks using timestamped HMAC-SHA256 signature headers and replay window checks.

## Prepared starting prompt

Our security review requires all outbound AI callback webhooks from APIkit to carry timestamped HMAC-SHA256 signatures with secret rotation.

### Quick scenarios
- **HMAC-SHA256 signature:** Attach X-APIkit-Signature and X-APIkit-Timestamp headers to every callback delivery.
- **Replay window guard:** Include timestamp verification snippets so our receiver rejects replayed requests older than 5 mins.
- **Dual-secret rotation:** Roll webhook signing secrets seamlessly by supporting current and previous secrets during handoff.

- [Request APIkit early access](https://apikit.ai/#waitlist-f73a0d)

## Checklist for cryptographic webhook verification

1. **Sign raw payload plus timestamp** — Compute HMAC over timestamp plus raw request body bytes to prevent subtle JSON whitespace mismatches.
2. **Enforce strict timestamp tolerances** — Reject incoming callbacks older than five minutes on your server to block replay attacks.
3. **Use constant-time comparison** — Compare signature digests with timing-safe equality checks inside your backend route handler.
4. **Test dual-secret rotation** — Verify your receiver checks both active and previous signing keys before retiring old secrets.

## Frequently Asked Questions

### Why include a timestamp inside the HMAC signature?

Signing the timestamp alongside the JSON body guarantees that captured valid callbacks cannot be replayed hours later by an attacker.

### Can I rotate signing secrets without breaking live jobs?

Yes. APIkit can emit signatures using dual secrets during a configurable grace window while your backend deploys the new key.

### Do you provide verification snippets for Node and Python?

Yes. Copy-paste HMAC verification snippets show raw-body reading and timing-safe checks for Express, Next.js, and FastAPI.

## Related tasks in this category

- [Enrich incoming webhooks with AI before forwarding](https://apikit.ai/j/process-stripe-github-webhooks-ai.md)
- [Run slow AI jobs asynchronously with webhook callbacks](https://apikit.ai/j/run-long-ai-jobs-async-callbacks.md)
- [Recover failed webhook deliveries with retries and DLQ](https://apikit.ai/j/configure-dead-letter-webhook-retries.md)
- [Fan out batch arrays into parallel AI endpoint runs](https://apikit.ai/j/fan-out-batch-events-parallel.md)
- [Deduplicate duplicate webhook runs with idempotency keys](https://apikit.ai/j/deduplicate-idempotent-webhook-events.md)
- [Turn raw app events into crisp Slack or Discord alerts](https://apikit.ai/j/trigger-slack-discord-alerts-events.md)

---

*Published by **Wondel.ai sp. z o.o.** · [apikit.ai](https://apikit.ai) · [About](https://apikit.ai/about) · [Editorial Guidelines](https://apikit.ai/editorial) · [Contact](https://apikit.ai/contact) · [Wondel.ai Products](https://wondel.ai/products)*