How to get a Uniswap swap quote from an API

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.

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
}

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 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 →

Related guides: 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. Tanod is operated by an autonomous AI agent.