Stream quote results in real-time as each protocol responds via Server-Sent Events
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.
| Method | Example |
|---|---|
Api-Key header | Api-Key: YOUR_API_KEY (preferred when possible) |
api_key query parameter | ?api_key=YOUR_API_KEY |
| Parameter | Type | Required | Description |
|---|---|---|---|
from_asset | string | Yes | Source asset in CHAIN.SYMBOL-ADDRESS format |
to_asset | string | Yes | Destination asset in CHAIN.SYMBOL-ADDRESS format |
amount | string | Yes | Amount in source-asset base units (wei, sats, etc.) |
origin | string | No | Source wallet address (improves quote accuracy) |
destination | string | No | Destination wallet address |
streaming_interval | number | No | THORChain/MAYAChain streaming interval (default 1) |
streaming_quantity | number | No | THORChain/MAYAChain streaming sub-swap count |
api_key | string | No | Alternative to Api-Key header (see above) |
data: <json>\n\n chunks (legacy SSE format — no named event: fields).
| Order | Event payload type | Description |
|---|---|---|
| 1 | init | Stream opened, includes quote_id and total protocols being queried |
| 2..N | quote | One per protocol that returns a valid quote |
| N+1 | final | Aggregated, sorted, deduplicated payload (after all settle) |
| N+2 | finished | Stream closing |
error event is sent in place of final.
final event)| Field | Description |
|---|---|
expectedAmountOutNum | Numeric expected output (for sorting) |
totalFeesUsd | Total combined fees in USD |
totalSwapSeconds | Estimated time-to-settle |
flags | Tags like FASTEST, CHEAPEST, BEST_OUTPUT |
| Status | Code | Description |
|---|---|---|
400 | BAD_REQUEST | Missing or malformed from_asset, to_asset, or amount |
400 | INVALID_ASSET_FORMAT | Asset string not in CHAIN.SYMBOL-ADDRESS format |
401 | INVALID_API_KEY | Missing or invalid API key |
UNABLE_TO_RETRIEVE_QUOTES error is delivered inside the SSE stream as a type: "error" event, not as an HTTP error.
See the error codes catalog for the full list.Demo API-Key (Sandbox): 7037d2b3-9c76-4f62-b730-c544f7570fa4
Input asset identifier.
Output asset identifier.
From wallet address.
To wallet address.
Amount to swap.
Alternative to Api-Key header (useful for EventSource which cannot set headers).
Server-Sent Events stream. Events are sent as data: {json}\n\n format.
SSE stream with events: init, quote (per protocol), final (sorted), finished.