SOLAPI.PRO Docs
  • 🔗HTTP
    • getAccountInfo
    • getBalance
    • getBlock
    • getBlockCommitment
    • getBlockHeight
    • getBlockProduction
    • getBlocks
    • getBlocksWithLimit
    • getClusterNodes
    • getEpochInfo
    • getEpochSchedule
    • getFeeForMessage
    • getFirstAvailableBlock
    • getGenesisHash
    • getHealth
    • getHighestSnapshotSlot
    • getIdentity
    • getInflationGovernor
    • getInflationRate
    • getInflationReward
    • getLargestAccounts
    • getLatestBlockhash
    • getLeaderSchedule
    • getMaxRetransmitSlot
    • getMaxShredInsertSlot
    • getMinimumBalanceForRentExemption
    • getMultipleAccounts
    • getProgramAccounts
    • getRecentPerformanceSamples
    • getRecentPrioritizationFees
    • getSignatureStatuses
    • getSignaturesForAddress
    • getSlot
    • getSlotLeader
    • getSlotLeaders
    • getStakeMinimumDelegation
    • getSupply
    • getTokenAccountBalance
    • getTokenAccountsByDelegate
    • getTokenAccountsByOwner
    • getTokenLargestAccounts
    • getTokenSupply
    • getTransaction
    • getTransactionCount
    • getVersion
    • getVoteAccounts
    • isBlockhashValid
    • minimumLedgerSlot
    • requestAirdrop
    • sendTransaction
    • simulateTransaction
  • ⁉️Common Error Codes
Powered by GitBook
On this page
  1. 🔗HTTP

getTokenAccountsByDelegate

Returns all SPL Token accounts by approved Delegate.

getTokenAccountsByDelegate

POST http://srpc.solapi.pro/?api_key=<api-key>

Request:

const response = await fetch('http://srpc.solapi.pro/?api_key=<api-key>', {
    method: 'POST',
    headers: {
      "Content-Type": "application/json"
    },
    body: JSON.stringify({
      "jsonrpc": "2.0",
      "id": 1,
      "method": "getTokenAccountsByDelegate",
      "params": [
        "4Nd1mBQtrMJVYVfKf2PJy9NZUZdTAsp7D4xWLs4gDB4T",
        {
          "programId": "TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA"
        },
        {
          "encoding": "jsonParsed"
        }
      ]
    }),
});
const data = await response.json();

Response:

{
  "jsonrpc": "2.0",
  "id": "1",
  "result": {
    "context": {
      "slot": 1114
    },
    "value": [
      {
        "pubkey": "28YTZEwqtMHWrhWcvv34se7pjS7wctgqzCPB3gReCFKp",
        "account": {
          "lamports": 1726080,
          "owner": "TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA",
          "data": {
            "program": "spl-token",
            "parsed": {
              "info": {
                "tokenAmount": {
                  "amount": "1",
                  "decimals": 1,
                  "uiAmount": 0.1,
                  "uiAmountString": "0.1"
                },
                "delegate": "4Nd1mBQtrMJVYVfKf2PJy9NZUZdTAsp7D4xWLs4gDB4T",
                "delegatedAmount": {
                  "amount": "1",
                  "decimals": 1,
                  "uiAmount": 0.1,
                  "uiAmountString": "0.1"
                }
              },
              "state": "initialized",
              "isNative": false,
              "mint": "3wyAj7Rt1TWVPZVteFJPLa26JmLvdb1CAKEFZm3NY75E",
              "owner": "CnPoSPKXu7wJqxe59Fs72tkBeALovhsCxYeFwPCQH9TD"
            },
            "space": 165
          },
          "executable": false,
          "rentEpoch": 4,
          "space": 165
        }
      }
    ]
  }
}
PreviousgetTokenAccountBalanceNextgetTokenAccountsByOwner

Last updated 4 months ago