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
string
required
Token address to sell (hex format)
string
required
Token address to buy (hex format)
string
The amount of token user wants to sell.
Either
sellAmount or buyAmount requiredstring
The exact amount of token user wants to buy.
Either
sellAmount or buyAmount requiredstring
Address that will execute the swap
integer
Maximum number of quotes to return (range: 1-5)
string
Fee in basis points (e.g., “30” for 0.3%). When specified,
integratorFeeRecipient and integratorName are required.string
Address to receive integrator fees. Required when
integratorFees is specified.string
Your integration identifier for tracking
boolean
If true, only return direct swap routes (no multi-hop)
Response
string
required
Unique identifier for executing this quote (UUID)
string
required
Token address being sold
string
required
Amount of token to sell (hex format)
number
required
USD value of sell amount
string
required
Token address being purchased
string
required
Amount of token to receive (hex format). Already includes all fees.
number
required
USD value of buy amount
object
required
Fee breakdown for the swap
string
required
Network identifier (e.g., “0x534e5f4d41494e”)
string
Block at which quote was generated (hex format)
number
Unix timestamp when quote expires in seconds
array
required
Swap routing paths with protocol details
string
required
Estimated gas cost in STRK (hex format)
number
Gas fees converted to USD
number
required
Price impact in basis points (e.g., 20 = 0.2%). Negative value indicates loss. Divide by 100 to get percentage.
number
Current market price of sell token in USD
number
Current market price of buy token in USD
number
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.