Account Methods
getAccountInfo
POST - JSON-RPC
Returns all information associated with the account of the provided Pubkey.
stringrequiredAccount Pubkey as a base-58 encoded string.
objectConfiguration object:
encoding(string) -base58,base64,base64+zstd,jsonParseddataSlice(object) -{ offset: number, length: number }to limit returned datacommitment(string) - commitment level
bash
curl https://api.mainnet-beta.solana.com \
-H "Content-Type: application/json" \
-H "x-api-key: YOUR_API_KEY" \
-d '{"jsonrpc":"2.0","id":1,"method":"getAccountInfo","params":["vines1vzrYbzLMRdu58ou5XTby4qAqVRLmqo36NKPTg",{"encoding":"base64"}]}'json
{
"jsonrpc": "2.0",
"id": 1,
"method": "getAccountInfo",
"params": [
"vines1vzrYbzLMRdu58ou5XTby4qAqVRLmqo36NKPTg",
{ "encoding": "base64" }
]
}json
{
"jsonrpc": "2.0",
"result": {
"context": { "slot": 1 },
"value": {
"data": ["", "base64"],
"executable": false,
"lamports": 1000000000,
"owner": "11111111111111111111111111111111",
"rentEpoch": 2,
"space": 80
}
},
"id": 1
}getBalance
POST - JSON-RPC
Fetches the lamport balance of the account associated with the provided Pubkey.
stringrequiredAccount Pubkey as a base-58 encoded string.
objectConfiguration object with commitment and minContextSlot.
bash
curl https://api.mainnet-beta.solana.com \
-H "Content-Type: application/json" \
-H "x-api-key: YOUR_API_KEY" \
-d '{"jsonrpc":"2.0","id":1,"method":"getBalance","params":["83astBRguLMdt2h5U1Tbd1hZemEfWp1YGt6jZvoRoKCo"]}'json
{
"jsonrpc": "2.0",
"id": 1,
"method": "getBalance",
"params": ["83astBRguLMdt2h5U1Tbd1hZemEfWp1YGt6jZvoRoKCo"]
}json
{
"jsonrpc": "2.0",
"result": {
"context": { "slot": 1 },
"value": 0
},
"id": 1
}getMultipleAccounts
POST - JSON-RPC
Returns the account information for a list of Pubkeys (up to 100).
arrayrequiredArray of Pubkeys as base-58 encoded strings (max 100).
objectConfiguration object with encoding, commitment, dataSlice, minContextSlot.
bash
curl https://api.mainnet-beta.solana.com \
-H "Content-Type: application/json" \
-H "x-api-key: YOUR_API_KEY" \
-d '{"jsonrpc":"2.0","id":1,"method":"getMultipleAccounts","params":[["vines1vzrYbzLMRdu58ou5XTby4qAqVRLmqo36NKPTg","4fYNw3dojWmQ4dXtSGE9epjRGy9pFSx62YypT7avPYvA"],{"encoding":"base64"}]}'json
{
"jsonrpc": "2.0",
"id": 1,
"method": "getMultipleAccounts",
"params": [
[
"vines1vzrYbzLMRdu58ou5XTby4qAqVRLmqo36NKPTg",
"4fYNw3dojWmQ4dXtSGE9epjRGy9pFSx62YypT7avPYvA"
],
{ "encoding": "base64" }
]
}json
{
"jsonrpc": "2.0",
"result": {
"context": { "slot": 1 },
"value": [
{
"data": ["", "base64"],
"executable": false,
"lamports": 1000000000,
"owner": "11111111111111111111111111111111",
"rentEpoch": 2,
"space": 80
},
null
]
},
"id": 1
}getProgramAccounts
POST - JSON-RPC
Returns all accounts owned by the provided program Pubkey.
stringrequiredProgram Pubkey as a base-58 encoded string.
objectConfiguration object:
encoding(string) - data encoding formatcommitment(string) - commitment levelfilters(array) - filter criteria (memcmpordataSize)dataSlice(object) - limit returned datawithContext(boolean) - wrap result in contextminContextSlot(integer) - minimum slot for evaluation
bash
curl https://api.mainnet-beta.solana.com \
-H "Content-Type: application/json" \
-H "x-api-key: YOUR_API_KEY" \
-d '{"jsonrpc":"2.0","id":1,"method":"getProgramAccounts","params":["TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA",{"encoding":"base64","filters":[{"dataSize":165}]}]}'json
{
"jsonrpc": "2.0",
"id": 1,
"method": "getProgramAccounts",
"params": [
"TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA",
{
"encoding": "base64",
"filters": [
{ "dataSize": 165 }
]
}
]
}json
{
"jsonrpc": "2.0",
"result": [
{
"account": {
"data": ["", "base64"],
"executable": false,
"lamports": 2039280,
"owner": "TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA",
"rentEpoch": 0,
"space": 165
},
"pubkey": "CnPoSPKXu7wJqxe59Fs72tkBeALovhsCxYeFwPCQH9TD"
}
],
"id": 1
}