Swap
Get Swap Quotes
Fetch optimized swap quotes across all Starknet liquidity sources
GET
Overview
The quotes endpoint returns the best available swap routes with unique quote IDs for execution. Each quote includes:- Optimized routing across multiple DEXs
- Gas estimation and fees
- Slippage protection
Request
Token address to sell (hex format)
Token address to buy (hex format)
The amount of token user wants to sell.
Either
sellAmount or buyAmount requiredThe exact amount of token user wants to buy.
Either
sellAmount or buyAmount requiredAddress that will execute the swap
Maximum number of quotes to return (range: 1-5)
Fee in basis points (e.g., “30” for 0.3%). When specified,
integratorFeeRecipient and integratorName are required.Address to receive integrator fees. Required when
integratorFees is specified.Your integration identifier for tracking
If true, only return direct swap routes (no multi-hop)
Response
Unique identifier for executing this quote (UUID)
Token address being sold
Amount of token to sell (hex format)
USD value of sell amount
Token address being purchased
Amount of token to receive (hex format). Already includes all fees.
USD value of buy amount
Fee breakdown for the swap
Network identifier (e.g., “0x534e5f4d41494e”)
Block at which quote was generated (hex format)
Unix timestamp when quote expires in seconds
Swap routing paths with protocol details
Estimated gas cost in STRK (hex format)
Gas fees converted to USD
Price impact in basis points (e.g., 20 = 0.2%). Negative value indicates loss. Divide by 100 to get percentage.
Current market price of sell token in USD
Current market price of buy token in USD
Projected slippage percentage
Best Practices
Quote Expiration
Quote Expiration
With Starknet’s block time of ~2 seconds, quotes become stale after just 1 block. Refresh quotes every 2-3 blocks before execution.
Error Handling
Error Handling
Handle cases where no routes are available due to insufficient liquidity.