Nexus

What does algosdk return for an account that has not opted in to an asset?

Short answer: The same call throws an error with HTTP status 404 and the message "account asset info not found". Catch it and treat 404 as "not opted in".

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 () => {
    try { await algod.accountAssetInformation(unfunded, USDC).do(); return { optedIn: true }; }
    catch (e) { return { optedIn: false, status: e.status, message: String(e.response?.body?.message || e.message) }; }
  }

What it returned

{
  "optedIn": false,
  "status": 404,
  "message": "Network request error. Received status 404 (Not Found): account asset info not found"
}

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