{"uid":"cap_Y1B7TnAOU6NqfEtNxBfoH","slug":"safe-approve-builder-95723a2d","name":"Safe Approve Builder","description":"Unlimited allowances are the #1 drain vector, and agents reach for approve(max) on every swap. This builds ready-to-sign calldata for an approval of EXACTLY the amount you need (via the token's decimals) and refuses unlimited unless forced. Reads the live allowance and returns a revoke step first when one is already set (a non-zero→non-zero approve reverts on USDT-style tokens). Build-time prevention, not detection; we never hold keys. Not financial advice.","url":"https://402.com.tr/api/x402/safe-approve?utm_source=zero.xyz","method":"GET","headers":{},"bodySchema":{"type":"object","$schema":"https://json-schema.org/draft/2020-12/schema","required":["input"],"properties":{"input":{"type":"object","required":["type","method"],"properties":{"type":{"type":"string","const":"http"},"method":{"enum":["GET"],"type":"string"},"pathParams":{"type":"object"},"queryParams":{"type":"object","required":["token","spender","amount"],"properties":{"owner":{"type":"string","description":"Your wallet (optional, reads live allowance)"},"token":{"type":"string","description":"Token contract"},"amount":{"type":"string","description":"Exact amount to approve (or 'max')"},"spender":{"type":"string","description":"Spender (router/contract)"},"allowUnlimited":{"type":"string","description":"Allow unlimited (1 = yes, not recommended)"}}}},"additionalProperties":false},"output":{"type":"object","required":["type"],"properties":{"type":{"type":"string"},"example":{"type":"object"}}}}},"responseSchema":null,"example":null,"exampleRequest":null,"tags":["x402"],"displayCostAmount":"0.02","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.02/call","primary":{"kind":"static","protocol":"x402","network":"base","amountUsd":"0.02","per":"call","confidence":"exact"},"accepted":[{"kind":"static","protocol":"x402","network":"base","amountUsd":"0.02","per":"call","confidence":"exact"}]},"paymentMethods":[{"uid":"pm_ImUKVbZyUHCnnZmsQpN9v","protocol":"x402","methodType":"crypto","chain":"base","mode":"charge","costAmount":"0.02","costPer":"request","priority":0,"asset":"0x833589fCD6eDb6E08f4c7C32D4f71b54bdA02913","unit":"request","depositMicros":null,"planRef":null}],"brandName":null,"brandSlug":null,"brandBaseUrl":null,"brandDocsUrl":null,"whatItDoes":"Builds precise ERC-20 approve calldata for exactly the required token amount, handling USDT-style revoke-first logic and refusing unlimited allowances by default","exampleAgentPrompt":"Build me safe approve calldata to let the Uniswap v3 router (0xE592427A0AEce92De3Edee1F18E0157C05861564) spend exactly 500 USDC (token: 0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48) from my wallet 0xYourWallet — don't use unlimited approval, and check if there's an existing allowance that needs to be revoked first.","exampleUseCases":[{"title":"Safe DEX swap approval","prompt":"Before I swap on Uniswap, build me the exact approve calldata to let the router 0xE592427A0AEce92De3Edee1F18E0157C05861564 spend 1000 USDT (token: 0xdAC17F958D2ee523a2206206994597C13D831ec7) from my wallet 0xAbCd1234 — make sure it handles the USDT revoke step if I already have an allowance set."},{"title":"Minimal allowance for lending protocol","prompt":"I want to deposit 2500 DAI into Aave. Build me the approve calldata for exactly 2500 DAI (token: 0x6B175474E89094C44Da98b954EedeAC495271d0F) allowing the Aave pool 0x87870Bca3F3fD6335C3F4ce8392D69350B4fA4E2 to spend it — no unlimited approval, just the exact amount."},{"title":"Revoke and re-approve stale allowance","prompt":"My wallet 0xMyWallet already has an old approval set for WETH (0xC02aaA39b223FE8D0A0e5C4F27eAD9083C756Cc2) to a contract I no longer use. Build me the calldata to revoke it and then set a fresh approval of exactly 0.5 WETH for the new router 0xNewRouter."}],"resultDescription":"Returns ready-to-sign calldata for an ERC-20 approve transaction scoped to the exact requested amount (converted using live token decimals). If the wallet already has a non-zero allowance set (e.g. USDT-style tokens that revert on non-zero→non-zero), a revoke step is returned first. Unlimited allowances are refused unless the allowUnlimited flag is explicitly set.","failureModes":["Missing required query params (token, spender, amount) returns a 400 error","Invalid or non-checksummed contract addresses cause resolution failure","Token contract does not expose standard decimals() — calldata cannot be scaled correctly","amount='max' rejected unless allowUnlimited=1 is passed","On-chain read of live allowance fails if the RPC endpoint is unavailable","Non-ERC-20 token address returns an error or empty response"],"whenToPreferThis":"Choose this endpoint when an agent needs to build ERC-20 approve transactions safely — especially when interacting with USDT-style tokens that revert on non-zero-to-non-zero approvals, or when you want to enforce minimal allowances instead of unlimited approves. It is better than constructing raw approve calldata manually because it reads live allowances, handles the revoke-first pattern automatically, and scales amounts to token decimals. Prefer this over generic transaction builders when approval safety and USDT compatibility are priorities.","instructions":null,"reviewSummary":null,"reviewSummaryHighlights":null,"reviewSummaryConcerns":null,"reviewSummaryGeneratedAt":null,"activationCount":0,"lastUsedAt":null,"lastSuccessfullyRanAt":null,"lastHealthCheckAt":"2026-10-27T06:51:26.754Z","isFirstParty":false,"canonicalSlug":"safe-approve-builder-95723a2d"}