Agent402 / tools / token-allowance

ERC-20 allowance (owner to spender)

$0.002 per call · USDC via x402 · POST /api/token-allowance

How much of an ERC-20 token a spender contract is approved to move from an owner wallet - the approval check an agent runs before a swap, a bridge, or an x402 transferWithAuthorization flow. Returns the allowance as an exact decimal string scaled by the token's decimals, the raw uint256, and an `unlimited` flag for max-uint style approvals.

TRY IN PLAYGROUND →

Input

FieldTypeDescription
contract *string0x-prefixed 40-char ERC-20 contract address.
owner *stringWallet that granted (or did not grant) the approval.
spender *stringContract or wallet whose allowance to read.
networkstringethereum / base / polygon / arbitrum / optimism (default ethereum).

Example output

{
  "network": "ethereum",
  "chainId": 1,
  "contract": "0xa0b86991c6218b36c1d19d4a2e9eb0ce3606eb48",
  "owner": "0xd8da6bf26964af9d7eed9e03e53415d37aa96045",
  "spender": "0x3fc91a3afd70395cd496c647d5a6cc9d4b2b7fad",
  "symbol": "USDC",
  "decimals": 6,
  "allowance": "0",
  "raw": "0",
  "unlimited": false,
  "source": "alchemy",
  "fetchedAt": "2026-08-22T12:00:00.000Z"
}

Try it - see the 402 challenge (free)

curl -i -X POST https://agent402.tools/api/token-allowance \
  -H "Content-Type: application/json" \
  -d '{"contract":"0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48","owner":"0xd8dA6BF26964aF9D7eEd9e03E53415D37aA96045","spender":"0x3fC91A3afd70395Cd496C647d5a6CC9D4B2b7FAD","network":"ethereum"}'

The response is HTTP 402 Payment Required with exact payment requirements. Any x402 v2 client pays automatically and retries:

Paid call (JavaScript agent)

import { wrapFetchWithPayment } from "@x402/fetch";
import { x402Client } from "@x402/core/client";
import { registerExactEvmScheme } from "@x402/evm/exact/client";
import { privateKeyToAccount } from "viem/accounts";

const client = new x402Client();
registerExactEvmScheme(client, { signer: privateKeyToAccount(KEY) });
const payFetch = wrapFetchWithPayment(fetch, client);

const res = await payFetch("https://agent402.tools/api/token-allowance", {
  method: "POST",
  headers: { "Content-Type": "application/json" },
  body: JSON.stringify({
    "contract": "0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48",
    "owner": "0xd8dA6BF26964aF9D7eEd9e03E53415D37aA96045",
    "spender": "0x3fC91A3afd70395Cd496C647d5a6CC9D4B2b7FAD",
    "network": "ethereum"
  }),
});
Wallet-only. This tool reaches the network/browser/storage, so it is paid in USDC via x402 (no proof-of-work tier).

Related tools

Crypto order book

$0.003 · GET /api/crypto-orderbook

L2 order-book snapshot for a spot pair: best bid/ask, mid price, spread (absolute + %), and the top N aggregated price l…

try in playground →

Stablecoin peg monitor

$0.003 · GET /api/stablecoin-peg

Live $1-peg deviation for the top USD stablecoins (USDT, USDC, USDS, DAI, USDe, PYUSD, USDD, TUSD, FDUSD by default, or …

try in playground →

Wallet balance (native + ERC-20)

$0.002 · POST /api/wallet-balance

Look up the native coin balance (ETH/MATIC) plus every ERC-20 holding for a wallet address on Ethereum, Base, Polygon, A…

try in playground →