# Token Methods

> Methods for querying SPL token data.

Canonical: https://nolimitnodes.com/docs/api-reference/solana-rpc/tokens

## getTokenAccountBalance
**POST** - JSON-RPC

Returns the token balance of an SPL Token account.

### `params[0]`, string, required

Token account Pubkey as a base-58 encoded string.

### `params[1]`, object

Configuration object with optional `commitment`.

```bash curl
curl https://rpc.nln.clr3.org \
  -H "Content-Type: application/json" \
  -H "x-api-key: YOUR_API_KEY" \
  -d '{"jsonrpc":"2.0","id":1,"method":"getTokenAccountBalance","params":["7fUAJdStEuGbc3sM84cKRL6yYaaSstyLSU4ve5oovLS7"]}'
```
```json Request
{
  "jsonrpc": "2.0",
  "id": 1,
  "method": "getTokenAccountBalance",
  "params": ["7fUAJdStEuGbc3sM84cKRL6yYaaSstyLSU4ve5oovLS7"]
}
```

```json Response
{
  "jsonrpc": "2.0",
  "result": {
    "context": { "slot": 1114 },
    "value": {
      "amount": "9864",
      "decimals": 2,
      "uiAmount": 98.64,
      "uiAmountString": "98.64"
    }
  },
  "id": 1
}
```

***

## getTokenAccountsByOwner
**POST** - JSON-RPC

Returns all SPL Token accounts by token owner.

### `params[0]`, string, required

Owner Pubkey as a base-58 encoded string.

### `params[1]`, object, required

Filter object - must contain one of:
  - `mint` (string) - token mint address
  - `programId` (string) - SPL Token program ID

### `params[2]`, object

Configuration object with `encoding`, `commitment`, `dataSlice`, `minContextSlot`.

```bash curl
curl https://rpc.nln.clr3.org \
  -H "Content-Type: application/json" \
  -H "x-api-key: YOUR_API_KEY" \
  -d '{"jsonrpc":"2.0","id":1,"method":"getTokenAccountsByOwner","params":["4Qkev8aNZcqFNSRhQzwyLMFSsi94jHqE8WNVTJzTP99F",{"programId":"TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA"},{"encoding":"jsonParsed"}]}'
```
```json Request
{
  "jsonrpc": "2.0",
  "id": 1,
  "method": "getTokenAccountsByOwner",
  "params": [
    "4Qkev8aNZcqFNSRhQzwyLMFSsi94jHqE8WNVTJzTP99F",
    { "programId": "TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA" },
    { "encoding": "jsonParsed" }
  ]
}
```

```json Response
{
  "jsonrpc": "2.0",
  "result": {
    "context": { "slot": 1114 },
    "value": [
      {
        "account": {
          "data": {
            "parsed": {
              "info": {
                "isNative": false,
                "mint": "3wyAj7Rt1TWVPZVteFJPR1GhW8djSzmXbpAqk7uP8dWu",
                "owner": "4Qkev8aNZcqFNSRhQzwyLMFSsi94jHqE8WNVTJzTP99F",
                "state": "initialized",
                "tokenAmount": {
                  "amount": "1",
                  "decimals": 1,
                  "uiAmount": 0.1,
                  "uiAmountString": "0.1"
                }
              },
              "type": "account"
            },
            "program": "spl-token",
            "space": 165
          },
          "executable": false,
          "lamports": 2039280,
          "owner": "TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA",
          "rentEpoch": 4,
          "space": 165
        },
        "pubkey": "28YTZEwqtMHWrhWcvv34se7pjS7wctgqzCPB3gReCFKp"
      }
    ]
  },
  "id": 1
}
```

***

## getTokenAccountsByDelegate
**POST** - JSON-RPC

Returns all SPL Token accounts approved by a given delegate.

### `params[0]`, string, required

Delegate Pubkey as a base-58 encoded string.

### `params[1]`, object, required

Filter object with `mint` or `programId`.

### `params[2]`, object

Configuration object with `encoding`, `commitment`, `dataSlice`, `minContextSlot`.

```bash curl
curl https://rpc.nln.clr3.org \
  -H "Content-Type: application/json" \
  -H "x-api-key: YOUR_API_KEY" \
  -d '{"jsonrpc":"2.0","id":1,"method":"getTokenAccountsByDelegate","params":["4Nd1mBQtrMJVYVfKf2PJy9NZUZdTAsp7D4xWLs4gDB4T",{"programId":"TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA"},{"encoding":"jsonParsed"}]}'
```
```json Request
{
  "jsonrpc": "2.0",
  "id": 1,
  "method": "getTokenAccountsByDelegate",
  "params": [
    "4Nd1mBQtrMJVYVfKf2PJy9NZUZdTAsp7D4xWLs4gDB4T",
    { "programId": "TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA" },
    { "encoding": "jsonParsed" }
  ]
}
```

```json Response
{
  "jsonrpc": "2.0",
  "result": {
    "context": { "slot": 1114 },
    "value": []
  },
  "id": 1
}
```

***

## getTokenLargestAccounts
**POST** - JSON-RPC

Returns the 20 largest accounts of a particular SPL Token type.

### `params[0]`, string, required

Token Mint Pubkey as a base-58 encoded string.

### `params[1]`, object

Configuration object with optional `commitment`.

```bash curl
curl https://rpc.nln.clr3.org \
  -H "Content-Type: application/json" \
  -H "x-api-key: YOUR_API_KEY" \
  -d '{"jsonrpc":"2.0","id":1,"method":"getTokenLargestAccounts","params":["3wyAj7Rt1TWVPZVteFJPR1GhW8djSzmXbpAqk7uP8dWu"]}'
```
```json Request
{
  "jsonrpc": "2.0",
  "id": 1,
  "method": "getTokenLargestAccounts",
  "params": ["3wyAj7Rt1TWVPZVteFJPR1GhW8djSzmXbpAqk7uP8dWu"]
}
```

```json Response
{
  "jsonrpc": "2.0",
  "result": {
    "context": { "slot": 1114 },
    "value": [
      {
        "address": "FYjHNoFtSQ5uijKrZFyYAxvEkiOiMM6sXB4VXgjB684V",
        "amount": "771",
        "decimals": 2,
        "uiAmount": 7.71,
        "uiAmountString": "7.71"
      }
    ]
  },
  "id": 1
}
```

***

## getTokenSupply
**POST** - JSON-RPC

Returns the total supply of an SPL Token type.

### `params[0]`, string, required

Token Mint Pubkey as a base-58 encoded string.

### `params[1]`, object

Configuration object with optional `commitment`.

```bash curl
curl https://rpc.nln.clr3.org \
  -H "Content-Type: application/json" \
  -H "x-api-key: YOUR_API_KEY" \
  -d '{"jsonrpc":"2.0","id":1,"method":"getTokenSupply","params":["3wyAj7Rt1TWVPZVteFJPR1GhW8djSzmXbpAqk7uP8dWu"]}'
```
```json Request
{
  "jsonrpc": "2.0",
  "id": 1,
  "method": "getTokenSupply",
  "params": ["3wyAj7Rt1TWVPZVteFJPR1GhW8djSzmXbpAqk7uP8dWu"]
}
```

```json Response
{
  "jsonrpc": "2.0",
  "result": {
    "context": { "slot": 1114 },
    "value": {
      "amount": "100000000000",
      "decimals": 2,
      "uiAmount": 1000000000,
      "uiAmountString": "1000000000"
    }
  },
  "id": 1
}
```
