Catalog/chain-swap-quote

Chain

DEX swap quote & price impact API

Quote a token swap on Uniswap V2-style pools: expected output, price impact, route (direct or via WETH), and fee — from live pool reserves. Saves the agent pool discovery, reserve reads, decimals handling, and constant-product math. Answers queries like 'how much USDC for 1 ETH', 'price impact of swapping X for Y', 'best rate to swap these tokens'.

Price$0.01per request
MethodPOST
Route/v1/chain/swap-quote
StatusLive
MIME typeapplication/json
Rate limit90/minute
Cache15s public
chaindefiswapdexprice-impactuniswaptrading
API URLhttps://x402.hexl.dev/v1/chain/swap-quote
Integration docs
Example request
{
  "tokenIn": "0x4200000000000000000000000000000000000006",
  "tokenOut": "0x833589fCD6eDb6E08f4c7C32D4f71b54bdA02913",
  "amountIn": "1",
  "chain": "base"
}
Example response
{
  "chain": "base",
  "tokenIn": "0x4200000000000000000000000000000000000006",
  "tokenOut": "0x833589fcd6edb6e08f4c7c32d4f71b54bda02913",
  "amountIn": "1",
  "amountOut": "2500.12",
  "route": [
    "0x4200000000000000000000000000000000000006",
    "0x833589fcd6edb6e08f4c7c32d4f71b54bda02913"
  ],
  "priceImpactPercent": 0.08,
  "feePercent": 0.3,
  "warnings": [],
  "interpretation": "Swapping 1 gets about 2500.12. Price impact ~0.08% on a 0.3% fee route.",
  "checkedAt": "2026-06-02T00:00:00.000Z"
}
Input schema
{
  "type": "object",
  "required": [
    "tokenIn",
    "tokenOut",
    "amountIn"
  ],
  "properties": {
    "tokenIn": {
      "type": "string",
      "pattern": "^0x[0-9a-fA-F]{40}$"
    },
    "tokenOut": {
      "type": "string",
      "pattern": "^0x[0-9a-fA-F]{40}$"
    },
    "amountIn": {
      "type": "string",
      "examples": [
        "1.5",
        "1000"
      ]
    },
    "chain": {
      "type": "string",
      "enum": [
        "base",
        "ethereum"
      ],
      "default": "base"
    }
  }
}
Output schema
{
  "type": "object",
  "required": [
    "chain",
    "tokenIn",
    "tokenOut",
    "amountIn",
    "route",
    "feePercent",
    "interpretation"
  ],
  "properties": {
    "chain": {
      "type": "string"
    },
    "tokenIn": {
      "type": "string"
    },
    "tokenOut": {
      "type": "string"
    },
    "amountIn": {
      "type": "string"
    },
    "amountOut": {
      "type": [
        "string",
        "null"
      ]
    },
    "route": {
      "type": "array",
      "items": {
        "type": "string"
      }
    },
    "priceImpactPercent": {
      "type": [
        "number",
        "null"
      ]
    },
    "feePercent": {
      "type": "number"
    },
    "warnings": {
      "type": "array",
      "items": {
        "type": "string"
      }
    },
    "interpretation": {
      "type": "string"
    },
    "checkedAt": {
      "type": "string"
    }
  }
}