# Idempotency (safe retries)

Networks fail. If a request times out, you can't tell whether we received it. Send an **`Idempotency-Key`** header and retrying is always safe:

- The **first** request with a key runs the check and charges credits.
- Any **retry** with the same key and the same body, within 24 hours, returns the original response and **charges nothing**. The response has the header `Idempotent-Replayed: true`.
- The same key with a **different body** returns `idempotency_key_reused` (HTTP 422).

```bash
curl https://veqen-app.com/v1/signup/check \
  -H "Authorization: Bearer $VEQEN_API_KEY" \
  -H "Idempotency-Key: signup-7f3e2a91" \
  -H "Content-Type: application/json" \
  -d '{"email": "jane@example.com", "ip": "203.0.113.7"}'
```

## Choosing a key

Use something unique to the action, such as your signup's database ID or a UUID you generate once and reuse for every retry of that action. Keys can be up to 255 characters.

> We keep idempotent responses for 24 hours so retries can be answered. Requests without a key aren't stored.
