The interview problem
An API deduplicates retries for one day. Explain what happens to an old retry on day two and design the contract.
Original practice, not a reported company interview. Scenarios and numbers are illustrative. Interview date: not applicable. Sources retrieved October 1, 2026.
1. Scope and worked approach
Assume authenticated callers supply scoped idempotency keys. Store key, normalized request digest, operation state and durable result reference. Reusing a key with a different request is an error. Set retention using the maximum supported client retry and offline replay window, and publish behavior after expiry. High-value permanent business identities may need uniqueness beyond transient request deduplication.
2. Trace the design or derivation
Validate scoped key → compare digest → create or join operation → persist result → expire by contract
Return an explicit expired-or-unknown outcome when the system cannot safely determine the original result, if the product contract permits it. Automatically treating every missing record as a brand-new request makes expiration semantics invisible. Monitor late retries to validate whether the chosen retention window matches actual clients.
3. Calculate the example
A client can remain offline for 48 hours while the deduplication record expires after 24. Replaying the original request at hour 30 can create a second operation unless a durable business constraint catches it. A 24-hour dedupe cache therefore cannot promise 48-hour retry safety.
4. Failure cases and trade-offs
Keeping results forever increases storage and can retain sensitive payloads. Deleting only the payload while retaining a compact key/result identity may preserve uniqueness. A request timeout must not be stored as definitive operation failure if work may still commit.
5. Validation, follow-ups and self-review
Test same-key same-body, conflicting-body, concurrent and post-expiry requests. Follow-up: can a tombstone preserve safety without the full response? Self-review: align the advertised window with replay behavior and business invariants.
Sources and related practice
Technical reference: docs.stripe.com — Idempotency-key retention and parameter comparison; the 48-hour scenario is hypothetical.
Source publication/update: Not established. Retrieved October 1, 2026. The workflow, calculations and review exercises are original; this reference is not evidence that a company asked this question.
Continue with Publish database changes through a transactional outbox; Design an inventory reservation system.
Continue your preparation
Choose a connected learning path or browse more System design questions. Read our editorial method and attribution policy.