# What is an idempotency key?

An idempotency key is a unique value sent with a request so the server performs it once, even if retried. Why WhatsApp sends need one, with an example.

Canonical URL: https://superskope.com/glossary/idempotency-key
Updated: 2026-11-27
Author: SuperSkope

## Short answer

An idempotency key is a unique value a client sends with a request so the server performs the action at most once, even when the same request is retried. For WhatsApp sends, it stops a timeout or retry from delivering the same message twice.

## How does an idempotency key work?

The client creates one key per logical action, such as "send the order 4521 confirmation", and sends it in an Idempotency-Key header. The server stores the key with the result. If the same key arrives again with the same body, the server returns the saved result instead of acting twice. If the body differs, it rejects the request as a conflict.

## Example

Your server sends a WhatsApp message, the network times out and your retry library tries again. Without a key the customer could get the message twice. With the same key, the second attempt returns the first result.

```
curl -X POST "$SUPERSKOPE_URL/api/v1/chats/$CHAT_ID/messages" \
  -H "Authorization: Bearer $SUPERSKOPE_API_KEY" \
  -H "Idempotency-Key: order-4521-confirmation" \
  -H "Content-Type: application/json" \
  -d '{"text":"Your order 4521 is confirmed."}'
```

Copy-only example. No request is run by this page.

## Rules that avoid duplicates



- Create the key from the business event, not from the attempt, and store it before sending.
- Never reuse a key for a different message or operation.
- If the result is unknown, look it up instead of sending again. SuperSkope marks interrupted sends as unknown and never retries them automatically.

- [Webhook retries without duplicates](https://superskope.com/blog/webhook-retries-without-duplicates)
- [Webhook signature](https://superskope.com/glossary/webhook-signature)
- [Read the developer documentation](https://docs.superskope.com/)

## Frequently asked questions

**What happens if I reuse a key with a different body?** The server should refuse it. The IETF draft for the Idempotency-Key header recommends a 422 response, and SuperSkope returns a conflict for a changed body.

**How long are idempotency keys kept?** It depends on the API. SuperSkope lets a key look up the result of a request for 90 days.

## Sources



- [IETF draft: The Idempotency-Key HTTP Header Field](https://datatracker.ietf.org/doc/draft-ietf-httpapi-idempotency-key-header/)

## Continue reading

- [Handle WhatsApp webhook retries without duplicate replies.](https://superskope.com/blog/webhook-retries-without-duplicates)
- [A WhatsApp API for the system you want to build.](https://superskope.com/whatsapp-api)
- [What is a webhook signature?](https://superskope.com/glossary/webhook-signature)
