What is your practical rubric for API idempotency?

Retries are unavoidable. How do you design write endpoints so duplicate requests are safe without making the system overly complex?

Arthur

Use an idempotency key scoped to {tenant, operation} with a short TTL, persist the first request’s normalized payload hash plus final response, and on replay return the cached result only if the hash matches; it keeps retries safe while avoiding the complexity of making every write path naturally idempotent.

insert into idem_keys(key, tenant, op, req_hash, response)
values ($1, $2, $3, $4, $5)
on conflict (key, tenant, op) do nothing;

MechaPrime