The svix-id Header
Every webhook request includes asvix-id header. This ID is:
- Unique per message - Each distinct event gets a unique ID
- Consistent across retries - The same ID is used when retrying a failed delivery
Implementing Deduplication
To ensure you only process each event once, store thesvix-id and check it before processing:
When to Use Deduplication
Deduplication is especially important for:- Payment processing - Avoid charging customers twice
- Order creation - Prevent duplicate orders
- Inventory updates - Ensure accurate stock counts
- Notification sending - Don’t spam users with duplicate messages
Storage Options
You can store processed webhook IDs in:| Storage | Pros | Cons |
|---|---|---|
| Redis | Fast, built-in TTL | Requires Redis instance |
| Database | Already available | Slower, needs cleanup job |
| In-memory | Simplest | Lost on restart, not for distributed systems |
Even without deduplication, designing your webhook handlers to be idempotent (producing the same result when called multiple times) is a good practice.