getTokenAccountsByOwner - Solana

getTokenAccountsByOwner. Fetches all token accounts owned by a specified owner

getTokenAccountsByOwner - solana [Value: 12CU]
The method in Solana fetches all token accounts owned by a specified owner
Use cases

Use cases

  • Fetch all token accounts owned by a specific address
  • Monitor multiple token accounts under a single owner
  • Analyze token distribution for portfolio management
Constraints

Constraints

  • Limited to accounts owned by the specified address
  • Dependent on real-time network data
  • API rate limits may impact query frequency
Get started
Unlock Access to 50+ chains
Boost your app's speed and reliability with dRPC - get your access API key

Language

Request
Examples
curl https://solana.drpc.org \
  -X POST \
  -H "Content-Type: application/json" \
  --data '{"jsonrpc": "2.0","id": 1,"method": "getTokenAccountsByOwner","params": ["GgPpTKg78vmzgDtP1DNn72CHAYjRdKY7AV6zgszoHCSa",{"mint": "1YDQ35V8g68FGvcT85haHwAXv1U7XMzuc4mZeEXfrjE"},{"encoding": "jsonParsed"}]}'
Copy
Response
200
{
  "jsonrpc": "2.0",
  "result": {
    "context": {
      "slot": 98123569
    },
    "value": [
      {
        "pubkey": "GgPpTKg78vmzgDtP1DNn72CHAYjRdKY7AV6zgszoHCSa",
        "account": {
          "data": {
            "parsed": {
              "info": {
                "mint": "1YDQ35V8g68FGvcT85haHwAXv1U7XMzuc4mZeEXfrjE",
                "owner": "GgPpTKg78vmzgDtP1DNn72CHAYjRdKY7AV6zgszoHCSa",
                "tokenAmount": {
                  "amount": "1000000",
                  "decimals": 6,
                  "uiAmount": 1.0,
                  "uiAmountString": "1.0"
                }
              },
              "type": "account"
            },
            "program": "spl-token",
            "space": 165
          },
          "executable": false,
          "lamports": 2039280,
          "owner": "TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA",
          "rentEpoch": 42
        }
      }
    ]
  },
  "id": 1
}
Copy

Request params

idinteger
jsonrpcstring
methodstring
Parametersarray
array
accountPublicKeystring
The public key of the account to query.
encodingstring
Specifies the data encoding for the returned account information
dataSliceobject
Limits the returned account data based on the specified offset and length fields. Available only for "base58", "base64", or "base64+zstd" encodings.
objectobject
array
mintstring
The public key of the specific token Mint, encoded in base-58 format, to restrict accounts to
programIdstring
The public key of the Token program ID that owns the accounts, encoded in base-58 format.
commitmentstring
The level of commitment required for the query
  • finalized - The node will query the most recent block confirmed by supermajority of the cluster as having reached maximum lockout, meaning the cluster has recognized this block as finalized
  • confirmed - The node will query the most recent block that has been voted on by supermajority of the cluster
  • processed - The node will query its most recent block. Note that the block may not be complete

Response

200
returns the token accounts for a specified mint, including their addresses and balances, providing a snapshot of the largest holders of that token

Response params

object
idinteger
jsonrpcstring
resultstring
object
contextobject
Contains information about the current state of the program
object
slotinteger
The slot number used to retrieve the fee calculator.
apiVersionstring
The version of the Solana RPC API being used
valueobject
object
executableboolean
Indicates if the account contains a program and is read-only.
lamportsinteger
The total lamports allocated to this account.
ownerstring
The base-58 encoded public key of the program assigned to this account.
rentEpochinteger
The epoch at which the token account will be subject to rent
spaceinteger
The storage capacity required for the token account.
accountstring
The address used to store assets on the Solana blockchain.
object
spaceinteger
The amount of storage space required to store the token account.
programstring
The program responsible for managing the token.
datastring
Encoded data to be passed to the instruction.
object
programstring
The program managing the token.
typestring
parsedarray
List of parsed instructions executed in the block's transactions.
object
delegatestring
Public address of the delegate for retrieving account tokens, encoded as base-58.
isNativeboolean
Indicates if the token is native to the Solana blockchain
mintstring
Information about the creation of new tokens
ownerstring
The base-58 encoded public key of the program assigned to this account
statestring
Current state of the token account
infoarray
Additional details about the transactions.
object
tokenAmountstring
Balance of tokens in the account.
amountstring
Raw token supply, without decimals, as a u64 integer.
decimalsinteger
Number of decimal places the token uses.
uiAmountstring
Total token supply with mint-prescribed decimals (DEPRECATED).
uiAmountStringstring
Total token supply as a string, with mint-prescribed decimals.
delegateAmountobject
Configuration for delegate amount.
object
tokenAmountstring
Balance of tokens in the account.
amountstring
Raw token supply, without decimals, as a u64 integer.
decimalsinteger
Number of decimal places the token uses.
uiAmountstring
Total token supply with mint-prescribed decimals (DEPRECATED).
uiAmountStringstring
Total token supply as a string, with mint-prescribed decimals.
ownerstring
Base-58 encoded public key of the program assigned to this account
datastring
Data associated with the account, either as encoded binary data or in JSON format, depending on the specified encoding. Format: [data, encoding] or JSON object
executableboolean
dicates if the account contains a program and is read-only.
rentEpochinteger
The epoch at which this account will next owe rent.