# Avoid duplicates with Idempotency-Key

> Replay a call after a network failure without generating or billing the same document twice.

A call can fail on the network side even though Mizanpage did produce the document. If your software retries, the document may be counted twice. The `Idempotency-Key` header prevents this.

## How to use it

Send one unique key per document, for example your order or invoice number:

```http
POST /v1/render
Idempotency-Key: invoice-INV-2026-001
```

## What Mizanpage does

For 24 hours, for the same workspace:

- **same key, same parameters**: the document is not counted a second time. The `document.generated` webhook is not sent again;
- **same key, other data**: the call is refused before any rendering (`422 idempotency_key_reused`). Nothing is counted;
- **after 24 hours**: the key is free again.

## Good practice

- One key **per document**, never a fixed value.
- Reuse the same key for each new attempt at the same document.
- After a `503` error, retry with the same key.

---

Documentation Mizanpage · Developers › API
https://mizanpage.com/en/docs/api/idempotence/
