Idempotency
Retry an order after a timeout without ever buying twice.
Why it matters
Networks fail at the worst moment. If your request to buy eSIMs times out, you can't tell whether Burj received it. Retrying blindly could buy the eSIMs twice; not retrying could leave a traveller without one.
The Idempotency-Key header removes the guesswork on /order/create: retry as often as you need, and the order is placed at most once.
Replays
| You send | You get |
|---|---|
| Same key + same body within 24 h | The first answer again, with header Idempotent-Replayed: true. Nothing is bought twice. |
| Same key while the first request is still running | HTTP 409 IDEMPOTENCY_IN_PROGRESS: retry in a few seconds. |
| Same key + a different body | HTTP 422 IDEMPOTENCY_KEY_REUSED: a bug on your side. Use a new key for a new order. |
| An empty, too long or non-ASCII key | HTTP 400 INVALID_IDEMPOTENCY_KEY |
What is not stored
Failed orders don't keep the key. If the order failed (for example PROVIDER_ORDER_FAILED, where nothing was charged), the same key can be used to try again, and that retry really places the order.
Replays work for 24 hours, so finish your retries within that window, and never reuse an old key for a new order. Without the header, /order/create works as before, with no protection against double orders.
/order/create takes an Idempotency-Key. Repeating /order/activate is harmless: an eSIM that is already prepared answers ORDER_INVALID_STATUS, and its details stay available from /{orderId}/data.Retrying safely
Retry on timeouts, network errors and these codes, always with the same key:
IDEMPOTENCY_IN_PROGRESS(409): the first attempt is still running.PROVIDER_ORDER_FAILED(502): nothing was charged, try again.INTERNAL_ERROR(500),RATE_LIMITED(429): wait, then try again.
Don't retry business errors such as INSUFFICIENT_BALANCE or PACKAGE_NOT_FOUND: fix the cause first.