💱Quotes

Overview

This API allows fetching quotes for token swaps and provides transaction data (calldata) for execution if the parameters slippageTolerance, deadline, and recipient are specified. This enables direct interaction with smart contracts.

Endpoint

URL: https://api.kodiak.finance/quote

Method: GET

Content Type: application/json

Query Parameters

ParameterRequiredDescription

protocols

✅

The protocols used for the swap. Possible values: v2, v3, mixed.

tokenInAddress

✅

Address of the input token for the swap.

tokenInChainId

✅

Chain ID of the input token.

tokenOutAddress

✅

Address of the output token for the swap.

tokenOutChainId

✅

Chain ID of the output token.

amount

✅

Amount of tokens to swap in humman terms

type

✅

Type of swap: exactIn (fixed input amount) or exactOut (fixed output amount).

recipient

❌

The address of the recipient of the swapped tokens. Required for generating calldata.

deadline

❌

Time in seconds until the transaction expires.

slippageTolerance

❌

Allowed slippage percentage as an integer (e.g., 1 for 1%).

Example Request

GET https://api.kodiak.finance/quote?protocols=v2%2Cv3%2Cmixed&tokenInAddress=0x7507c1dc16935B82698e4C63f2746A2fCf994dF8&tokenInChainId=80084&tokenOutAddress=0x1740F679325ef3686B2f574e392007A92e4BeD41&tokenOutChainId=80084&amount=40862354775778842528071&type=exactIn&recipient=0xA54e745BFf14816Ec6D323d894E7861b6Ef3F2aE&deadline=1000&slippageTolerance=1

Example response

{
  "blockNumber": "7067071",
  "amount": "1000000000000000000000",
  "amountDecimals": "1000",
  "quote": "55837913683147237796",
  "quoteDecimals": "55.837913683147237796",
  "quoteGasAdjusted": "55840267836750092796",
  "quoteGasAdjustedDecimals": "55.840267836750092796",
  "gasUseEstimateQuote": "2354153602855000",
  "gasUseEstimateQuoteDecimals": "0.002354153602855",
  "gasUseEstimate": "443000",
  "gasUseEstimateUSD": "0.041844",
  "gasPriceWei": "5314116485",
  "route": [
    [
      {
        "type": "v3-pool",
        "address": "0x8a960A6e5f224D0a88BaD10463bDAD161b68C144",
        "tokenIn": {
          "chainId": 80084,
          "decimals": "18",
          "address": "0x7507c1dc16935B82698e4C63f2746A2fCf994dF8",
          "symbol": "WBERA"
        },
        "tokenOut": {
          "chainId": 80084,
          "decimals": "18",
          "address": "0x0E4aaF1351de4c0264C5c7056Ef3777b41BD8e03",
          "symbol": "HONEY"
        },
        "fee": "3000",
        "liquidity": "2436507486332335185500775",
        "sqrtRatioX96": "18720675063184587718540484748",
        "tickCurrent": "-28856",
        "amountIn": "53049022487390937786",
        "amountOut": "950000000000000000000"
      }
    ],
    [
      {
        "type": "v3-pool",
        "address": "0xe49E094fe1679624C3981EB821fA6aB46c99E18E",
        "tokenIn": {
          "chainId": 80084,
          "decimals": "18",
          "address": "0x7507c1dc16935B82698e4C63f2746A2fCf994dF8",
          "symbol": "WBERA"
        },
        "tokenOut": {
          "chainId": 80084,
          "decimals": "18",
          "address": "0x0E4aaF1351de4c0264C5c7056Ef3777b41BD8e03",
          "symbol": "HONEY"
        },
        "fee": "500",
        "liquidity": "1785423513716355823391",
        "sqrtRatioX96": "18718672899386852222700719036",
        "tickCurrent": "-28858",
        "amountIn": "2788891195756300010",
        "amountOut": "50000000000000000000"
      }
    ]
  ],
  "routeString": "[V3] 95.00% = WBERA -- 0.3% [0x8a960A6e5f224D0a88BaD10463bDAD161b68C144] --\u003E HONEY, [V3] 5.00% = WBERA -- 0.05% [0xe49E094fe1679624C3981EB821fA6aB46c99E18E] --\u003E HONEY",
  "quoteId": "a6d10"
}

Last updated