#Algoexplorer alternative
3 messages · Page 1 of 1 (latest)
To replace your previous Algoexplorer API call for fetching an account's asset holdings, you should use the official Algorand REST API endpoints or SDKs. The equivalent endpoint is:
GET /v2/accounts/{address}/assets
This endpoint returns a list of assets held by an account, including asset parameters. You can call this endpoint directly on an Algorand node (algod REST API) or use the Algorand Indexer for more advanced queries.
Example using aiohttp (similar to your old code):
import aiohttp
address = "YOUR_ACCOUNT_ADDRESS"
request_assets_string = f"<https://mainnet-api.algonode.cloud/v2/accounts/{address}/assets">
async with aiohttp.ClientSession() as session:
async with session.get(request_assets_string) as request:
if request.status == 200:
holder_data = await request.json(content_type=None)
# holder_data['assets'] contains the asset holdings
Replace the URL with your preferred Algorand API provider (e.g., Algonode, PureStake, or your own node).
Official documentation for this endpoint:
Get a list of assets held by an account, inclusive of asset params
If you want to use the Python SDK, you can use:
from algosdk.v2client import algod
algod_client = algod.AlgodClient(algod_token, algod_address)
account_assets = algod_client.account_asset_info(address, asset_id)
Or to get all assets:
account_info = algod_client.account_info(address)
assets = account_info.get("assets", [])
Summary:
- Use the
/v2/accounts/{address}/assetsendpoint for asset holdings. - Use a public node provider or your own node.
- The Python SDK provides convenient wrappers for these endpoints.