Skip to content

Get Swap Quotes

The Router's /quote endpoint computes optimal swap routes across Ryze pools, returning amounts, fees, price impact, and oracle prices.

Endpoint

POST https://mainnet.router.ryze.pro/quote

Request

json
{
  "tokenIn": "0x833589fCD6eDb6E08f4c7C32D4f71b54bdA02913",
  "tokenOut": "0x4200000000000000000000000000000000000006",
  "amountIn": "100000000",
  "slippageTolerance": 50,
  "maxHops": 3,
  "userAddress": "0xYourWalletAddress"
}
FieldTypeRequiredDescription
tokenInstringYesInput token address
tokenOutstringYesOutput token address
amountInstringExactly one of amountIn/amountOutExact input amount (raw units)
amountOutstringExactly one of amountIn/amountOutDesired output amount (raw units)
slippageTolerancenumberYesSlippage in basis points (50 = 0.5%)
maxHopsnumberYesMaximum hops in the route (1-3)
userAddressstringNoWallet address for TSP session lookup
preferredTokensstring[]NoPreferred intermediate tokens
excludedPoolsstring[]NoPools to exclude from routing

TIP

Always pass userAddress when quoting for a specific user. This enables Trade Slicing Protection (TSP), which adjusts fees based on the user's recent trading session.

Example

bash
# Swap 100 USDC -> WETH
curl -X POST https://mainnet.router.ryze.pro/quote \
  -H "Content-Type: application/json" \
  -d '{
    "tokenIn": "0x833589fCD6eDb6E08f4c7C32D4f71b54bdA02913",
    "tokenOut": "0x4200000000000000000000000000000000000006",
    "amountIn": "100000000",
    "slippageTolerance": 50,
    "maxHops": 3,
    "userAddress": "0xd8dA6BF26964aF9D7eEd9e03E53415D37aA96045"
  }'

Response

json
{
  "routeId": "a1b2c3d4",
  "type": "single_hop",
  "input": {
    "token": "0x833589fCD6eDb6E08f4c7C32D4f71b54bdA02913",
    "amount": "100000000",
    "decimals": 6
  },
  "output": {
    "token": "0x4200000000000000000000000000000000000006",
    "amount": "62500000000000000",
    "decimals": 18
  },
  "path": [
    "0x833589fCD6eDb6E08f4c7C32D4f71b54bdA02913",
    "0x4200000000000000000000000000000000000006"
  ],
  "steps": [
    {
      "pool": "0x7B41aA91947398CD9244AD4e314C253D9B1B5206",
      "tokenIn": "0x833589fCD6eDb6E08f4c7C32D4f71b54bdA02913",
      "tokenOut": "0x4200000000000000000000000000000000000006",
      "amountIn": "100000000",
      "amountOut": "62500000000000000",
      "priceImpact": "100000000000000",
      "fees": {
        "swapFee": "30000",
        "swapFeePct": "300000000000000",
        "takerFee": "10000",
        "takerFeePct": "100000000000000",
        "slippageFee": "5000",
        "slippagePct": "50000000000000",
        "wbfFee": "0",
        "wbfFeePct": "0",
        "wbrReward": "2000",
        "token": "0x833589fCD6eDb6E08f4c7C32D4f71b54bdA02913"
      }
    }
  ],
  "totalFees": { ... },
  "incentive": {
    "maxBps": 75,
    "displayPct": "0.075%",
    "tokenOut": "0x4200000000000000000000000000000000000006",
    "isImproving": true
  },
  "priceImpact": "100000000000000",
  "spotPrice": "1600000000000000000000",
  "executionPrice": "1599840000000000000000",
  "confidence": 1.0,
  "timestamp": "2026-04-15T12:00:00Z",
  "prices": [
    {
      "token": "0x833589fCD6eDb6E08f4c7C32D4f71b54bdA02913",
      "pythPrice": "1000000000000000000",
      "cexPrice": "1000000000000000000",
      "blendFactor": "500000000000000000",
      "blendedPrice": "1000000000000000000"
    },
    {
      "token": "0x4200000000000000000000000000000000000006",
      "pythPrice": "1600000000000000000000",
      "cexPrice": "1600500000000000000000",
      "blendFactor": "500000000000000000",
      "blendedPrice": "1600250000000000000000"
    }
  ]
}

Response Fields

Top-Level

FieldDescription
routeIdUnique route identifier
type"single_hop" or "multi_hop"
input / outputToken address, raw amount, and decimals
pathOrdered array of token addresses in the route
stepsPer-hop breakdown (pool, amounts, fees)
priceImpactOverall price impact in WAD
spotPriceOracle spot price (tokenOut per tokenIn) in WAD
executionPriceEffective execution price in WAD
confidenceRoute confidence (0-1)
pricesOracle price data for each token

Fee Breakdown (per step)

FieldDescription
swapFee / swapFeePctBase swap fee (amount + WAD percentage)
takerFee / takerFeePctTaker fee
slippageFee / slippagePctDynamic slippage fee based on trade size
wbfFee / wbfFeePctWeight Breaking Fee (penalizes imbalancing trades)
wbrRewardWeight Breaking Reward (incentivizes rebalancing trades)
tokenAddress of the fee token

Incentive

The incentive object indicates potential Weight Breaking Reward:

FieldDescription
maxBpsMaximum incentive in basis points
displayPctHuman-readable percentage string
isImprovingWhether the trade improves pool balance

Prices

Each entry in prices shows how the oracle price is computed:

FieldDescription
pythPricePyth oracle price in WAD
cexPriceCEX reference price in WAD
blendFactorBlend ratio (0 = pure Pyth, 1e18 = pure CEX)
blendedPriceFinal blended price used for the quote

Response Headers

HeaderDescription
X-Processing-Time-UsTotal processing time in microseconds
X-Route-Time-UsRoute-finding time in microseconds

Converting Amounts

To convert raw amounts to human-readable values:

javascript
// USDC (6 decimals): 100000000 -> 100.0
const usdcAmount = Number(BigInt(raw)) / 10 ** 6;

// WETH (18 decimals): 62500000000000000 -> 0.0625
const wethAmount = Number(BigInt(raw)) / 10 ** 18;

// WAD percentage to percent: 300000000000000 -> 0.03%
const pct = Number(BigInt(wadPct)) / 10 ** 18 * 100;