Skip to content

Idempotency

Safely retry write requests without creating duplicates.

Last updated 2026-07-22

Network calls can fail after the server has already done the work. To make retries safe, every write (POST) requires an Idempotency-Key header:

curl https://app.exaledger.com/v1/invoices \
  -X POST \
  -H "Authorization: Bearer exl_live_YOUR_KEY" \
  -H "Idempotency-Key: 5f2b0c8e-1a2b-4c3d-9e0f-abc123456789" \
  -H "Content-Type: application/json" \
  -d '{ "customerId": "…", "invoiceDate": "2026-07-01", "lines": [ … ] }'

How it works

  • The first request with a given key runs and stores its response.
  • A retry with the same key returns the stored response instead of re-running — the header Idempotent-Replayed: true marks a replay.
  • Reusing a key with a different request body returns 409 idempotency_key_reuse.
  • A write with no Idempotency-Key returns 400 idempotency_key_required.

Choosing a key

Generate a unique key per logical operation — a UUID is ideal. Reuse the same key only when you are retrying the exact same request.