Scrivio Interview library
DesignIntermediate7 min read · updated 13 November 2026

Your platform sends webhooks to 3,000 partner endpoints for order events. Partners complain about events missed during their outages, duplicates after your retries, and events that arrive out of order.

Design webhook delivery: the guarantee you offer, the retry schedule, ordering, and what you require from partners.

Offer at-least-once delivery: store every event durably per partner before sending, retry with exponential backoff and jitter for up to 72 hours, then mark it failed and offer replay. Every event carries a unique id, a timestamp and a per-resource version, partners must deduplicate by id and ignore older versions (or receive thin events and fetch current state), each partner gets its own queue, concurrency limit and circuit breaker, and payloads are signed with an HMAC over a timestamp and the body.

Why this question is asked

Webhooks look simple, an HTTP POST when something happens, but at 3,000 partner endpoints every weakness shows up: partners go down, networks time out, retries cause duplicates and parallel workers reorder events. Interviewers ask this design question because it tests delivery guarantees, isolation between tenants and API contract design in one problem. In this answer, we will set requirements and rough numbers, sketch the architecture and data model, define the guarantee and retry schedule, handle ordering, isolate partners, and list what we require from partners in the contract.

1Requirements and Rough Numbers

The partners have told us what matters: no events lost during their outages, duplicates they can handle, and a way to cope with ordering. We add our own requirements: one slow or broken partner must not delay others, and partners must be able to verify that a request really came from us.

Let us size it. Suppose 2 million order events per day, and each partner subscribes to a share of them, giving about 10 million deliveries per day. That is roughly 115 deliveries per second on average, and perhaps 1,000 per second at peak. If a typical partner responds in 200 ms, we need about 1,000 x 0.2 = 200 requests in flight at peak, plus headroom for slow endpoints. If 2 percent of partners are down at any time and we retry for 72 hours, the store of pending deliveries can hold several million rows, which PostgreSQL handles comfortably with the right indexes.

2The High-Level Design

The order service never calls partners directly. It writes events to an outbox table in the same transaction as the order change, and a relay publishes them to a Kafka topic. A fan-out service reads the topic, looks up which partner endpoints subscribe to the event type, and writes one delivery row per endpoint into a PostgreSQL deliveries table. Delivery workers pick due rows, make the HTTP call and record the result.

Step throughWebhook delivery architecture
  1. Order service + outboxevent written in the same transaction as the order
  2. Kafka topic order-eventsdurable, replayable source of events
  3. Fan-out serviceone delivery row per subscribed endpoint
  4. PostgreSQL deliveries tablestate, attempts, next_attempt_at per delivery
  5. Delivery workersper-endpoint concurrency limits and circuit breakers
  6. Partner endpointsverify signature, dedupe by event id, return 2xx

6 layers, from the top down. Step through them one at a time.

Storing each delivery durably before the first attempt is what makes at-least-once possible: if a worker crashes mid-request, the row is still pending and will be retried. The data model is small: deliveries(id, endpoint_id, event_id, payload_ref, status, attempts, next_attempt_at, last_status_code, created_at), with an index on (status, next_attempt_at). Workers claim batches with SELECT ... FOR UPDATE SKIP LOCKED, so many workers can share the table without blocking each other.

3The Guarantee and the Retry Schedule

We offer at-least-once delivery and say so in the contract. We cannot offer exactly-once: if a partner processes our request but the response is lost in a timeout, we will retry, and they will see the event twice. Any 2xx response counts as success; anything else, including a timeout after 10 seconds, schedules a retry.

Retries use exponential backoff with jitter. Backoff gives a struggling endpoint time to recover, and jitter, a random spread around each delay, stops thousands of retries from landing at the same second when a big partner comes back. After the final attempt, the delivery is marked failed, the partner is notified, and the event stays available for replay from their dashboard.

Retry schedule (each delay +/- 20 percent jitter)
AttemptDelay after previousTime since event
1immediate0
21 minuteabout 1 min
35 minutesabout 6 min
430 minutesabout 36 min
52 hoursabout 2.6 h
66 hoursabout 8.6 h
7 onwardsevery 12 hoursuntil 72 h, then failed and replayable

4Ordering: Versions Instead of Promises

We do not promise global ordering, and we should not even promise ordering per partner. Parallel workers, retries and partner outages all reorder events: OrderShipped may succeed while an earlier OrderPaid is still waiting for its third retry. Forcing strict order would mean that one failed event blocks every later event for that partner for up to 72 hours.

