# x402 Agent Hub – ERC-20 Token Balance

> x402 Agent Hub – ERC-20 Token Balance is a paid API for AI agents from x402-agent-hub.x402-agent-hub.workers.dev, paid per call via x402, $0.002/call, status unknown (last checked 2026-11-14).

Returns the ERC-20 token balance of any wallet or contract address on 7 EVM chains, provided in both raw integer and human-readable decimal form with the token symbol and decimals.

## Facts

- Endpoint: GET https://x402-agent-hub.x402-agent-hub.workers.dev/v1/chain/token-balance?utm_source=zero.xyz
- Price: $0.002/call
- Payment: x402
- Status: unknown
- Last checked: 2026-11-14
- Activations on Zero: 0
- Tags: x402
- Canonical page: https://www.zero.xyz/c/x402-agent-hub-erc-20-token-balance-5bc15857
- Structured record (JSON): https://api.zero.xyz/v1/capabilities/cap_NEob2eZr-_hjt4KmESaET

Status and success rate cover calls made through Zero and Zero's own probes. Third-party monitors may report differently.

## How to call it through Zero

Zero handles the 402 payment challenge and records the run. With the Zero CLI installed (`npm i -g @zeroxyz/cli`):

```sh
zero fetch --capability x402-agent-hub-erc-20-token-balance-5bc15857
```

Example prompt: What's the USDC balance of wallet 0x1721E9841257A34DbDBA407D4DBA3a727a02d072 on Base — give me the properly formatted amount, not just the raw integer.

## When to prefer this

Choose this endpoint when you need correctly scaled ERC-20 token balances across multiple EVM chains without building your own RPC infrastructure. It is particularly valuable when you need to avoid decimal-scaling bugs (e.g. USDC's 6 decimals vs. most tokens' 18), and when you only want to pay per successful read. Prefer it over generic RPC calls when working with agents that need ready-to-use formatted numbers.

## Known failure modes

- Invalid or malformed wallet/token address returns an error without charging
- Unsupported chain name or chain ID returns an error without charging
- Token contract address does not exist on the specified chain returns not-found without charging
- Upstream RPC node unavailability triggers an error that cancels settlement
- Missing required query parameters (address or token) results in a validation error

## How this service works

ERC-20 token balance of any address on 7 EVM chains, returned raw and decimal-formatted with the token symbol, so agents never mis-scale USDC (6) vs 18-decimal tokens. You only pay for successful reads: invalid input, not-found and upstream errors cancel settlement.

## Output

A JSON object containing the chain name, chain ID, token contract address, queried wallet address, block number of the read, and a balance object with four fields: raw (integer string), formatted (human-readable decimal string), symbol (e.g. 'USDC'), and decimals (e.g. 6 or 18).

## Request schema (JSON Schema)

```json
{
 "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"
    },
    "queryParams": {
     "type": "object",
     "required": [
      "address",
      "token"
     ],
     "properties": {
      "chain": {
       "type": "string",
       "description": "base (default), ethereum, arbitrum, optimism, polygon, bsc or avalanche. Chain IDs also accepted."
      },
      "token": {
       "type": "string",
       "description": "0x-prefixed ERC-20 token contract address."
      },
      "address": {
       "type": "string",
       "description": "0x-prefixed wallet or contract address."
      }
     }
    }
   },
   "additionalProperties": false
  },
  "output": {
   "type": "object",
   "required": [
    "type"
   ],
   "properties": {
    "type": {
     "type": "string"
    },
    "example": {
     "type": "object"
    }
   }
  }
 }
}
```

## Response schema (JSON Schema)

```json
{
 "type": "json",
 "example": {
  "chain": "base",
  "token": "0x833589fCD6eDb6E08f4c7C32D4f71b54bdA02913",
  "address": "0x1721E9841257A34DbDBA407D4DBA3a727a02d072",
  "balance": {
   "raw": "4250000",
   "symbol": "USDC",
   "decimals": 6,
   "formatted": "4.25"
  },
  "chainId": 8453,
  "blockNumber": 38211554
 }
}
```

## More

- Live health (JSON, refreshed every minute): https://www.zero.xyz/c/x402-agent-hub-erc-20-token-balance-5bc15857/health.json
- [Zero catalog index](https://www.zero.xyz/llms.txt)
- [Other services from x402-agent-hub.x402-agent-hub.workers.dev](https://www.zero.xyz/host/x402-agent-hub.x402-agent-hub.workers.dev/llms.txt)
