{"slug":"x402-ottoai-services-swap-df45d4","title":"Execute instant same-chain token swaps through LI.FI's DEX aggregation","host":"x402.ottoai.services","method":"POST","resource":"https://x402.ottoai.services/swap","category":"code","description":"Execute instant same-chain token swaps through LI.FI's DEX aggregation. Supports Base, Ethereum, Polygon, BSC, Arbitrum, Avalanche, and Solana, with best-route execution across major DEXes and liquidity sources.","price_listed":0.01,"price_asked":null,"state":"effects","state_label":"Not tested: has real-world effects","checks_7d":0,"answered_7d":0,"latency_ms_median":null,"reported_calls_30d":3,"reported_payers_30d":2,"networks":["eip155:8453"],"badge":"unverified","paid_checks_7d":0,"paid_ok_7d":0,"example_input":{"body":{"amount":10,"chainId":8453,"fromSymbol":"USDC","toSymbol":"WETH"},"bodyType":"json","method":"POST","type":"http"},"output_schema":{"$schema":"https://json-schema.org/draft/2020-12/schema","properties":{"input":{"additionalProperties":false,"properties":{"body":{"properties":{"amount":{"description":"Amount of the FROM token to sell (human-readable, e.g. 10.5). Decimals are derived server-side — do NOT send fromDecimals/toDecimals.","type":"number"},"chainId":{"description":"Chain ID: 1 (ETH), 56 (BSC), 137 (Polygon), 8453 (Base, default), 42161 (Arbitrum), 43114 (Avalanche), 1151111081099710 (Solana)","type":"number"},"deliverToButler":{"description":"If true, forward swapped tokens to user's main wallet after swap (default: false, keeps in Safe)","type":"boolean"},"fromSymbol":{"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.","type":"string"},"fromTokenAddress":{"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.","type":"string"},"maxSlippagePercent":{"description":"Optional override for slippage tolerance (default 5%)","type":"number"},"toSymbol":{"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.","type":"string"},"toTokenAddress":{"description":"TO token contract address (alternative to toSymbol; RECOMMENDED).","type":"string"},"tokenSource":{"description":"Where to source input tokens: butler_wallet (pull all), otto_safe (Safe only), auto (default)","enum":["butler_wallet","otto_safe","auto"],"type":"string"}},"required":["fromSymbol","toSymbol","amount"],"type":"object"},"bodyType":{"enum":["json","form-data","text"],"type":"string"},"method":{"enum":["POST"],"type":"string"},"type":{"const":"http","type":"string"}},"required":["type","method","bodyType","body"],"type":"object"},"output":{"properties":{"example":{"properties":{"amountIn":{"description":"In the token's smallest unit","type":"string"},"amountOut":{"description":"Present once final. In the token's smallest unit","type":"string"},"entryPrice":{"description":"Present once final","type":"number"},"finality":{"type":"string"},"safeAddress":{"type":"string"},"status":{"type":"string"},"txHash":{"type":"string"},"userOpHash":{"type":"string"}},"required":["status"],"type":"object"},"type":{"type":"string"}},"required":["type"],"type":"object"}},"required":["input"],"type":"object"},"history":[],"description_full":"Execute instant same-chain token swaps through LI.FI's DEX aggregation. Supports Base, Ethereum, Polygon, BSC, Arbitrum, Avalanche, and Solana, with best-route execution across major DEXes and liquidity sources.","last_updated":"2026-10-08T11:46:40.15Z","schemes":["exact"]}