getTokenAccountsByDelegate
Last updated:
`getTokenAccountsByDelegate` returns every SPL Token account whose delegate authority has been set to the public key you provide. When a token-account owner calls `approve`, they grant a delegate the right to transfer up to a fixed amount on their behalf; this method enumerates all accounts that have named a particular delegate.
You must narrow the query with exactly one filter — either a specific `mint` (only accounts of that token) or a `programId` (all accounts owned by that token program, typically the SPL Token or Token-2022 program). The result is a positional `value` array of `{ pubkey, account }` pairs read at a single slot, so the set is internally consistent.
Use `jsonParsed` encoding to get a decoded token-account object (mint, owner, delegate, token amount) instead of raw bytes — this is usually what you want for displaying delegated balances. This is the delegate-keyed counterpart of [`getTokenAccountsByOwner`](./getTokenAccountsByOwner.md), which keys by the account owner instead.
Parameters
| Name | Type | Required | Description |
|---|---|---|---|
| delegate | Pubkey | Yes | |
| filter | TokenAccountsFilter | Yes | |
| config | GetTokenAccountsConfig | No |
Returns
| Field | Type |
|---|---|
| result | object |
Examples
curl https://<your-endpoint>/ \
-X POST -H 'Content-Type: application/json' \
-d '{"jsonrpc":"2.0","id":1,"method":"getTokenAccountsByDelegate","params":["<delegate>","<filter>","<config>"]}'const res = await fetch("https://<your-endpoint>/", {
method: "POST",
headers: { "Content-Type": "application/json" },
body: JSON.stringify({
"id": 1,
"method": "getTokenAccountsByDelegate",
"params": [
"<delegate>",
"<filter>",
"<config>"
],
"jsonrpc": "2.0"
}),
});
const data = await res.json();import requests
resp = requests.post("https://<your-endpoint>/", json={"id":1,"method":"getTokenAccountsByDelegate","params":["<delegate>","<filter>","<config>"],"jsonrpc":"2.0"})
print(resp.json())Usage
- Transport: HTTP (JSON-RPC).
- Networks: mainnet, devnet, testnet.
- Credit cost: 1 per call.
FAQ
- What does getTokenAccountsByDelegate do?
- Returns all SPL Token accounts that have approved a given delegate, filtered by mint or by token program.
- How many credits does getTokenAccountsByDelegate cost?
- getTokenAccountsByDelegate costs 1 credit(s) per call on Triport by default.
- Is getTokenAccountsByDelegate available over WebSocket?
- getTokenAccountsByDelegate is an HTTP JSON-RPC method.