/accounts/{accountId}/asset-balances - Polkadot
Example code for the /accounts/{accountId}/asset-balances REST method. Complete guide on how to use /accounts/{accountId}/asset-balances REST in GetBlock Web3 documentation.
This endpoint returns an account's balances for Asset Hub assets. Specific asset IDs can be requested with the assets query parameter.
Endpoint
GET /accounts/{accountId}/asset-balancesPath Parameters
accountId
string
SS58 account address
Query Parameters
assets[]
array
No
Asset IDs to query. Returns all held assets when omitted
at
string
No
Block height or hash to query at
Request
curl --location 'https://shared.eu-central-1.getblock.io/<ACCESS-TOKEN>/accounts/15oF4uVJwmo4TdGW7VfQxNLavjCXviqxT9S1MgbjMNHr6Sp5/asset-balances?assets[]=1984'const response = await fetch('https://shared.eu-central-1.getblock.io/<ACCESS-TOKEN>/accounts/15oF4uVJwmo4TdGW7VfQxNLavjCXviqxT9S1MgbjMNHr6Sp5/asset-balances?assets[]=1984');
const data = await response.json();
console.log(data);import requests
response = requests.get('https://shared.eu-central-1.getblock.io/<ACCESS-TOKEN>/accounts/15oF4uVJwmo4TdGW7VfQxNLavjCXviqxT9S1MgbjMNHr6Sp5/asset-balances?assets[]=1984')
print(response.json())Response
{
"at": {
"hash": "0x255bc00927df8d33d561792635cbc6bde480a0a505eef5ff28630ece3fc15b32",
"height": "6754362"
},
"assets": [
{
"assetId": "1984",
"balance": "25000000",
"isFrozen": false,
"isSufficient": true
}
]
}Response Fields
assets
array
Per-asset balance entries
assets[].assetId
string
The asset's ID on Asset Hub
assets[].balance
string
The account's balance of the asset
assets[].isFrozen
boolean
Whether the balance is frozen
assets[].isSufficient
boolean
Whether the asset is sufficient for existence
Use Cases
Token Wallets: Show an account's Asset Hub token balances
Stablecoin UX: Read USDT (asset 1984) or USDC balances
Portfolio Tools: Aggregate asset holdings
Payments: Confirm an asset balance before a transfer
Last updated
Was this helpful?