Homeglossary

What is an Idempotency Key?

An idempotency key is a unique ID your app attaches to a request so that repeating the same request has the same effect as sending it once. In app building, it's what stops a retried or double-clicked action, like a payment, from running twice by mistake, which matters because a duplicate charge or duplicate order reaches real customers.

Knowing why an action never fires twice makes you a sharper builder.

How an idempotency key works

When your app sends a request, it includes a unique key with it, and the service receiving the request remembers that key. If a second request arrives carrying the same key, the service recognises it as a repeat and returns the original result instead of performing the action again. The key has to be unique per real action but identical across retries of that same action, so a checkout gets one key and every retry of that exact checkout reuses it.

Idempotency key examples

Picture a booking app where a customer taps "Pay" and their connection stutters, so the app sends the payment twice. Because both attempts carry the same idempotency key, the payment service sees the second one as a duplicate and ignores it. The customer is charged once, gets one confirmation, and never sees the glitch that happened underneath.

Start Building
on Emergent today
Start Building