{"uid":"cap_loJIjq2xEo_mctF4A_tUX","slug":"tokensense-x402-buy-token-b061993d","name":"TokenSense x402 Buy Token","description":"x402-paid TokenSense routes, with parallel MPP routes under /mpp/*.","url":"https://x402.wach.ai/buyToken","method":"POST","headers":{},"bodySchema":{"type":"object","properties":{"walletAddress":{"type":"string","pattern":"^0x[a-fA-F0-9]{40}$","description":"Recipient EVM wallet address that receives the purchased token."},"buyTokenAddress":{"type":"string","pattern":"^0x[a-fA-F0-9]{40}$","description":"Base token contract address to buy. Base native USDC is rejected."}}},"responseSchema":{"type":"json","example":{"chain":"base","route":"/buyToken","success":true,"execution":{"swapTxHash":"0x...","approvalTxHash":null,"transferTxHash":"0x...","tokenOutAmountFormatted":"0.001"},"walletAddress":"0x0000000000000000000000000000000000000000","buyTokenAddress":"0x4200000000000000000000000000000000000006","x402PaymentAssumption":{"feeUsdc":"0.02","swapUsdc":"0.48","totalUsdcPaid":"1.0"}}},"example":null,"exampleRequest":null,"tags":["x402"],"displayCostAmount":"0.5","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.5/call","primary":{"kind":"static","protocol":"x402","network":"base","amountUsd":"0.5","per":"call","confidence":"exact"},"accepted":[{"kind":"static","protocol":"x402","network":"base","amountUsd":"0.5","per":"call","confidence":"exact"}]},"paymentMethods":[{"uid":"pm_ZwmSboQahtNegdpKOaLej","protocol":"x402","methodType":"crypto","chain":"base","mode":"charge","costAmount":"0.5","costPer":"request","priority":0,"asset":"0x833589fCD6eDb6E08f4c7C32D4f71b54bdA02913","unit":"request","depositMicros":null,"planRef":null}],"brandName":null,"brandSlug":null,"brandBaseUrl":null,"brandDocsUrl":null,"whatItDoes":"Executes a token purchase on Base by swapping USDC for a specified ERC-20 token and transferring it to a recipient wallet, paid via x402 micropayment.","exampleAgentPrompt":"Buy me some WETH (contract 0x4200000000000000000000000000000000000006) on Base and send it to my wallet at 0xAbCd1234567890AbCd1234567890AbCd12345678 — use USDC to cover the swap.","exampleUseCases":[{"title":"Airdrop token to agent wallet","prompt":"Purchase some BASE token at contract 0x4200000000000000000000000000000000000006 and deliver it to my agent wallet 0xDEAD000000000000000042069420694206942069 — pay with USDC via the TokenSense API."},{"title":"Automate DCA token purchase","prompt":"Every time I trigger you, buy USDC-equivalent worth of the token at 0x833589fCD6eDb6E08f4c7C32D4f71b54bdA02913 on Base and send it to 0xABCDABCDABCDABCDABCDABCDABCDABCDABCDABCD."},{"title":"Fund wallet with specific ERC-20","prompt":"I need to get some of the token at Base contract 0x50c5725949A6F0c72E6C4a641F24049A917DB0Cb into wallet 0x1111111111111111111111111111111111111111 — go ahead and swap USDC for it using TokenSense."}],"resultDescription":"Returns a JSON object confirming the swap and transfer on Base, including the swap transaction hash, optional approval transaction hash, transfer transaction hash, the formatted amount of output tokens received, and a breakdown of the x402 payment showing the fee portion, swap portion, and total USDC paid.","failureModes":["Native Base USDC contract address submitted as buyTokenAddress — rejected by API","Invalid or malformed EVM wallet address (not matching 0x + 40 hex chars) returns validation error","Insufficient USDC balance in the x402 payment to cover fee + swap amount","Token contract does not exist or is not tradeable on Base DEX — swap fails","Network congestion or Base RPC error causes transaction failure","x402 payment not fulfilled or incorrect amount — endpoint returns 402 Payment Required"],"whenToPreferThis":"Use this endpoint when you need to programmatically purchase a specific ERC-20 token on Base chain and deliver it to a target wallet, paying with USDC via the x402 micropayment protocol. It is ideal for AI agents that need to automate token acquisition, fund wallets, or execute DeFi swaps without managing DEX interactions directly. Prefer it over generic DEX APIs when you want a single HTTP call that handles swap routing, approval, and transfer in one step with transparent fee breakdown.","instructions":null,"reviewSummary":null,"reviewSummaryHighlights":null,"reviewSummaryConcerns":null,"reviewSummaryGeneratedAt":null,"activationCount":0,"lastUsedAt":null,"lastSuccessfullyRanAt":null,"lastHealthCheckAt":"2026-09-19T06:32:51.746Z","isFirstParty":false}