Token Holdings and Balance

There are a couple of requests you can use to check the balance of a given token for a given account or you can check if an account has a number of different tokens.

Remember, for a given call to check the account holdings or an individual balance you need to be aware whether an account ID is valid for a given environment. As an example, the amount of accounts on testnet far exceeds that of mainnet, thus you may receive errors if you try to pass an incorrect accounts into different environments.

This returns back to Balance for a given token that belongs to a given account, you can use this as an alternative to balance lookups on mirror nodes, if balance requests are critical.

Get Token Balance

GET https://hedera-serverless-consensus.vercel.app/api/account/:id/:token_id

This endpoint allows you to get the token balance of a given account for a particular environment.

Path Parameters

Name
Type
Description

*

String

account id in 0.0.x format

token_id*

String

token id in 0.0.x format

Query Parameters

Name
Type
Description

decimals

Number

Set the number of expected decimals

{
    "data": {
        "balance": "10000"
    }
}

Perhaps you just want to know whether an account holds particular tokens, this could be helpful if you are a building service that requires one or many tokens (like NFTs) to be held to unlock access to particular feature of your service.

Get Account Holdings

GET https://hedera-serverless-consensus.vercel.app/api/account/:id/holdings/:token_ids

This endpoint allows you to know if a given account holds many different tokens or NFTS.

Path Parameters

Name
Type
Description

*

String

account id in 0.0.x format

token_ids*

String

token id in 0.0.x,0.0.y,0.0.z format

{
    "data": {
        "balance": "10000"
    }
}

Last updated