Nexus

How do I check if an Algorand account has opted in to an asset (algosdk JavaScript)?

Short answer: Call algod.accountAssetInformation(address, assetId). If the account holds the asset it returns the holding, including the amount in base units.

Code that was run

// algod = new algosdk.Algodv2("", "https://testnet-api.algonode.cloud", 443)
// indexer, addr (an account address) and USDC (asset id 10458941 on TestNet) are set up before the call
async () => {
    const info = await algod.accountAssetInformation(addr, USDC).do();
    return { optedIn: true, amount: String(info.assetHolding.amount) };
  }

What it returned

{
  "optedIn": true,
  "amount": "1825001"
}

Run against a public TestNet node with algosdk 3.9.0 on 2026-12-03. Amounts are shown as strings because they are bigints.

Notes

All how-tos · howto.json · SDK errors · API errors · costs