Returns all information associated with the account of provided public key.
Parameters
The public key of the account to query (base-58 encoded string)
Configuration object containing the following optional fields:
The level of commitment to use for querying the network:
processed: Latest block (unconfirmed)
confirmed: Confirmed by supermajority
finalized: Finalized by supermajority
Encoding format for the account data:
base58
base64
base64+zstd
jsonParsed (limited to certain account types)
Request a slice of the account’s data:
offset: number - Start position (in bytes)
length: number - Number of bytes to return
The minimum slot that the request can be evaluated at
Response
If the requested account doesn’t exist, returns null. Otherwise, returns an object containing:
The slot the request was processed at
Number of lamports assigned to the account
Base-58 encoded public key of the program that owns this account
Whether this account contains a program
The epoch at which this account will next owe rent
[string, string] | object
The account’s data. Format depends on the encoding parameter:
[string, encoding] tuple if encoded as base58/base64
- Parsed JSON object if encoding is “jsonParsed”
The space used by the account’s data
Code Examples
Basic Request
Response
Request with Data Slice
Using web3.js
Notes
-
The
jsonParsed encoding is only available for certain account types:
- Stake account
- Token account
- Token mint
- Token metadata
-
When using
dataSlice, the data field will be limited to the requested slice only.
-
The account data may be encoded differently based on the program that owns the account.
Common Errors