{"uid":"cap_dBoJ6hpn3Cx6bizg27WAj","slug":"otto-ai-defi-token-swap-e14e124a","name":"Otto AI DeFi Token Swap","description":"Execute instant same-chain ERC-20 swaps via Odos DEX aggregator. Supports Base, Ethereum, Polygon, BSC, Arbitrum, Avalanche, and Solana. Best-route execution across dozens of DEXes and liquidity sources.","url":"https://x402.ottoai.services/swap","method":"POST","headers":{},"bodySchema":{"type":"object","properties":{"amount":{"type":"number","description":"Amount of the FROM token to sell (human-readable, e.g. 10.5). Decimals are derived server-side — do NOT send fromDecimals/toDecimals."},"chainId":{"type":"number","description":"Chain ID: 1 (ETH), 56 (BSC), 137 (Polygon), 8453 (Base, default), 42161 (Arbitrum), 43114 (Avalanche), 1151111081099710 (Solana)"},"toSymbol":{"type":"string","description":"TO token: a known symbol (e.g. WETH, USDC — use WETH, not native ETH) OR a 0x contract address, resolved on the given chain. Ambiguous symbols are rejected with candidates."},"fromSymbol":{"type":"string","description":"FROM token: a known symbol (e.g. USDC, WETH) OR a 0x contract address, resolved on the given chain. Ambiguous symbols are rejected (HTTP 400) with candidate addresses — send the address to disambiguate."},"tokenSource":{"enum":["butler_wallet","otto_safe","auto"],"type":"string","description":"Where to source input tokens: butler_wallet (pull all), otto_safe (Safe only), auto (default)"},"toTokenAddress":{"type":"string","description":"TO token contract address (alternative to toSymbol; RECOMMENDED)."},"deliverToButler":{"type":"boolean","description":"If true, forward swapped tokens to user's main wallet after swap (default: false, keeps in Safe)"},"fromTokenAddress":{"type":"string","description":"FROM token contract address (alternative to fromSymbol; RECOMMENDED to avoid symbol ambiguity). If both are sent and they resolve to different tokens, the request is rejected."},"maxSlippagePercent":{"type":"number","description":"Optional override for slippage tolerance (default 5%)"}}},"responseSchema":{"type":"json","example":{"success":true,"explorerUrl":"https://basescan.org/tx/0x...","outputToken":"WETH","outputAmount":"0.00335","transactionHash":"0x..."}},"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_Hg1Vuniwb16f1ULSm-ews","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":"Executes an on-chain token swap via DeFi protocols, returning the transaction hash, output token, and amount received","exampleAgentPrompt":"Swap 10 USDC for WETH on Base using my Otto AI account and show me the transaction hash when it's done.","exampleUseCases":[{"title":"Rebalance portfolio across DeFi protocols","prompt":"I need to move 50 USDC into WETH right now on Base to rebalance my portfolio—execute the swap and give me the transaction hash so I can verify it on Basescan."},{"title":"Execute time-sensitive arbitrage opportunity","prompt":"I found an arbitrage spread between USDC and WETH on Polygon. Swap 100 USDC for WETH immediately and show me the on-chain transaction details."},{"title":"Programmatic token conversion for automation","prompt":"Set up a recurring workflow where you swap 5 USDC for SOL on Solana every hour—just execute the first swap now and give me the hash to confirm it worked."}],"resultDescription":"A JSON object with success status (true/false), the output token symbol (e.g. WETH), the output amount received (e.g. 0.00335), the on-chain transaction hash (0x...), and a block explorer URL (e.g. basescan.org link) to verify the trade.","failureModes":["Insufficient token balance — swap fails if wallet lacks input token funds","Slippage exceeded — trade rejected if price moves beyond tolerance","Unsupported token pair — not all token combinations may be routable","Chain mismatch — incorrect chain specification causes routing failure","Payment failure — x402 USDC micropayment not processed, call not executed","Smart contract error — on-chain revert returns success:false with no txHash"],"whenToPreferThis":"Use this endpoint when an AI agent needs to programmatically execute an actual on-chain DeFi token swap (not just quote a price) and receive a verifiable transaction hash. Prefer this over CEX APIs when self-custody and on-chain settlement on Base, Polygon, or Solana are required. Pay-per-call at $0.01 USDC via x402 makes it suitable for automated workflows without subscription overhead.","instructions":null,"reviewSummary":null,"reviewSummaryHighlights":null,"reviewSummaryConcerns":null,"reviewSummaryGeneratedAt":null,"activationCount":0,"lastUsedAt":null,"lastSuccessfullyRanAt":null,"lastHealthCheckAt":"2026-09-16T06:44:33.145Z","isFirstParty":false}