api_haystack_get_swap_quote
Get optimized swap quotes across Algorand DEXes and LST protocols to preview best-price routes before executing trades.
Instructions
Get an optimized swap quote from Haystack Router — a DEX aggregator that finds the best swap route across multiple Algorand DEXes (Tinyman V2, Pact, Folks) and LST protocols (tALGO, xALGO). Returns the best-price quote with route details, USD values, and price impact. Use this to preview a swap before executing. All amounts are in base units (e.g., 1000000 = 1 ALGO).
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| fromASAID | Yes | Input asset ID (0 = ALGO, 31566704 = USDC, 312769 = USDt, etc.) | |
| toASAID | Yes | Output asset ID (0 = ALGO, 31566704 = USDC, 312769 = USDt, etc.) | |
| amount | Yes | Amount in base units (e.g., 1000000 = 1 ALGO with 6 decimals) | |
| type | No | Quote type: fixed-input (specify input amount, default) or fixed-output (specify desired output amount) | fixed-input |
| address | No | User Algorand address (optional, needed for auto opt-in detection) | |
| maxGroupSize | No | Maximum transactions in atomic group (default: 16) | |
| maxDepth | No | Maximum routing hops (default: 4) | |
| network | No | Algorand network to use (default: mainnet) | |
| itemsPerPage | No | Number of items per page for paginated responses (default: 10) |