Choosing a webhook event ID: a key that separates redeliveries from distinct events
A webhook deduplication key is not one universal eventid; it is the identifier defined by each provider. For example, GitHub keeps the same X-GitHub-Delivery value on redelivery, while Stripe recommends event IDs for duplicate deliveries of one Event object and also documents cases where separate Event objects can refer to the same object and event type. Decide what counts as a duplicate, then store a key whose documented meaning matches that decision.
A webhook deduplication key is not one universal event_id; it is the identifier defined by each provider. For example, GitHub keeps the same X-GitHub-Delivery value on redelivery, while Stripe recommends event IDs for duplicate deliveries of one Event object and also documents cases where separate Event objects can refer to the same object and event type. Decide what counts as a duplicate, then store a key whose documented meaning matches that decision.
Distinguish three identifiers
| Identifier | What it identifies | When to use it for deduplication |
|---|---|---|
| Event ID | One logical event created by a provider | When the provider guarantees it remains the same across retries or redelivery |
| Delivery ID | One HTTP delivery or attempt | Only after checking the provider contract for ID reuse on redelivery |
| Object ID + event type | A type of business change on an object | As a documented supplementary rule for cases where separate Event IDs may describe a similar change |
These values are not interchangeable. GitHub describes X-GitHub-Delivery as a globally unique GUID identifying the event and says it remains the same when a delivery is requested again. It can therefore identify a redelivery of the same GitHub event. Stripe says to record Event IDs to suppress duplicate deliveries of the same Event object. It also says that, in some cases, two separate Event objects are generated; for those, use the ID of data.object together with event.type.
Define duplicate scope and persist it
**Find the provider-defined field.** Check the official docs for whether the identifier is in a header or payload. Do not assume an arbitrary id, receive time, or retry count is a stable event key.
**Choose the key scope.** If one database handles multiple accounts or endpoints, include the scope needed to prevent collisions, such as (provider, account or endpoint, event ID). Do not add unnecessary fields if the provider documents global uniqueness in your scope.
**Register atomically after signature verification.** Only a verified request is eligible for processing. Use a unique constraint or atomic insert in persistent storage so only one concurrent request can acquire a given key. A lookup followed by an insert alone has a race condition.
**Represent processing states.** Distinguish accepted, processing, completed, and retryable failure. A completed duplicate should return success without repeating side effects; failures and in-progress keys need a recovery path rather than permanent suppression.
**Set retention to match redelivery policy.** Deleting records too soon can let provider retries or operator redelivery repeat effects. Consider internal replay windows and data retention policies as well as provider retention.
Stripe notes that distinct snapshot Event objects can share the same second-resolution created timestamp, and does not guarantee delivery order. A timestamp cannot replace an event ID. If business order matters, define a separate sequence or retrieve current object state.
Minimal data model example
This is a conceptual example, not SQL for a specific database or implementation code for Stripe or GitHub.
webhook_receipts(
provider,
scope_key,
event_key,
status,
received_at,
PRIMARY KEY (provider, scope_key, event_key)
)After validating a request, insert the unique key. Only the request that inserts successfully starts business processing; a key already marked complete must not repeat the effect. A process can stop mid-flight, so define state transitions, lease expiry, and retry behavior based on the datastore's transaction guarantees and business risk. Distinct event IDs can still trigger the same business effect, so preserve domain-level idempotency for consequential actions such as applying a payment.
Questions to answer before implementation
How does this provider define event ID and delivery ID, and does redelivery reuse the same value?
Can two events with distinct Event IDs describe the same object change?
Is the identifier unique per account, app, or endpoint, or across a broader scope?
Do a unique constraint or atomic operation prevent concurrent duplicate work?
Can the system distinguish failure from completion and safely reprocess after retention expires?
Sources and scope
[Stripe: Receive Stripe events in your webhook endpoint](https://docs.stripe.com/webhooks) — duplicate Event IDs, object ID plus event type for some separate Event objects, timestamp and ordering caveats.
[GitHub Docs: Webhook events and payloads](https://docs.github.com/en/webhooks/webhook-events-and-payloads) — meaning of X-GitHub-Delivery.
[GitHub Docs: Best practices for using webhooks](https://docs.github.com/en/webhooks/using-webhooks/best-practices-for-using-webhooks) — the same delivery ID is retained on redelivery.
This article compares documented Stripe and GitHub examples. Verify identifier reuse and uniqueness for each provider; an event ID alone does not guarantee exactly-once business effects or event ordering.