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.
GET /leokit/quote
Get swap quotes from multiple protocols in a single request.Request Parameters
| Parameter | Type | Required | Description |
|---|---|---|---|
from_asset | string | Yes | Source asset in format CHAIN.SYMBOL-ADDRESS |
to_asset | string | Yes | Destination asset in format CHAIN.SYMBOL-ADDRESS |
amount | string | Yes | Amount to swap in base units (e.g., “1000000” for 1 USDC) |
destination | string | Yes | Recipient address for the output asset |
origin | string | No | Source address (optional, some protocols use for validation) |
affiliate | string | No | Affiliate address for revenue sharing |
slippage_bps | number | No | Slippage tolerance in basis points (default: 150 = 1.5%) |
streaming_interval | number | No | Streaming swap interval for THORChain/MAYA (default: 3) |
streaming_quantity | number | No | Number of streaming swap chunks (default: 1) |
Response Format
Status Code:200 OK
Helper Fields (top-level on each quote)
The server adds these fields to every quote to simplify client-side sorting and filtering. They are computed once per response by the optimal-route ranker.| Field | Type | Description |
|---|---|---|
expectedAmountOutNum | number | data.expected_amount_out parsed and scaled by destination decimals |
totalFeesUsd | number | Sum of all fees[].usd for this quote |
totalSwapSeconds | number | data.total_swap_seconds (mirrored at top level for consistent sorting) |
flags | string[] | Performance tags (see below). Empty array if no flag applies |
Quote Flags
Quotes are automatically tagged with performance indicators:- FASTEST - Lowest
totalSwapSeconds - CHEAPEST - Lowest
totalFeesUsd - OPTIMAL - Highest
expectedAmountOutNum(tie-broken by fees, then speed) - BEST_OUTPUT - Highest output across all quotes (alias of OPTIMAL on the winning quote)
Fee Breakdown Examples
Each quote includes a detailed fee breakdown with the following structure:- Affiliate Fee - Revenue sharing with integrators
- Outbound Fee - Blockchain network fee for sending output
- Network Fee - Protocol or router fee
- Deposit Fee - Fee for depositing into protocol
- Broadcast Fee - Fee for broadcasting transaction to destination chain
Error Responses
Missing Required Parameters (400)GET /leokit/streaming-quotes
Stream quotes as Server-Sent Events (SSE) for real-time updates as protocols respond.Request Parameters
Same as/leokit/quote endpoint.
Response Format
Content-Type:text/event-stream
Event Stream:
Event Types
| Type | Description |
|---|---|
init | Initial event with quote_id and total expected protocols |
quote | Individual quote as it resolves from each protocol |
final | Aggregated final result with all quotes and flags |
finished | Stream completion signal |
error | Error occurred (e.g., no quotes available) |
Stream Characteristics
- Safety Timeout: 7 seconds maximum
- Connection: Keep-alive with heartbeat
- Cache-Control:
no-cache - Client Disconnect: Gracefully handled, quote still logged to database