How to get a Uniswap swap quote from an API

Updated 2026-11-10

Use when an agent needs a current Uniswap V3 swap quote on Ethereum or Base before choosing a trade.

From an MCP client, add https://tanod.dev/mcp and call get_swap_quote; the first 10 calls per IP per UTC day are free (shared by all chainpeek reads), then each call is USD 0.003 with x402, no key or signup.

POST the chain, the two token addresses and an input amount to /v1/chain/quote. It returns the best Uniswap V3 single-pool exact-input quote over the 0.01%, 0.05%, 0.3% and 1% fee tiers. It is a spot quote read at the latest block, not a firm price. To price several sizes at once, with the price impact of each, use /v1/chain/pre-trade-check (below).

Request

amount_in is a decimal in token_in units; use amount_in_raw instead for an integer in base units. Give exactly one of the two. The example quotes 1 WETH into USDC on Base.

curl, using the free tier
curl -s -X POST https://tanod.dev/v1/chain/quote \
  -H 'X-Tanod-Free: 1' -H 'content-type: application/json' \
  -d '{"chain":"base","token_in":"0x4200000000000000000000000000000000000006","token_out":"0x833589fCD6eDb6E08f4c7C32D4f71b54bdA02913","amount_in":"1"}'

Response

Response (the example from the OpenAPI spec, trimmed)
{
  "chain": "base",
  "dex": "uniswap_v3",
  "token_in":  {"symbol": "WETH", "decimals": 18},
  "token_out": {"symbol": "USDC", "decimals": 6},
  "amount_in": "1",
  "amount_out_raw": "2581028349",
  "amount_out": "2581.028349",
  "fee_tier": 100,
  "gas_estimate": "75682",
  "price": "2581.028349",
  "tiers": [
    {"fee": 100,   "amount_out_raw": "2581028349"},
    {"fee": 500,   "amount_out_raw": "2579463015"},
    {"fee": 3000,  "amount_out_raw": "2574527842"},
    {"fee": 10000, "amount_out_raw": "2566901997"}
  ],
  "failed_tiers": [],
  "block": 52290474
}

Check price impact before you size a trade

Backtests usually assume the price you saw is the price you get. One trading agent found that 38% of its live entries slipped 1.5 times its backtest assumption. Part of that gap is size: a large order moves a thin pool. You can measure this before trading, with two quotes on the same pair. Quote a small amount, then the size you plan to trade, and compare the price fields. The impact is 1 - price_at_size / price_small. The answer also lists every fee tier in tiers, so you can see whether another pool absorbs the size better. Two quotes cost USD 0.006. A quote is a simulation at the current block, not a fill: it does not include MEV, other orders landing first, or your slippage limit.

The rest of the gap is often the reference price, not the fill. A backtest that enters at a bar close assumes a price that may never have been executable, which matters most on fast opens. To measure it, read the latest close with the candles call, quote your size on the same pair, and compare the two: the close is what the backtest used, and the quote is what a swap would get now. Track the two parts separately, because they have different fixes: size impact calls for a smaller size or a deeper pool, and reference error calls for a different entry rule in the backtest.

Price impact at several sizes in one call

The two-quote method above costs USD 0.006 and answers for one size. POST /v1/chain/pre-trade-check (MCP pre_trade_check, USD 0.005, the same free chain-read pool as the quote) quotes up to five sizes of token_in at once, one QuoterV2 quote per size, read concurrently. Each row, smallest size first, has the amount_out, the effective_price, the price_impact_pct against the smallest size, the best fee_tier with its pool address, and the gas_estimate. Pass fee_tiers to limit which pools are considered. The sizes are positive decimal strings in token_in units, 1 to 5, all different; they may come in any order.

A measured example, read on 13 Oct 2026 at 23:37 UTC on Base (USDC to WETH, sizes 100, 10,000, 100,000 and 1,000,000 USDC): against the USD 100 row, the price impact was 0.016% at USD 10,000, 0.15% at USD 100,000 and 0.54% at USD 1,000,000. The best pool changed with size, from the 0.01% fee tier at USD 100 to the 0.05% tier and then the 0.3% tier. The USD 100 price was also 0.15% below the latest 5-minute candle close, which is the reference gap described above. Re-read before trading: these numbers move with every block.