Instead, every event carries a per-resource version, for example order 77 at version 5, along with its timestamp. A partner that receives version 5 and later version 4 simply ignores version 4. Another approach is thin events: the webhook says only "order 77 changed, version 5", and the partner calls our API to fetch the current state. Ordering then stops mattering, because whatever arrives, the partner always fetches the latest truth.

5Isolating Partners From Each Other

With 3,000 endpoints, some are always slow or down. If all deliveries shared one queue and one worker pool, a partner whose endpoint hangs for 10 seconds per request would soon occupy every worker. So each endpoint gets its own logical queue and a concurrency limit, for example at most 10 requests in flight. A circuit breaker per endpoint stops sending after repeated failures and probes again later, so retries do not pile onto a dead endpoint. Endpoints that have failed continuously for several days are disabled, and their owners are notified by email and in the dashboard.

6Security and What We Require From Partners

Each request is signed with HMAC-SHA256 using a secret per endpoint. The signature covers a timestamp and the raw body, and both go in headers, for example Webhook-Timestamp and Webhook-Signature. Partners recompute the signature and reject requests whose timestamp is more than five minutes old, which stops an attacker from replaying a captured request later. We use short timeouts and never follow redirects to other hosts.

The contract then asks partners for four things: respond with 2xx quickly and process asynchronously, deduplicate by event id, use the version to ignore older updates, and verify the signature and timestamp. In return, we give them a delivery log showing every attempt with status codes, and a replay API to request events from a time range after an outage.

7Follow-up questions

Why are thin events often easier for partners than full payloads?

Because they remove most of the hard problems from the partner's side. With full payloads, a partner must handle duplicates, compare versions and worry that a delayed old payload overwrites newer data. With a thin event, the partner just learns that something changed and fetches the current state from our API, so duplicates and reordering are harmless: two notifications lead to two reads of the same latest data. Payloads also stay small and never leak fields a partner should not see. The cost is extra API calls, so our read API must handle that load.

Why not let partners poll an events API instead of webhooks?

Many platforms offer both. Polling an events feed with a cursor gives partners natural ordering and easy recovery after outages, while webhooks give low latency. Offering a feed alongside webhooks is a good addition, and it doubles as the replay mechanism.

How do you stop one huge partner from dominating the workers?

Per-endpoint concurrency limits cap how many workers one partner can use, and fair scheduling picks due deliveries across endpoints rather than strictly by time, so a backlog of a million events for one partner does not delay a single event for another.

8Conclusion

In this answer, we designed webhook delivery for 3,000 partners. Events flow through an outbox and Kafka into a durable deliveries table, so we can honestly offer at-least-once delivery with backoff and jitter for up to 72 hours, followed by failure notification and replay. We gave every event an id, a timestamp and a per-resource version instead of promising order, isolated partners with per-endpoint queues, limits and circuit breakers, signed payloads with an HMAC over timestamp and body, and asked partners to deduplicate, respect versions and respond quickly.

What to say in the interviewAbout 90 seconds aloud

Open with

I'd offer at-least-once delivery, because exactly-once over HTTP isn't possible: a lost response always leads to a retry. The order service writes events through an outbox into Kafka, and a fan-out service writes one durable delivery row per subscribed endpoint into PostgreSQL before the first attempt, so a crash never loses a delivery.

Then, if they want more

Workers claim due rows with SKIP LOCKED, treat any 2xx as success, use about a ten-second timeout, and retry with exponential backoff plus jitter: one minute, five, thirty, two hours, six hours, then every twelve hours up to seventy-two hours. After that the delivery is marked failed, the partner is told, and they can replay it.

Every event has a unique id and timestamp, and the contract says partners must deduplicate by id. I would not promise ordering; instead each event carries a per-resource version so partners ignore older updates, or we send thin events that tell them to fetch the current state, which makes duplicates and reordering harmless.

To isolate partners, each endpoint has its own queue, a concurrency limit and a circuit breaker, so one broken partner can't consume all workers, and endpoints failing for days get disabled with a notification. Payloads are signed with HMAC-SHA256 over a timestamp and the body, and partners reject old timestamps to stop replays. Partners get a delivery log and a replay API in their dashboard.

About this answer

Last updated
13 November 2026
Checked
Its structure and format are checked automatically. Use it as a carefully prepared study note: where a detail matters, confirm it against the official documentation for the version you use. What the checks cover
Where the question comes from
Written by Scrivio for practice. It is not taken from an interview.
Report an issue with this answer

Copy the line below and send it to the author with what you found. It carries the address of this page.

Issue with "Design webhook delivery: the guarantee you offer, the retry schedule, ordering, and what...": https://scrivio-interview-library.netlify.app/architecture/distributed-systems/e474a042b2/