Documentation Index
Fetch the complete documentation index at: https://docs.leokit.dev/llms.txt
Use this file to discover all available pages before exploring further.
Making Your First API Call
Ready to get started? Here’s a simple example of fetching swap quotes:
curl -X GET "https://api.leokit.dev/leokit/quote?from_asset=BTC.BTC&to_asset=ETH.USDC-0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48&amount=100000000&destination=0x742d35Cc6634C0532925a3b844Bc9e7595f0bEb" \
-H "Api-Key: your_api_key_here"
This request will return quotes from all available protocols for swapping 1 BTC to USDC on Ethereum.
Common API Endpoints
Here’s a quick reference of the most commonly used endpoints:
| Endpoint | Method | Purpose |
|---|
/leokit/quote | GET | Get swap quotes from all protocols |
/leokit/streaming-quotes | GET (SSE) | Stream quotes in real-time |
/leokit/deposit | POST | Generate unsigned transaction |
/leokit/save-transaction | POST | Save broadcasted transaction hash |
/leokit/status | POST | Get swap transaction status |
/leokit/assets | GET | List supported tokens with prices |
/leokit/balances | POST | Get multi-chain wallet balances |
Common Parameters
These parameters are used across multiple endpoints:
| Parameter | Used In | Type | Description |
|---|
from_asset | Quote | string | Source asset identifier |
to_asset | Quote | string | Destination asset identifier |
amount | Quote | string | Amount in base units |
destination | Quote | string | Recipient address |
origin | Quote | string | Source address (optional) |
quote_id | Deposit, Status, Save TX | string | UUID from quote |
selected_protocol | Deposit | string | Protocol to use |
tx_hash | Save TX | string | Transaction hash |
Response Time Expectations
Understanding typical response times helps you build better user experiences:
| Operation | Typical Time | Maximum Time |
|---|
| Quote (HTTP) | 2-4 seconds | 10 seconds |
| Quote (Streaming) | 3-6 seconds | 7 seconds (timeout) |
| Deposit Generation | 1-3 seconds | 10 seconds |
| Status Check (cached) | <100ms | 1 second |
| Status Check (API) | 1-2 seconds | 5 seconds |
| Assets List | <100ms | 1 second (cached) |
| Balances | 2-5 seconds | 15 seconds |
Best Practices
Follow these best practices to build robust integrations:
- Always validate quote_id before requesting deposit generation
- Poll status endpoint every 10-30 seconds, not more frequently
- Cache assets list for at least 20 seconds to reduce API calls
- Use streaming quotes for better UX with real-time updates
- Handle partial quote failures gracefully - some protocols may fail while others succeed
- Implement exponential backoff for failed requests
- Save transaction hashes immediately after broadcast
- Monitor trace IDs for debugging production issues
- Set reasonable slippage (1.5-3% for most swaps)
- Validate addresses before submitting to quote endpoint
Protocol Support by Ecosystem
Different protocols support different blockchain ecosystems:
| Protocol | EVM | UTXO | Cosmos | NEAR | Other |
|---|
| THORChain | ✅ | ✅ | ✅ | ❌ | ✅ (XRP, TRON) |
| MAYAChain | ✅ | ✅ | ✅ | ❌ | ❌ |
| Chainflip | ✅ | ✅ | ❌ | ❌ | ❌ |
| Relay | ✅ | ❌ | ❌ | ❌ | ❌ |
| NEAR | ✅ | ❌ | ❌ | ✅ | ❌ |
| Rango | ✅ | ✅ | ✅ | ✅ | ✅ (All) |
Error Code Categories
Understanding error codes helps with debugging:
- 400-level: Client errors (validation, parameters, quotes)
- 403: Authentication failures
- 404: Resources not found (quotes, traces)
- 500-level: Server errors (internal, external API failures)
Next Steps
Now that you understand the basics, explore the detailed endpoint documentation to learn about:
- Fetching and comparing swap quotes
- Generating unsigned transactions
- Tracking swap status
- Managing multi-chain assets and balances