Get Token Balance
Check how much of a specific ERC20 token a wallet holds. Returns both the raw amount and a human-readable value. Optionally includes token metadata.
Catalog action EVM Onchain
Check how much of a specific ERC20 token a wallet holds. Returns both the raw amount and a human-readable value. Optionally includes token metadata.
At a Glance
| Field | Value |
|---|---|
| Action ID | get-balance |
| Category | EVM Onchain |
| Connector | Not required |
| Requires gas | No |
| Funds movement | None declared |
| Tags | blockchain, evm, erc20, balance, query, read, portfolio, wallet |
Payload Schema
| Field | Type | Required | Description |
|---|---|---|---|
tokenAddress | string | Yes | ERC20 token contract address |
accountAddress | string | Yes | Account address to check balance for |
chainId | number | Yes | Chain ID (1=Ethereum, 137=Polygon, 56=BSC, 8453=Base, etc.) |
includeMetadata | boolean | No | Whether to include token metadata (name, symbol, decimals) |
Result Schema
| Field | Type | Required | Description |
|---|---|---|---|
balance | string | Yes | Raw balance in smallest unit (wei) |
formattedBalance | string | Yes | Human-readable balance with decimals |
tokenAddress | string | Yes | Token contract address |
accountAddress | string | Yes | Account address |
decimals | number | No | Token decimals (included if includeMetadata is true) |
symbol | string | No | Token symbol (included if includeMetadata is true) |
name | string | No | Token name (included if includeMetadata is true) |
blockNumber | number | Yes | Block number at which balance was read |
Examples
json{ "type": "get-balance", "payload": { "tokenAddress": "0x0000000000000000000000000000000000000000", "accountAddress": "0x0000000000000000000000000000000000000000", "chainId": 8453 }, "children": []}
bashcurl -X POST "https://api.b3os.org/v1/actions/get-balance/test" \ -H "Authorization: Bearer YOUR_API_KEY" \ -H "Content-Type: application/json" \ -d '{ "inputs": { "tokenAddress": "0x0000000000000000000000000000000000000000", "accountAddress": "0x0000000000000000000000000000000000000000", "chainId": 8453 }}'
Payload fields can use workflow expressions such as {{$trigger.body.amount}}, {{$nodes.fetch.result.price}}, and {{$props.asset}} when the value should come from a trigger, prior node, or reusable workflow prop.
