Skip to main content

Parameters

string
required
Public key of the account to query (base-58 encoded string)
object
Configuration object containing the following optional fields:

Response

object

Code Examples

Basic Request

Request with Commitment

Using web3.js

Notes

  1. Balance is returned in lamports (1 SOL = 1,000,000,000 lamports)
  2. For new accounts, balance will be 0
  3. The balance includes all SOL tokens, including those delegated for staking
  4. The response is immediate as it reads from the current state

Best Practices

  1. Use appropriate commitment level based on your needs:
    • processed for UI updates
    • confirmed for most operations
    • finalized for critical operations
  2. Convert lamports to SOL by dividing by 1e9 when displaying to users
  3. Consider using getAccountInfo if you need more account details

Common Errors