Retry safely
Press Pay twice on a fictional bakery API. Without an Idempotency-Key you get two orders. With one, the retry returns the first result.
Interactive · toy
A timeout leaves a client unsure whether an order exists. The Sample Orders API accepts an Idempotency-Key header on writes.
- Same key and body after the first finished: the stored response comes back, marked Idempotent-Replayed: true.
- Same key and body while the first is running: 409 with Retry-After.
- Same key, different body: 422.
- A new key: a new order.