Network issues can cause requests to time out before you receive a response. Without idempotency, retrying a request could result in duplicate transfers, double trades, or repeated liquidity operations. Knot supports idempotency keys to ensure that retrying a request has no additional effect if the original succeeded.Documentation Index
Fetch the complete documentation index at: https://docs.useknot.xyz/llms.txt
Use this file to discover all available pages before exploring further.
Using idempotency keys
Include theIdempotency-Key header with a unique string identifier on any financial operation:
How it works
First request
The request is processed normally. The response is cached against the idempotency key.
Duplicate request
If the same key is sent within 24 hours, the cached response is returned immediately — the operation is not re-executed.
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
| Scenario | Use same key? | Reason |
|---|---|---|
| Network timeout during request | Yes | The request may have succeeded — safe to retry with the same key |
5xx error response | No | The request failed — safe to retry with a new key |
4xx error response | No | The request was rejected — fix the issue before retrying |
| Intentional new operation | No | This is a distinct operation |
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.