Skip to main content
A query that returns the balance an account holds in a token. Token balances are read from a mirror node, either through MirrorNodeTokenBalanceQuery in the SDK or directly from the Mirror Node REST API. Both are free and do not need an operator account. MirrorNodeTokenBalanceQuery reads an account’s token relationships from the Mirror Node REST API (GET /api/v1/accounts/{id}/tokens) through the SDK’s query interface. It is the SDK replacement for the token balances that AccountBalanceQuery used to return. For HBAR balances, use MirrorNodeAccountBalanceQuery.
  • Free: No query payment and no operator key signing.
  • Smallest unit: For fungible tokens, balance is in the token’s smallest denomination. Divide by 10decimals to get the display amount: a balance of 1234 with decimals of 2 is 12.34 tokens. For NFT collections, balance is the number of NFTs the account holds.
  • Flexible account references: setAccountId accepts 0.0.<num>, an EVM address (0x...), or a contract ID. The mirror node resolves all of them.

Basic usage

List every token an account holds (Go)

In Go, leave SetTokenID unset to read all of the account’s token relationships, up to 100 per page. Follow the Next cursor until it is empty:
The JavaScript and Java SDKs return one token per query. To list every token an account holds in those SDKs, call the Mirror Node REST API directly.
In the JavaScript SDK, MirrorNodeTokenBalanceQuery shipped as a single-token query before the cross-SDK design (sdk-collaboration-hub#281) was final. That design is still under review, and the SDK notes that the query’s shape may change once it is accepted, so check the release notes when you upgrade.

Behavior by SDK

The three SDKs report a missing token relationship and an unknown account differently:
  • Eventual consistency: The mirror node ingests blocks a few seconds after consensus. A balance read right after a transfer, or a query for a newly created account, can return the pre-transaction state. Poll until the balance changes, or rely on the transaction receipt for confirmation.
  • Java and unknown accounts: In Java, a mistyped or not-yet-ingested account ID reads as “not associated” instead of failing. Do not treat isAssociated() == false as proof that the account exists.
  • JavaScript decimals: When the account is not associated, decimals is 0 because the mirror node response does not include it. Read decimals from the token itself if you need them in that case.

Mirror Node REST API

The SDK query calls this endpoint, and you can call it directly from any language, including Rust. Add token.id to return a single token, or leave it out to list every token the account holds:
  • The response lists only tokens the account is associated with. An unassociated token returns an empty tokens array.
  • An unknown account returns HTTP 404.
  • When listing every token, follow links.next until it is null.
See the Get token relationships info for an account reference for every parameter.

SDK versions

MirrorNodeTokenBalanceQuery is available in:

HBAR balances

MirrorNodeTokenBalanceQuery returns token balances only. To read an account’s HBAR balance, see Get account balance.

Removed: AccountBalanceQuery

AccountBalanceQuery no longer works. It read the consensus node’s cryptoGetBalance query, which consensus node release v0.77 removed (testnet on September 15, 2026, mainnet on September 29, 2026). Current SDKs (JavaScript v2.89.0+, Java v2.78.0+, Go v2.85.1+) fail the call immediately with a deprecation error and never contact a node. Older SDK versions, and the Rust SDK, still send the query, and the network answers BUSY until the SDK runs out of retries.For token balances, use MirrorNodeTokenBalanceQuery (above) or the Mirror Node REST API.📚 For the full migration guide, read: Migrating from AccountBalanceQuery: What You Need to Know