# Get tokens

URL: https://docs.hanzo.ai/docs/openapi/web3/get-web3-tokens-by-chain-by-address

> Reads an address's native balance on a chain.

`GET /v1/web3/tokens/{chain}/{address}`

> [Web3 →](https://docs.hanzo.ai/docs/openapi/web3) · [All API references →](https://docs.hanzo.ai/docs/openapi) · [Get started →](https://docs.hanzo.ai/docs/guides)

|               |                                                         |
| ------------- | ------------------------------------------------------- |
| **Address**   | `https://api.hanzo.ai/v1/web3/tokens/{chain}/{address}` |
| **Method**    | `GET`                                                   |
| **Operation** | `get_web3_tokens_by_chain_by_address`                   |
| **Auth**      | `Authorization: Bearer $HANZO_API_KEY`                  |

Reads an address's native balance on a chain.

ERC-20 positions are NOT enumerated here: eth\_getBalance answers the native
one, but "every token this address holds" is an indexer question — there is no
RPC call that answers it, and walking a token list would return a number that
silently omits whatever the list missed. explorer owns the indexer
relationship; this returns the balance the chain itself can prove.

## Request

2 fields.

| Field     | In   | Type   | Required | Description                          |
| --------- | ---- | ------ | -------- | ------------------------------------ |
| `chain`   | path | string | yes      | Chain is the registry id.            |
| `address` | path | string | yes      | Address is the account, 0x-prefixed. |

## Response

| Status    | Body            | Meaning |
| --------- | --------------- | ------- |
| `200`     | web3.balances   | ok      |
| `default` | problem-details | refused |

`200` body — 3 fields.

| Field     | In   | Type   | Always | Description                                                                                                                               |
| --------- | ---- | ------ | ------ | ----------------------------------------------------------------------------------------------------------------------------------------- |
| `address` | body | string | —      | Address is the account they belong to.                                                                                                    |
| `chain`   | body | string | —      | Chain is the chain the balances were read from.                                                                                           |
| `native`  | body | string | —      | Native is the chain's own currency, as a 0x-quantity — the RPC's own encoding, not a float, because a wei value does not survive float64. |

Failure carries the platform error shape — see [Errors](https://docs.hanzo.ai/docs/errors).

## Examples

**CLI**

```bash
hanzo web3 tokens chain get <chain> <address>
```

**SDK**

**.ts**

```ts
import { Configuration, Web3Api } from 'hanzoai';

const api = new Web3Api(new Configuration({ accessToken: process.env.HANZO_API_KEY }));
const { data } = await api.getWeb3TokensByChainByAddress({ chain: 'chain', address: 'address' });
```

**.py**

```python
from hanzoai.cloud import ApiClient, Configuration
from hanzoai.cloud.api import Web3Api

client = ApiClient(Configuration(access_token=os.environ["HANZO_API_KEY"]))
result = Web3Api(client).get_web3_tokens_by_chain_by_address(chain='chain', address='address')
```

**.go**

```go
cfg := hanzoai.NewConfiguration()
cfg.AddDefaultHeader("Authorization", "Bearer "+os.Getenv("HANZO_API_KEY"))
client := hanzoai.NewAPIClient(cfg)

resp, _, err := client.Web3API.GetWeb3TokensByChainByAddress(context.Background()).Execute()
if err != nil {
	return err
}
```

**.rs**

```rust
use hanzo_client::apis::{configuration::Configuration, web3_api};

let mut cfg = Configuration::new();
cfg.bearer_access_token = std::env::var("HANZO_API_KEY").ok();

let result = web3_api::get_web3_tokens_by_chain_by_address(&cfg, Default::default()).await?;
```

**.java**

```java
import ai.hanzo.cloud.ApiClient;
import ai.hanzo.cloud.api.Web3Api;

ApiClient client = new ApiClient();
client.setBearerToken(System.getenv("HANZO_API_KEY"));

var result = new Web3Api(client).getWeb3TokensByChainByAddress();
```

**HTTP**

```bash
curl https://api.hanzo.ai/v1/web3/tokens/<chain>/<address> \
  -H "Authorization: Bearer $HANZO_API_KEY"
```

**MCP**

MCP reaches **web3** through the `web3` tool, which names its 3 operations with its own verbs — this one among them, under a name only MCP declares. `describe` explains any of them:

```bash
curl -X POST https://api.hanzo.ai/v1/mcp \
  -H "Content-Type: application/json" \
  -d '{
       "jsonrpc": "2.0",
       "id": 1,
       "method": "tools/call",
       "params": {
         "name": "describe",
         "arguments": {
           "op": "list_web3_chains"
         }
       }
     }'
```

---

[Web3 API](https://docs.hanzo.ai/docs/openapi/web3) · [All Hanzo APIs](https://docs.hanzo.ai/docs/openapi) · [Interactive reference](https://docs.hanzo.ai/docs/openapi/reference)
