> ## Documentation Index
> Fetch the complete documentation index at: https://goldrush.dev/docs/llms.txt
> Use this file to discover all available pages before exploring further.

# getTokenAccountsByDelegate on Solana

> getTokenAccountsByDelegate returns all SPL token accounts delegated to an address on Solana, via GoldRush JSON-RPC.

> [card] 0.05 credits per call

`getTokenAccountsByDelegate` on **Solana**: Returns all SPL token accounts delegated to an address.

## Endpoint

```
https://rpc.goldrushdata.com/v1/solana-mainnet
```

Authenticate with `Authorization: Bearer <GOLDRUSH_API_KEY>`. See [authentication](https://goldrush.dev/docs/goldrush-json-rpc/authentication.md).

## Parameters

| Name | Type | Required | Description | Example |
| - | - | - | - | - |
| `delegate` | `string` | yes | Base-58 encoded delegate address. | `"4Nd1mBQtrMJVYVfKf2PJy9NZUZdTAsp7D4xWLs4gDB4T"` |
| `filter` | `object` | yes | Either `{mint}` or `{programId}`. Exactly one is required. | `{"programId":"TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA"}` |
| `config` | `object` | no | `{commitment?, encoding?, dataSlice?, minContextSlot?}`. | `{"encoding":"jsonParsed"}` |

## Returns

`object`: `{context, value: array<{pubkey, account}>}`.

```json theme={null}
{"context":{"slot":372877175},"value":[{"pubkey":"28bf...","account":{"data":{"parsed":{"info":{"delegate":"4Nd1...","tokenAmount":{"amount":"100","decimals":6,"uiAmount":0.0001}}}}}}]}
```

## Examples

```bash curl theme={null}
curl https://rpc.goldrushdata.com/v1/solana-mainnet \
  -H "Authorization: Bearer $GOLDRUSH_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "jsonrpc": "2.0",
    "id": 1,
    "method": "getTokenAccountsByDelegate",
    "params": ["4Nd1mBQtrMJVYVfKf2PJy9NZUZdTAsp7D4xWLs4gDB4T", {"programId":"TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA"}, {"encoding":"jsonParsed"}]
  }'
```

```typescript @solana/kit theme={null}
import {
  createDefaultRpcTransport,
  createSolanaRpcFromTransport,
} from "@solana/kit";

const transport = createDefaultRpcTransport({
  url: "https://rpc.goldrushdata.com/v1/solana-mainnet",
  headers: { Authorization: `Bearer ${process.env.GOLDRUSH_API_KEY}` },
});
const rpc = createSolanaRpcFromTransport(transport);

const result = await rpc.getTokenAccountsByDelegate("4Nd1mBQtrMJVYVfKf2PJy9NZUZdTAsp7D4xWLs4gDB4T", {"programId":"TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA"}, {"encoding":"jsonParsed"}).send();
console.log(result);
```

```python python theme={null}
import os
import requests

resp = requests.post(
    "https://rpc.goldrushdata.com/v1/solana-mainnet",
    headers={
        "Authorization": f"Bearer {os.environ['GOLDRUSH_API_KEY']}",
        "Content-Type": "application/json",
    },
    json={"jsonrpc": "2.0", "id": 1, "method": "getTokenAccountsByDelegate", "params": ["4Nd1mBQtrMJVYVfKf2PJy9NZUZdTAsp7D4xWLs4gDB4T", {"programId":"TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA"}, {"encoding":"jsonParsed"}]},
)
print(resp.json()["result"])
```

## Errors

Standard JSON-RPC errors: `-32600` invalid request, `-32601` method not found, `-32602` invalid params.

## Related Token info methods on Solana

* [`getTokenAccountsByOwner` on Solana](https://goldrush.dev/docs/api-reference/json-rpc/solana/gettokenaccountsbyowner)
* [`getTokenAccountBalance` on Solana](https://goldrush.dev/docs/api-reference/json-rpc/solana/gettokenaccountbalance)
* [`getTokenSupply` on Solana](https://goldrush.dev/docs/api-reference/json-rpc/solana/gettokensupply)
* [`getTokenLargestAccounts` on Solana](https://goldrush.dev/docs/api-reference/json-rpc/solana/gettokenlargestaccounts)
* [`requestAirdrop` on Solana](https://goldrush.dev/docs/api-reference/json-rpc/solana/requestairdrop)


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.