getTokenAccountsByOwner RPC Method
Returns all SPL Token accounts by token owner.
params
stringrequired
Pubkey of account owner to query, as base-58 encoded string
objectrequired
A JSON object with one of the following fields:
objectoptional
Configuration object containing the following fields:
result
array
An array of JSON objects containing:
Request
$ curl https://api.devnet.solana.com -s -X \> POST -H "Content-Type: application/json" -d '> {> "jsonrpc": "2.0",> "id": 1,> "method": "getTokenAccountsByOwner",> "params": [> "A1TMhSGzQxMr1TboBKtgixKz1sS6REASMxPo1qsyTSJd",> {> "programId": "TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA"> },> {> "encoding": "jsonParsed"> }> ]> }> '
Response
{"jsonrpc": "2.0","result": {"context": { "apiVersion": "2.0.15", "slot": 341197933 },"value": [{"pubkey": "BGocb4GEpbTFm8UFV2VsDSaBXHELPfAXrvd4vtt8QWrA","account": {"data": {"program": "spl-token","parsed": {"info": {"isNative": false,"mint": "2cHr7QS3xfuSV8wdxo3ztuF4xbiarF6Nrgx3qpx3HzXR","owner": "A1TMhSGzQxMr1TboBKtgixKz1sS6REASMxPo1qsyTSJd","state": "initialized","tokenAmount": {"amount": "420000000000000","decimals": 6,"uiAmount": 420000000.0,"uiAmountString": "420000000"}},"type": "account"},"space": 165},"executable": false,"lamports": 2039280,"owner": "TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA","rentEpoch": 18446744073709551615,"space": 165}}]},"id": 1}
Request
$ curl https://api.devnet.solana.com -s -X \> POST -H "Content-Type: application/json" -d '> {> "jsonrpc": "2.0",> "id": 1,> "method": "getTokenAccountsByOwner",> "params": [> "A1TMhSGzQxMr1TboBKtgixKz1sS6REASMxPo1qsyTSJd",> {> "programId": "TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA"> },> {> "encoding": "jsonParsed"> }> ]> }> '
params
stringrequired
Pubkey of account owner to query, as base-58 encoded string
objectrequired
A JSON object with one of the following fields:
objectoptional
Configuration object containing the following fields:
result
Response
{"jsonrpc": "2.0","result": {"context": { "apiVersion": "2.0.15", "slot": 341197933 },"value": [{"pubkey": "BGocb4GEpbTFm8UFV2VsDSaBXHELPfAXrvd4vtt8QWrA","account": {"data": {"program": "spl-token","parsed": {"info": {"isNative": false,"mint": "2cHr7QS3xfuSV8wdxo3ztuF4xbiarF6Nrgx3qpx3HzXR","owner": "A1TMhSGzQxMr1TboBKtgixKz1sS6REASMxPo1qsyTSJd","state": "initialized","tokenAmount": {"amount": "420000000000000","decimals": 6,"uiAmount": 420000000.0,"uiAmountString": "420000000"}},"type": "account"},"space": 165},"executable": false,"lamports": 2039280,"owner": "TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA","rentEpoch": 18446744073709551615,"space": 165}}]},"id": 1}
array
An array of JSON objects containing:
Is this page helpful?