GET
/
beta
/
balance
/
{address}
/
subscribe

The Token Balances API provides accurate and fast real time balances of the native and ERC20 tokens of accounts on supported blockchains (EVM currently). The websocket complement that by allowing you to subscribe to balance changes in real-time, whenever a token is transferred to or from address, without the need to poll the API.

Native tokens are currently not supported. This means that balance changes to them will not trigger a websocket push

This is a websocket endpoint, not an HTTP GET endpoint
1

Install the dependencies

Wscat is a popular WebSocket utility for creating WebSocket connections. It allows you to send and receive messages interactively via the command line.

npm install -g wscat
2

Call the webhook

Just replace Wallet Address and Dune API Key with your own values.

Terminal
  wscat -c wss://api.dune.com/api/beta/balance/{Wallet Address}/subscribe \
    -H "X-Dune-Api-Key: {Dune API Key}"
3

Get balance changes in your terminal

Whenever there is a balance change, you will receive the updates in your terminal. Here an example:

200
{
  "response_time":"2024-07-24T14:36:46.086ZZ","wallet_address":"0x3fc91a3afd70395cd496c647d5a6cc9d4b2b7fad","balances":
  [
    {
        "chain": "polygon",
        "chain_id": 137,
        "address": "0x3c499c542cef5e3811e1192ce70d8cc03d5c3359",
        "amount": "1000000",
        "symbol": "USDC",
        "decimals": 6,
        "price_usd": 0.9999765798076116,
        "value_usd": 0.9999765798076116
    }
  ]
}

Headers

X-Dune-Api-Key
string
required

API key to access the service

Path Parameters

address
string
required

Wallet to get balances for

Query Parameters

chain_ids
string | null

Comma separated list of chain ids to filter by