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

# getTokenAccountsByOwner

> Returns all SPL Token accounts by token owner.

Returns all SPL Token accounts by token owner.

## On ThorNode

Answered by FastGate through the ThorEdge RPC URL; no separate endpoint or key. `commitment` and `minContextSlot` are accepted and ignored: the response reflects FastGate's indexed slot, reported as `context.slot` (no `apiVersion`). The request times out after 30 s. Encodings: `base64` (default), `base58`, `base64+zstd`, `jsonParsed` (token accounts and mints; other accounts fall back to base64). The options parameter must be an object; `dataSlice` is ignored with `jsonParsed`. The second parameter (`{ "mint" }` or `{ "programId" }`) is required and must contain exactly one key. For very large owners use [`getTokenAccountsByOwnerV2`](/api-reference/fastgate/gettokenaccountsbyownerv2).

## Parameters

<ParamField body="address" type="string" required>
  Solana wallet address (pubkey) of the account owner to query token holdings for, as a base-58 encoded string.
</ParamField>

<ParamField body="mint" type="string">
  Specific Solana token mint address to retrieve only accounts for a particular token or NFT.
</ParamField>

<ParamField body="programId" type="string">
  Specific Solana token program ID (typically SPL Token program) that created the token accounts.
</ParamField>

<ParamField body="commitment" type="string">
  The commitment level for the request. Accepted and ignored by FastGate.

  * `confirmed`
  * `finalized`
  * `processed`
</ParamField>

<ParamField body="minContextSlot" type="number">
  The minimum slot that the request can be evaluated at. Accepted and ignored by FastGate.
</ParamField>

<ParamField body="dataSlice" type="object">
  Request a slice of the account's data.
</ParamField>

<ParamField body="dataSlice.length" type="number">
  Number of bytes to return.
</ParamField>

<ParamField body="dataSlice.offset" type="number">
  Byte offset from which to start reading.
</ParamField>

<ParamField body="encoding" type="string">
  Encoding format for Account data.

  * `base58`
  * `base64`
  * `base64+zstd`
  * `jsonParsed`
</ParamField>

## Response

<ResponseField name="context" type="object">
  Context of the response.

  <Expandable title="properties">
    <ResponseField name="slot" type="integer">
      Slot in which the data was fetched.
    </ResponseField>
  </Expandable>
</ResponseField>

<ResponseField name="value" type="array">
  List of token accounts.

  <Expandable title="item">
    <ResponseField name="pubkey" type="string">
      Account Pubkey as a base-58 encoded string.
    </ResponseField>

    <ResponseField name="account" type="object">
      Token account details.

      <Expandable title="properties">
        <ResponseField name="lamports" type="integer">
          Number of lamports assigned to the account.
        </ResponseField>

        <ResponseField name="owner" type="string">
          Pubkey of the program this account has been assigned to.
        </ResponseField>

        <ResponseField name="data" type="object">
          Token state data associated with the account.

          <Expandable title="properties">
            <ResponseField name="program" type="string">
              Program name.
            </ResponseField>

            <ResponseField name="parsed" type="object">
              Parsed token data.
            </ResponseField>

            <ResponseField name="space" type="integer">
              Space allocated for the account.
            </ResponseField>
          </Expandable>
        </ResponseField>

        <ResponseField name="executable" type="boolean">
          Indicates if the account contains a program.
        </ResponseField>

        <ResponseField name="rentEpoch" type="integer">
          Epoch at which the account will next owe rent.
        </ResponseField>

        <ResponseField name="space" type="integer">
          Data size of the account.
        </ResponseField>
      </Expandable>
    </ResponseField>
  </Expandable>
</ResponseField>

<RequestExample>
  ```bash cURL theme={null}
  curl --fail-with-body "$THORNODE_RPC_URL" \
    --header 'content-type: application/json' \
    --data '{
      "jsonrpc": "2.0",
      "id": 1,
      "method": "getTokenAccountsByOwner",
      "params": [
        "BghNaiR8KfW3Qt2hTaS6hqperaXvfumWhpP4EEMksXxX",
        {
          "mint": "EPjFWdd5AufqSSqeM2qN1xzybapC8G4wEGGkZwyTDt1v"
        },
        {
          "encoding": "jsonParsed"
        }
      ]
    }'
  ```

  ```javascript Node.js theme={null}
  const body = {
    "jsonrpc": "2.0",
    "id": 1,
    "method": "getTokenAccountsByOwner",
    "params": [
      "BghNaiR8KfW3Qt2hTaS6hqperaXvfumWhpP4EEMksXxX",
      {
        "mint": "EPjFWdd5AufqSSqeM2qN1xzybapC8G4wEGGkZwyTDt1v"
      },
      {
        "encoding": "jsonParsed"
      }
    ]
  };

  const response = await fetch(process.env.THORNODE_RPC_URL, {
    method: "POST",
    headers: { "content-type": "application/json" },
    body: JSON.stringify(body),
  });
  const { result, error } = await response.json();
  console.log(result ?? error);
  ```
</RequestExample>

<ResponseExample>
  ```json Response theme={null}
  {
    "jsonrpc": "2.0",
    "result": {
      "context": {
        "slot": 439749210
      },
      "value": [
        {
          "pubkey": "BCVfzZWUYiFQGQ4rCh9ycUoXZcu8aTLW5aiqsjhj7YAf",
          "account": {
            "lamports": 2039280,
            "data": {
              "program": "spl-token",
              "parsed": {
                "info": {
                  "isNative": false,
                  "mint": "EPjFWdd5AufqSSqeM2qN1xzybapC8G4wEGGkZwyTDt1v",
                  "owner": "BghNaiR8KfW3Qt2hTaS6hqperaXvfumWhpP4EEMksXxX",
                  "state": "initialized",
                  "tokenAmount": {
                    "amount": "4192",
                    "decimals": 6,
                    "uiAmount": 0.004192,
                    "uiAmountString": "0.004192"
                  }
                },
                "type": "account"
              },
              "space": 165
            },
            "owner": "TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA",
            "executable": false,
            "rentEpoch": 18446744073709551615,
            "space": 165
          }
        }
      ]
    },
    "id": 1
  }
  ```
</ResponseExample>