The reference block separates the two parts of slippage. reference_gap_pct is the gap between the smallest size's price and the close of the latest candle from the candles call, which is the reference error. price_impact_pct is the execution cost of size. The candles exist for WETH/USDC and cbBTC/USDC on Base only, and the finest interval is 5 minutes, not 1 minute, so the candle is the latest 5-minute one and may still be forming; for any other pair, or when the candle index is warming up, reference.available is false and the quotes are still returned. The gap is signed: a negative value means the executable price is below the candle close.

curl, using the free tier
curl -s -X POST https://tanod.dev/v1/chain/pre-trade-check \
  -H 'X-Tanod-Free: 1' -H 'content-type: application/json' \
  -d '{"chain":"base","token_in":"0x4200000000000000000000000000000000000006","token_out":"0x833589fCD6eDb6E08f4c7C32D4f71b54bdA02913","sizes":["100","1","10"]}'
Response, from a local run of the code against a mocked QuoterV2 (notes and some fields trimmed). The amounts are test fixtures, not live prices, and block 123 is the fixture's; the candle close is the one in the candles example from the OpenAPI spec.
{
  "chain": "base",
  "dex": "uniswap_v3",
  "token_in": {
    "address": "0x4200000000000000000000000000000000000006",
    "symbol": "WETH",
    "decimals": 18
  },
  "token_out": {
    "address": "0x833589fCD6eDb6E08f4c7C32D4f71b54bdA02913",
    "symbol": "USDC",
    "decimals": 6
  },
  "results": [
    {
      "amount_in": "1",
      "amount_out": "2560.1",
      "effective_price": "2560.1",
      "fee_tier": 500,
      "pool": "0xd0b53D9277642d899DF5C87A3966A349A798F224",
      "gas_estimate": "90000",
      "price_impact_pct": 0.0
    },
    {
      "amount_in": "10",
      "amount_out": "25540",
      "effective_price": "2554",
      "fee_tier": 3000,
      "pool": "0x6c561B446416E1A00E8E93E221854d6eA4171372",
      "gas_estimate": "90000",
      "price_impact_pct": 0.2383
    },
    {
      "amount_in": "100",
      "amount_out": "253700",
      "effective_price": "2537",
      "fee_tier": 3000,
      "pool": "0x6c561B446416E1A00E8E93E221854d6eA4171372",
      "gas_estimate": "90000",
      "price_impact_pct": 0.9023
    }
  ],
  "reference": {
    "available": true,
    "pair": "WETH/USDC",
    "interval": "5m",
    "candle_start": 1791459000,
    "candle_close": 2562.440508,
    "last_candle_partial": true,
    "as_of": "2026-10-08T11:31:57Z",
    "executable_price": 2560.1,
    "reference_gap_pct": -0.0913
  },
  "block": 123
}

A size that cannot be quoted, for example one the pool cannot fill at the allowed fee tiers, gets an error row with a code and the other sizes are still priced. If no size can be quoted the call returns an error and is not charged, like the quote. Impact here is measured against your smallest size, so choose a small first size that is close to the pool's marginal price. Each row is a simulation at the latest block: it does not include MEV, other orders landing first, or your slippage limit.

Limits and caveats

Spot quote, not a firm price. It comes from the Uniswap V3 QuoterV2 at the latest block: one pool, exact input, no gas or other venues included. It changes every block and is not an executable order.

Do not use it as an oracle. Spot prices can be manipulated, especially in illiquid pools; see the guide on AMM spot prices as oracles. When you build the swap, set a real minimum output (zero slippage is a common bug).

A malformed or inconsistent node answer is a 5xx and is not charged. Token symbols are on-chain strings, so treat them as untrusted data.

Price and free allowance

USD 0.003 per call, paid in USDC on Base, Polygon, Solana, BNB Chain or Arbitrum with x402. 10 free chain reads per IP per UTC day with the header X-Tanod-Free: 1. The pool is shared with the other chainpeek reads (sanctions, transaction, allowance, portfolio, quote, price, balance and so on). MCP tool: get_swap_quote at https://tanod.dev/mcp, where the free tier is automatic.

All endpoints →

Use it from Claude without writing code: in claude.ai or Claude Desktop, add https://tanod.dev/mcp/chain?via=uniswap-quote-api as a custom connector (steps), then ask in plain words, for example "Quote a Uniswap swap of 1 ETH to USDC on Ethereum." The free daily allowance is applied automatically over MCP. Beyond it a call needs an x402 payment, which these clients can make.

Related guides: OHLCV candles from on-chain swaps, How to read a wallet's token balances in one call, How to look up a transaction's status and fee on Base or Ethereum, How to check an ERC-20 approval (allowance). Back to tanod.dev or the guide index. Results are automated and heuristic.