Skip to main content

getAccountInfo

Returns all information associated with the account of provided Pubkey

Parameters

Pubkey <string>

  • Pubkey of account to query, as base-58 encoded string

Configuration <object>

  • Configuration object containing the following fields:

    • encoding: <string> - encoding format for Account data

      Details
      • base58 is slow and limited to less than 129 bytes of Account data. - base64 will return base64 encoded data for Account data of any size. - base64+zstd compresses the Account data using Zstandard and base64-encodes the result. - jsonParsed encoding attempts to use program-specific state parsers to return more human-readable and explicit account state data. - If jsonParsed is requested but a parser cannot be found, the field falls back to base64 encoding, detectable when the data field is type string.
    • length: <usize> - number of bytes to return [Optional]

    • offset: <usize> - byte offset from which to start reading [Optional]

Result

The result will be an RpcResponse JSON object with value equal to:

  • <null> - if the requested account doesn't exist
  • <object> - otherwise, a JSON object containing:
    • lamports: <u64> - number of lamports assigned to this account, as a u64
    • data: <[string, encoding]|object> - data associated with the account, either as encoded binary data or JSON format {<program>: <state>} - depending on encoding parameter
    • owner: <string> - base-58 encoded Pubkey of the program this account has been assigned to
    • executable: <bool> - boolean indicating if the account contains a program (and is strictly read-only)
    • rentEpoch: <u64> - Deprecated field
    • space: <u64> - the data size of the account

Code sample

curl "https://testnet.atlas.xyz/?apikey=$ATLAS_API_KEY" -X POST -H "Content-Type: application/json" -d '
{
"jsonrpc": "2.0",
"id": "0bdba4c1-3073-41b0-b849-46f14e004e38",
"method": "getAccountInfo",
"params": [
"PhoeNiXZ8ByJGLkxNfZRnkUfjvmuYqLR89jjFHGqdXY",
{
"encoding": "base58"
}
]
}
'

Response

{
"jsonrpc": "2.0",
"id": "0bdba4c1-3073-41b0-b849-46f14e004e38",
"result": {
"context": {
"slot": 11138057
},
"value": {
"lamports": 1141440,
"data": ["t64jNjCQ9cUN89xEttBvaFTkzjr6oLTWGXbdW4qMXKNbfk8n", "base58"],
"owner": "BPFLoaderUpgradeab1e11111111111111111111111",
"executable": true,
"rentEpoch": 0,
"space": 36
}
}
}