{"uid":"cap__R8R8YdMQgBANfAuQUSXC","slug":"on-chain-dex-swap-quote-base-9d7decc5","name":"On-Chain DEX Swap Quote (Base)","description":"Pay-per-call on-chain API for AI agents and developers: wallet audits, token safety audits (honeypot detection), live gas prices, token prices, transaction receipts, balances, ENS resolution, block data, ERC-20 allowances, transaction simulation, swap quotes and multicall batches — all computed on-chain via public RPCs (no external market API). Pay per request in USDC on Base via the x402 exact scheme (EIP-3009 transferWithAuthorization). No API key, no signup, no subscription.","url":"https://x402-audit.tatschluizguilherme.workers.dev/swap","method":"GET","headers":{},"bodySchema":null,"responseSchema":{"type":"json","example":{"note":"Quote on current block state, constant-product within the current tick (V3) / 0.3% fee (V2). priceImpactPct includes pool fees; slippagePct is the price movement only. Execution on a router may differ; use minOut as your slippage guard.","route":[{"fee":3000,"kind":"uniswap-v3","pool":"0x6c561b446416e1a00e8e93e221854d6ea4171372","amountIn":"1000000","amountOut":"532154915082329"}],"feePct":0.3,"minOut":{"slippage1":"526833365931505","slippage0_5":"529494140693067"},"network":"base","tokenIn":{"symbol":"USDC","address":"0x833589fcd6edb6e08f4c7c32d4f71b54bda02913","decimals":6},"amountIn":{"wei":"1000000","formatted":"1"},"tokenOut":{"symbol":"WETH","address":"0x4200000000000000000000000000000000000006","decimals":18},"amountOut":{"wei":"532154915082329","formatted":"0.00053215"},"spotPrice":"0.00053375","routeFound":true,"blockNumber":24400123,"requestedAt":"2026-08-05T01:50:00.000Z","slippagePct":0,"executionPrice":"0.00053215","priceImpactPct":0.3}},"example":null,"exampleRequest":null,"tags":["x402"],"displayCostAmount":"0.1","displayCostAsset":"USDC","priceDynamic":false,"priceHint":null,"priceStatus":"priced","priceSource":"registry","requiresHandshake":false,"reviewCount":0,"rating":{"score":"0.00","successRate":"0.00","reviews":0,"stars":null,"state":"unrated"},"availabilityStatus":"unknown","priceObserved":null,"sessionDeposit":null,"pricing":{"kind":"static","summary":"$0.1/call","primary":{"kind":"static","protocol":"x402","network":"base","amountUsd":"0.1","per":"call","confidence":"exact"},"accepted":[{"kind":"static","protocol":"x402","network":"base","amountUsd":"0.1","per":"call","confidence":"exact"}]},"paymentMethods":[{"uid":"pm_BIr8bKrhlvUaUrkETZTlF","protocol":"x402","methodType":"crypto","chain":"base","mode":"charge","costAmount":"0.1","costPer":"request","priority":0,"asset":null,"unit":"request","depositMicros":null,"planRef":null}],"brandName":null,"brandSlug":null,"brandBaseUrl":null,"brandDocsUrl":null,"whatItDoes":"Returns swap quote (amountOut, spot price, price impact, minOut slippage guards) for any ERC-20 pair on Base using Uniswap V3 or Aerodrome V2 pool reserves","exampleAgentPrompt":"Can you get me a swap quote for converting 1000 USDC to WETH on Base — I want to see the amountOut, spot price, price impact, and the minimum I'd receive with 0.5% slippage protection?","exampleUseCases":[{"title":"Pre-trade price impact check","prompt":"Before I swap 50,000 USDC into cbETH on Base, can you tell me what amountOut I'd get, what the price impact is, and what my minimum received would be at 1% slippage tolerance?"},{"title":"Arbitrage route evaluation","prompt":"I want to compare DEX rates on Base — can you get me a swap quote for 10 WETH to USDC and tell me whether it routes through Uniswap V3 or Aerodrome V2 and what pool is used?"},{"title":"Bot slippage guard calculation","prompt":"My trading bot needs to set a minOut value before submitting a swap of 500 DAI to WBTC on Base — can you calculate the amountOut and both the 0.5% and 1% slippage-protected minimums using current pool reserves?"}],"resultDescription":"Returns the computed amountOut for the given amountIn, the spot price between the two tokens, the price impact percentage of the trade, minimum output amounts at 0.5% and 1% slippage thresholds, and the DEX route used (direct Uniswap V3 pool, Aerodrome V2 pool, or WETH-intermediated route) — all derived from on-chain pool reserves without calling any external market price API.","failureModes":["No liquidity pool found for the requested token pair — returns error if neither direct nor WETH-routed pool exists on Base","Invalid token address — returns error if tokenIn or tokenOut is not a valid ERC-20 contract on Base","Zero or negative amountIn — returns validation error","RPC connectivity issue with Base network — may return timeout or internal error","Token pair exists but pool has insufficient liquidity to price the trade accurately"],"whenToPreferThis":"Choose this endpoint when you need an on-chain, trustless swap quote computed directly from pool reserves on Base — particularly when you want Uniswap V3 best-liquidity-pool selection or Aerodrome V2 routing with automatic WETH fallback, and need slippage guards (minOut) baked into the response. Prefer this over market price APIs when you need the actual executable DEX price rather than a reference price, or when building a trading bot that must set minOut before submitting a transaction.","instructions":null,"reviewSummary":null,"reviewSummaryHighlights":null,"reviewSummaryConcerns":null,"reviewSummaryGeneratedAt":null,"activationCount":0,"lastUsedAt":null,"lastSuccessfullyRanAt":null,"lastHealthCheckAt":"2026-09-16T00:41:00.016Z","isFirstParty":false}