amountIn is the input size you request. amountOut is the simulated expected output returned in the quote. When the response includes minAmountOut, that is the protected floor to show the user, not the expected amount.
Definition
A quote always starts from how much you spend. The API then simulates the selected path and returns how much of tokenOut that path is expected to deliver, after the current route, fees, and slippage treatment.
How it works
Send
amountInin the token’s smallest base unit, as a decimal string, not as a JavaScript number.Read
amountOutfrom the Route or Bundle response and show it as an estimate.Show
minAmountOut(or BundleminAmountsOut) when the response includes it, as the minimum the transaction should allow.On async redeem routes, top-level
amountOutandminAmountOutcan be null. Use theasyncobject’s estimated fields instead.
How Enso does this
Route returns amountOut (and gas, route, and tx) from an internal quote and simulation in the same call. Bundle can return amountsOut and minAmountsOut when quoting is enabled. See DeFi and Swap Routing and the FAQ. Do not assume amountOut is a mid-market price.
FAQ
Why is amountOut lower than a mid-market conversion?
The value comes from a simulation of the current path, after slippage treatment, fees, and price impact. Inspect priceImpact and fee fields rather than a spot price.
Can I set amountOut in the request?
You request amountIn and, for protection, either slippage or minAmountOut. The expected amountOut is a response field.
Related articles
What is tokenIn and tokenOut?
What is minAmountOut?
What is price impact?
Why is amountOut lower than I expected?
What is the difference between Route amountOut and Quoter amountOut?
