> ## Documentation Index
> Fetch the complete documentation index at: https://docs.ledger.so/llms.txt
> Use this file to discover all available pages before exploring further.

# Idempotency

> Safely retry POST requests using Idempotency-Key.

## How it works

For any `POST` endpoint, include an `Idempotency-Key` header to ensure the request is only processed once:

```bash theme={null}
curl -X POST https://api.ledger.so/v1/customers \
  -H "Authorization: Bearer $LEDGER_API_KEY" \
  -H "Content-Type: application/json" \
  -H "Idempotency-Key: create-customer-abc123" \
  -d '{"email": "dev@example.com", "firstName": "Dev", "lastName": "Example", "type": "individual"}'
```

If you send the same idempotency key again with the same request, you will receive the original response.

Use a fresh key for each logical create operation. If you reuse `create-customer-abc123` on `POST /v1/customers`, Ledger will intentionally return the same customer response again instead of creating a new one.

## Rules

* Idempotency keys are scoped to the endpoint and HTTP method
* Reusing a key for a **different** route or method returns `409 Conflict`
* Keys can be any string — UUIDs work well
* Keys are only required for `POST` requests. `GET`, `PATCH`, and `DELETE` are naturally idempotent
