Every payment API has it, and almost no internal service does. Idempotency keys are the cheapest way to make a queue safe.

The shape I use in Go:

  • the client sends Idempotency-Key with the request
  • a middleware checks a dedupe table keyed by (key, route)
  • if it exists, return the stored response
  • if not, process, store the result with a TTL, then return

The subtle parts: store the response, not just the status; set the TTL to something longer than your retry window; and make the check-and-insert atomic, or two workers will race and both process.

The win is that at-least-once delivery becomes safe without changing the queue. The cost is one small table and a header.

I'd argue every handler that touches money or email should have one. What's the smallest service where you'd skip it?