Network calls fail halfway. A timeout doesn’t tell you whether your order
reached the exchange. To make retries safe, POST /v1/orders (and
POST /v1/complex_orders) require an idempotency-key header.
Send a unique key (a UUID is ideal) per logical order. If the same key arrives
again — because you retried after a timeout — Mithril returns the original
order instead of placing a second one.
Reuse the same key when retrying the same order. Generating a fresh
key on retry defeats the protection and can place a duplicate.
Rules
- Scope: keys are scoped to your workspace and the request path.
- A request without the header is rejected with
400 before it’s forwarded.
- Idempotency covers order placement. Cancellation is naturally idempotent —
cancelling an already-cancelled order is a no-op.