Using idempotency keys
Include theIdempotency-Key header with a unique string identifier on any financial operation:
How it works
1
First request
The request is processed normally. The response is cached against the idempotency key.
2
Duplicate request
If the same key is sent within 24 hours, the cached response is returned immediately — the operation is not re-executed.
3
Different key
A new key is always treated as a new request and processed normally.
Duplicate response
When Knot detects a duplicate request, it returns the cached original response with an indicator:Key generation strategies
Choose a strategy that produces unique, traceable keys:UUID-based
Operation-based
Hash-based
When to use a new key
Best practices
Always use for financial operations
All transfers, trades, and liquidity operations should include idempotency keys.
Generate unique keys
Use UUIDs, timestamps, or content hashes to ensure each key is unique.
New key for retries
When retrying after a non-timeout error, always generate a fresh idempotency key.
Include operation context
Embed operation details in the key to make it easier to trace and debug.