{"uid":"cap_RbFdSc9kusCSYpxyZMZMl","slug":"flow-best-execution-swap-quote-49e393cb","name":"Flow Best-Execution Swap Quote","description":"Use when an agent is about to swap on Base and needs the best executable price before committing funds. Flow best-execution quotes: compares Uniswap V3 and Aerodrome across fee tiers and returns the best venue, expected output, edge vs Uniswap baseline, block number, and an expiry window so the agent knows exactly how long the price holds.","url":"https://flow-kg4x.vercel.app/api/quote?utm_source=zero.xyz","method":"POST","headers":{},"bodySchema":{"type":"object","$schema":"https://json-schema.org/draft/2020-12/schema","required":["input"],"properties":{"input":{"type":"object","required":["type","method","bodyType","body"],"properties":{"body":{"type":"object"},"type":{"type":"string","const":"http"},"method":{"enum":["GET","POST","PUT","PATCH"],"type":"string"},"headers":{"type":"object","additionalProperties":{"type":"string"}},"bodyType":{"enum":["json","form-data","text"],"type":"string"},"queryParams":{"type":"object","additionalProperties":{"type":"string"}}},"additionalProperties":false},"output":{"type":"object","required":["type"],"properties":{"type":{"type":"string"},"example":{"type":"object"}}}}},"responseSchema":{"type":"json","example":{"venue":"aerodrome","bestOut":"396812","edgeBps":12,"protocolFee":"25% of price improvement over Uniswap baseline"}},"example":null,"exampleRequest":null,"tags":["x402"],"displayCostAmount":"0.01","displayCostAsset":"USDC","priceDynamic":false,"priceHint":null,"priceStatus":"priced","priceSource":"probe","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.01/call","primary":{"kind":"static","protocol":"x402","network":"base","amountUsd":"0.01","per":"call","confidence":"exact"},"accepted":[{"kind":"static","protocol":"x402","network":"base","amountUsd":"0.01","per":"call","confidence":"exact"}]},"paymentMethods":[{"uid":"pm_uEO6ozm-mwyWPc85T_ULh","protocol":"x402","methodType":"crypto","chain":"base","mode":"charge","costAmount":"0.01","costPer":"request","priority":0,"asset":"0x833589fCD6eDb6E08f4c7C32D4f71b54bdA02913","unit":"request","depositMicros":null,"planRef":null}],"brandName":null,"brandSlug":null,"brandBaseUrl":null,"brandDocsUrl":null,"whatItDoes":"Returns the best-execution swap quote on Base by comparing Uniswap V3, PancakeSwap V3, and Aerodrome across fee tiers and two-hop routes via WETH","exampleAgentPrompt":"Before I swap 500 USDC to ETH on Base, get me a best-execution quote that compares Uniswap V3, PancakeSwap V3, and Aerodrome including two-hop routes — I want to know which venue wins, how much ETH I'd get, and how long the price is good for.","exampleUseCases":[{"title":"Pre-trade venue selection for DeFi agent","prompt":"I'm about to swap 2000 USDC to WETH on Base — check all the DEXes including Aerodrome and Uniswap V3 and tell me which one gives the best output amount and how much better it is than the Uniswap baseline."},{"title":"MEV-aware routing for treasury rebalancing","prompt":"I need to rebalance our treasury by swapping 10,000 USDC to cbETH on Base. Can you find the best-execution route across Uniswap, PancakeSwap, and Aerodrome, including any two-hop paths through WETH, and tell me the expected output and how long the quote is valid?"},{"title":"Monitoring swap edge for arbitrage detection","prompt":"For a 5000 DAI to USDC swap on Base, what venue is currently offering the best rate and how many basis points of edge does it have over the Uniswap baseline right now?"}],"resultDescription":"Returns a JSON object containing: the winning venue name (e.g. 'aerodrome', 'uniswap_v3', 'pancakeswap_v3'), the best expected output amount in token units, the edge in basis points over the Uniswap V3 baseline, the protocol fee (25% of price improvement), the block number the quote was computed at, and an expiry window indicating how long the quote remains valid.","failureModes":["Unsupported token pair — returns error if no liquidity path exists across any compared venue","Stale block data — quote may expire before agent can act if network is congested","Invalid input schema — missing required body fields causes 400-level error","Insufficient liquidity — large swap sizes may return degraded or no quote if pool depth is too low","Payment failure — x402 micropayment of $0.01 USDC must succeed or request is rejected"],"whenToPreferThis":"Choose this endpoint when an AI agent is operating on the Base blockchain and needs to determine the optimal DEX venue before executing a token swap. It is superior to querying individual DEX APIs because it aggregates Uniswap V3, PancakeSwap V3, and Aerodrome in a single call, considers multiple fee tiers, and includes two-hop routing via WETH. Use it as a pre-trade check to minimize slippage and maximize output. Prefer it over on-chain simulation when you need a fast, off-chain best-execution signal with a clear expiry window and a quantified edge metric versus a Uniswap baseline.","instructions":null,"reviewSummary":null,"reviewSummaryHighlights":null,"reviewSummaryConcerns":null,"reviewSummaryGeneratedAt":null,"activationCount":0,"lastUsedAt":null,"lastSuccessfullyRanAt":null,"lastHealthCheckAt":"2026-10-16T00:38:20.073Z","isFirstParty":false,"canonicalSlug":"flow-best-execution-swap-quote-49e393cb"}