Skip to content

Idempotency

The connection dropped and no answer came — was the order created? With Idempotency-Key it does not matter: repeat the request with the same key and Orda returns the first response without running it again.

Окно терминала
curl -s -X POST "$ORDA_API/orders" -H "X-Api-Key: $ORDA_KEY" -H "Content-Type: application/json" \
-H "Idempotency-Key: order-SO-00001-v1" \
-d '{ "number": "SO-00001", "deliveryDate": "2026-11-20", "address": "Almaty, Abay Ave 1" }'
  • Works for any POST, PATCH, PUT, DELETE. A key is 1–255 printable ASCII characters.
  • Responses are kept 24 hours. Same key and same body → the same status and body plus Idempotent-Replayed: true.
  • Same key, different body → 422 IDEMPOTENCY_KEY_REUSED.
  • First request still running → 409 IDEMPOTENCY_IN_PROGRESS, retry shortly.
  • 4xx answers are stored too (fix the data and use a new key); 5xx are not — retry with the same key.
  • Keys are separate per company and per API key.

Use a new key per intent (one batch export, one cancellation) and the same key for all retries of that intent, e.g. orders-bulk-2026-11-20-<batch number>.