The Token Balances API allows retrieval of the balance of the native token and all ERC20 fungible tokens held by a specific address on a given blockchain. However, this API is being deprecated in favor of the new Balances API with pagination.
Filters:
import Unmarshal, {Chain} from "@unmarshal/sdk";
const unmarshal = new Unmarshal({apiKey: "YOUR_API_KEY_GOES_HERE"});
unmarshal.WalletApi
.getTokenBalances(Chain.ethereum, "demo.eth")
.then(({data}) => console.log(data))
curl -i -X GET \ 'https://api.unmarshal.com/v1/:chain/address/:address/assets?verified=false&includeLowVolume=false&chainId=false&token=false&aggregatedBalance=false&auth_key=YOUR_API_KEY_HERE'
[- {
- "contract_name": "BNB",
- "contract_ticker_symbol": "BNB",
- "contract_decimals": 18,
- "contract_address": "0xb8c77482e45f1f44de1745f52c74426c631bdd52",
- "coin": 60,
- "type": "ERC20",
- "balance": "1000107409683556863",
- "quote": 0,
- "quote_rate": 0,
- "quote_rate_24h": "0",
- "quote_pct_change_24h": 0
}, - {
- "contract_name": "string",
- "contract_ticker_symbol": "string",
- "contract_decimals": 0,
- "contract_address": "string",
- "coin": 0,
- "type": "string",
- "balance": "string",
- "quote": 0,
- "quote_rate": 0,
- "logo_url": "string",
- "quote_rate_24h": "string",
- "quote_pct_change_24h": 0
}, - {
- "contract_name": "Ethereum",
- "contract_ticker_symbol": "ETH",
- "contract_decimals": 18,
- "contract_address": "0xeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee",
- "coin": 60,
- "type": "ERC20",
- "balance": "1030533275139623654",
- "quote": 4417.751875865047,
- "quote_rate": 4286.86,
- "quote_rate_24h": "6.33",
- "quote_pct_change_24h": 0.14783
}
]
The Token Balances API with pagination enables the retrieval of the balance of the native token and all ERC20 fungible tokens for a specific blockchain, based on a particular address. It also allows for pagination to improve response times when dealing with large numbers of tokens. This API will become the default option once support for the older Token Balances API is deprecated.
Note:
To fetch items on the next page, pass next_offset value of current page as the offset.
For Kadena and Solana, all assets will be returned in a single response.
Filters:
import Unmarshal, {Chain} from "@unmarshal/sdk";
const unmarshal = new Unmarshal({apiKey: "YOUR_API_KEY_GOES_HERE"});
unmarshal.WalletApi
.getTokenBalances(Chain.ethereum, "demo.eth")
.then(({data}) => console.log(data))
curl -i -X GET \ 'https://api.unmarshal.com/v2/:chain/address/:address/assets?verified=false&pageSize=5&offset=0&chainId=false&token=false&aggregatedBalance=false&auth_key=YOUR_API_KEY_HERE'
{- "items_on_page": 5,
- "next_offset": 5,
- "assets": [
- {
- "contract_name": "Tether USD",
- "contract_ticker_symbol": "USDT",
- "contract_decimals": 6,
- "contract_address": "0xdac17f958d2ee523a2206206994597c13d831ec7",
- "coin": 60,
- "type": "ERC20",
- "balance": "9858287165",
- "quote": 9868.145452165,
- "quote_rate": 1.001,
- "quote_rate_24h": "0.00047874",
- "quote_pct_change_24h": 0.04786,
- "verified": true,
- "coin_gecko_id": "tether"
}, - {
- "contract_name": "Frontier Token",
- "contract_ticker_symbol": "FRONT",
- "contract_decimals": 18,
- "contract_address": "0xf8c3527cc04340b208c854e985240c02f7b7793f",
- "coin": 60,
- "type": "ERC20",
- "balance": "4843997835959514312853",
- "quote": 839.5568609306671,
- "quote_rate": 0.173319,
- "quote_rate_24h": "-0.002736091749376252",
- "quote_pct_change_24h": -1.55411,
- "verified": true,
- "coin_gecko_id": "frontier-token"
}, - {
- "contract_name": "Ethereum",
- "contract_ticker_symbol": "ETH",
- "contract_decimals": 18,
- "contract_address": "0xeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee",
- "coin": 60,
- "type": "ERC20",
- "balance": "567414931501599473",
- "quote": 689.2162206977329,
- "quote_rate": 1214.66,
- "quote_rate_24h": "28.01",
- "quote_pct_change_24h": 2.36082,
- "verified": true,
- "coin_gecko_id": "ethereum"
}, - {
- "contract_name": "USD Coin",
- "contract_ticker_symbol": "USDC",
- "contract_decimals": 6,
- "contract_address": "0xa0b86991c6218b36c1d19d4a2e9eb0ce3606eb48",
- "coin": 60,
- "type": "ERC20",
- "balance": "647245836",
- "quote": 647.218004429052,
- "quote_rate": 0.999957,
- "quote_rate_24h": "-0.00065697685964683",
- "quote_pct_change_24h": -0.06566,
- "verified": true,
- "coin_gecko_id": "usd-coin"
}, - {
- "contract_name": "SuperRare",
- "contract_ticker_symbol": "RARE",
- "contract_decimals": 18,
- "contract_address": "0xba5bde662c17e2adff1075610382b9b691296350",
- "coin": 60,
- "type": "ERC20",
- "balance": "1157000000000000000000",
- "quote": 115.23372900000001,
- "quote_rate": 0.099597,
- "quote_rate_24h": "-0.002663093775851985",
- "quote_pct_change_24h": -2.60424,
- "verified": true,
- "coin_gecko_id": "superrare"
}
]
}
The Profit/Loss API returns the net profit or loss made by a specified address for a particular token.
unmarshal.WalletApi
.getProfitAndLoss(Chain.ethereum, "demo.eth", "token-address")
.then(({data}) => console.log(data))
curl -i -X GET \ 'https://api.unmarshal.com/v2/:chain/address/:address/userData?contract=string&auth_key=YOUR_API_KEY_HERE'
{- "quote_rate": 1.88,
- "total_fees_paid": 0.00408196,
- "total_fees_paid_usd": 12.35876252184,
- "average_token_price": 0.6777538233562116,
- "overall_profit_loss": 1390.998826376863,
- "current_holding_quantity": 1157,
- "percentage_change_24H": 3.87773,
- "price_change_24H": 81.37875199999999
}
The Token Holders API enables the retrieval of the total number of token holders for a specific token contract address.
unmarshal.WalletApi
.getTokenHoldersCount(Chain.ethereum, "token address")
.then(({data}) => console.log(data))
curl -i -X GET \ 'https://api.unmarshal.com/v1/:chain/token-address/:address/holders-count?auth_key=YOUR_API_KEY_HERE'
{- "token_holders_count": "3367"
}
The Top Holders API retrieves the list of the top token holders for a specific token on the Ethereum and Polygon blockchains.
Example response
curl -i -X GET \ 'https://api.unmarshal.com/v1/:chain/contract/:contract/top-holders?auth_key=YOUR_API_KEY_HERE'
{- "token_address": "0x5a666c7d92e5fa7edcb6390e4efd6d0cdd69cf37",
- "top_holders": [
- {
- "address": "0x56ee84baf54c472e206e06c29de8c494d0f120ba",
- "balance": 62285000.00206402
}, - {
- "address": "0xef38f0cdfe4df26c0da27c9347b870cd4207a897",
- "balance": 14963898.77438037
}, - {
- "address": "0xf16e9b0d03470827a95cdfd0cb8a8a3b46969b91",
- "balance": 4250251.844552843
}, - {
- "address": "0x738cf6903e6c4e699d1c2dd9ab8b67fcdb3121ea",
- "balance": 2282080.1403131136
}, - {
- "address": "0xfc270414a3dd54bb649f83349fb783182eab8610",
- "balance": 2004448.7302565863
}, - {
- "address": "0x3bee11d70e5a25b16520286a7053e84dff2e0f5d",
- "balance": 1794300.5638183085
}, - {
- "address": "0x9c5de3ad97b95a0da09fd0de84c347db450cd75c",
- "balance": 1483756.7605084442
}, - {
- "address": "0xd0365271d8f74b7a0c8a0099aace8e1bbd701c78",
- "balance": 1000000
}, - {
- "address": "0x0d0707963952f2fba59dd06f2b425ace40b492fe",
- "balance": 911049.7347293429
}, - {
- "address": "0x63ac48561c36933c4d810a537601508929e95d87",
- "balance": 594990
}, - {
- "address": "0x06d8f188ce3a5d341e6d276ed49f88baf264e9fb",
- "balance": 500000
}, - {
- "address": "0xd4b69e8d62c880e9dd55d419d5e07435c3538342",
- "balance": 499990.0000000007
}, - {
- "address": "0xa5d4aeddf4ffb8f5ded3576c58ef345da2ca375d",
- "balance": 499933.00190000003
}, - {
- "address": "0x410aa0b164db233eb40e857d34a9f581d3f7019c",
- "balance": 372839.35504563997
}, - {
- "address": "0x11fb41e49f29a306a8a01a4d0e198902c9e6d241",
- "balance": 268797
}, - {
- "address": "0x4a5bb1c9347a0d4f7e06a29239162f03647d9232",
- "balance": 253999.9999037037
}, - {
- "address": "0x4c87a5806079d54f48e791a6b565d9646f0e48f4",
- "balance": 226897.38548444546
}, - {
- "address": "0xc7fcdf23cfd8e65dbf412f04070d45eca1bb5025",
- "balance": 206075.23155926
}, - {
- "address": "0x4d24eececb86041f47bca41265319e9f06ae2fcb",
- "balance": 160517.50135227005
}, - {
- "address": "0x0ca90ac1c97fc3679df07e1ae5c20e4349c79b37",
- "balance": 158991.00000000026
}
], - "holders_count": 4070
}
The Batch Assets API enables the retrieval of wallet balances across multiple blockchain networks by batching together multiple asset balance API requests. The API accepts comma-separated addresses and chains as input parameters, allowing for efficient retrieval of wallet balances on multiple networks in a single API call.
OK
curl -i -X GET \ 'https://api.unmarshal.com/v1/batch-assets?address=string&chain=string&auth_key=YOUR_API_KEY_HERE'
{- "0x8140e0d5ed099f45d616d61d7fbaf5b635e12647": {
- "ethereum": [
- {
- "contract_name": "Tether USD",
- "contract_ticker_symbol": "USDT",
- "contract_decimals": 6,
- "contract_address": "0xdac17f958d2ee523a2206206994597c13d831ec7",
- "coin": 60,
- "type": "ERC20",
- "balance": "22697247731",
- "quote": 22680.45176767906,
- "quote_rate": 0.99926,
- "quote_rate_24h": "-0.001372274563560705",
- "quote_pct_change_24h": -0.13714,
- "verified": true,
- "coin_gecko_id": "tether"
}, - {
- "contract_name": "Ethereum",
- "contract_ticker_symbol": "ETH",
- "contract_decimals": 18,
- "contract_address": "0xeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee",
- "coin": 60,
- "type": "ERC20",
- "balance": "64702512388722634",
- "quote": 110.46207022539893,
- "quote_rate": 1707.23,
- "quote_rate_24h": "12.27",
- "quote_pct_change_24h": 0.72367,
- "verified": true,
- "coin_gecko_id": "ethereum"
}
], - "matic": [ ]
}, - "0x963737c550e70ffe4d59464542a28604edb2ef9a": {
- "ethereum": [
- {
- "contract_name": "Ethereum",
- "contract_ticker_symbol": "ETH",
- "contract_decimals": 18,
- "contract_address": "0xeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee",
- "coin": 60,
- "type": "ERC20",
- "balance": "218934496610230466935",
- "quote": 373771.5406478838,
- "quote_rate": 1707.23,
- "quote_rate_24h": "12.27",
- "quote_pct_change_24h": 0.72367,
- "verified": true,
- "coin_gecko_id": "ethereum"
}, - {
- "contract_name": "HitBTC Token",
- "contract_ticker_symbol": "HIT",
- "contract_decimals": 18,
- "contract_address": "0x74b1af114274335598da72f5c6ed7b954a016eed",
- "coin": 60,
- "type": "ERC20",
- "balance": "369270745231870000000000",
- "quote": 54308.648501251126,
- "quote_rate": 0.14707,
- "quote_rate_24h": "0.00145704",
- "quote_pct_change_24h": 1.00062,
- "verified": true,
- "coin_gecko_id": "hitbtc-token"
}
], - "matic": [
- {
- "contract_name": "Wrapped Ether",
- "contract_ticker_symbol": "WETH",
- "contract_decimals": 18,
- "contract_address": "0x7ceb23fd6bc0add59e62ac25578270cff1b9f619",
- "coin": 137,
- "type": "ERC20",
- "balance": "20000000000000000",
- "quote": 34.144600000000004,
- "quote_rate": 1707.23,
- "quote_rate_24h": "12.27",
- "quote_pct_change_24h": 0.72367,
- "verified": true,
- "coin_gecko_id": "weth"
}, - {
- "contract_name": "Matic",
- "contract_ticker_symbol": "MATIC",
- "contract_decimals": 18,
- "contract_address": "0x0000000000000000000000000000000000001010",
- "coin": 137,
- "type": "ERC20",
- "balance": "100000000000000000",
- "quote": 0.149,
- "quote_rate": 1.49,
- "quote_rate_24h": "-0.014041841703763104",
- "quote_pct_change_24h": -0.93303,
- "verified": true,
- "coin_gecko_id": "matic-network"
}
]
}
}