# getTokenHoldersAtSlot

> For the complete documentation index, see [llms.txt](/docs/llms.txt).

POST https://solana-mainnet.g.alchemy.com/v2/{apiKey}

Returns the token accounts holding a single SPL Token or Token-2022 mint as of a specific slot, ranked by balance.

Reference: https://www.alchemy.com/docs/chains/solana/solana-api-endpoints/get-token-holders-at-slot

## Parameters

| Name | Type | Required | Description |
|------|------|----------|-------------|
| mint | string | Yes | The base-58 encoded pubkey of the token mint. SPL Token and Token-2022 mints are both supported. |
| slot | integer | Yes | The slot to reconstruct the holder list at. There is no "latest slot" default; omitting `slot` is an error. |
| limit | integer | No | How many holders to return. Defaults to 1000; the server ceiling is 10000. |
| sortBy | enum | No | The ordering of the returned holders. Case-sensitive. `sort_by` is accepted as an alias. |

## Result

**Holders at slot** (object): The token accounts that held the mint at the requested slot, ranked by balance, along with the slot the result was computed at and the sort order applied.

## Example

### Request

```json
{
  "jsonrpc": "2.0",
  "method": "getTokenHoldersAtSlot",
  "params": [
    "EPjFWdd5AufqSSqeM2qN1xzybapC8G4wEGGkZwyTDt1v",
    430276235,
    2,
    "balance_desc"
  ],
  "id": 1
}
```

### Response

```json
{
  "jsonrpc": "2.0",
  "result": {
    "mint": "EPjFWdd5AufqSSqeM2qN1xzybapC8G4wEGGkZwyTDt1v",
    "slot": 430276235,
    "sortBy": "balance_desc",
    "holders": [
      {
        "holder": "3emsAVdmGKERbHjmGfQ6oZ1e35dkf5iYcS6U4CPKFVaa",
        "owner": "7VHUFJHWu2CuExkJcJrzhQPJ2oygupTWkL2A2For4BmE",
        "balanceRaw": "974620712305381",
        "balanceUi": "974620712.305381"
      },
      {
        "holder": "7KJjY7rArbydeLBF7gQ5LdqXRKRYyPArT99NEctsHsgU",
        "owner": "5tzFkiKscXHK5ZXCGbXZxdw7gTjjD1mBwuoFbhUvuAi9",
        "balanceRaw": "694102667534076",
        "balanceUi": "694102667.534076"
      }
    ]
  },
  "id": 1
}
```

## Code Examples

### cURL

```bash
curl --request POST \
  --url https://solana-mainnet.g.alchemy.com/v2/docs-demo \
  --header 'Content-Type: application/json' \
  --data '{
  "jsonrpc": "2.0",
  "id": 1,
  "method": "getTokenHoldersAtSlot",
  "params": [
    "EPjFWdd5AufqSSqeM2qN1xzybapC8G4wEGGkZwyTDt1v",
    430276235,
    2,
    "balance_desc"
  ]
}'
```

### JavaScript

```javascript
const options = {
  method: 'POST',
  headers: {'Content-Type': 'application/json'},
  body: JSON.stringify({
    jsonrpc: '2.0',
    id: 1,
    method: 'getTokenHoldersAtSlot',
    params: ['EPjFWdd5AufqSSqeM2qN1xzybapC8G4wEGGkZwyTDt1v', 430276235, 2, 'balance_desc']
  })
};

fetch('https://solana-mainnet.g.alchemy.com/v2/docs-demo', options)
  .then(res => res.json())
  .then(res => console.log(res))
  .catch(err => console.error(err));
```

### Python

```python
import requests

url = "https://solana-mainnet.g.alchemy.com/v2/docs-demo"

payload = {
    "jsonrpc": "2.0",
    "id": 1,
    "method": "getTokenHoldersAtSlot",
    "params": ["EPjFWdd5AufqSSqeM2qN1xzybapC8G4wEGGkZwyTDt1v", 430276235, 2, "balance_desc"]
}
headers = {"Content-Type": "application/json"}

response = requests.post(url, json=payload, headers=headers)

print(response.text)
```

### Go

```go
package main

import (
	"fmt"
	"strings"
	"net/http"
	"io"
)

func main() {

	url := "https://solana-mainnet.g.alchemy.com/v2/docs-demo"

	payload := strings.NewReader("{\n  \"jsonrpc\": \"2.0\",\n  \"id\": 1,\n  \"method\": \"getTokenHoldersAtSlot\",\n  \"params\": [\n    \"EPjFWdd5AufqSSqeM2qN1xzybapC8G4wEGGkZwyTDt1v\",\n    430276235,\n    2,\n    \"balance_desc\"\n  ]\n}")

	req, _ := http.NewRequest("POST", url, payload)

	req.Header.Add("Content-Type", "application/json")

	res, _ := http.DefaultClient.Do(req)

	defer res.Body.Close()
	body, _ := io.ReadAll(res.Body)

	fmt.Println(string(body))

}
```

### Java

```java
HttpResponse<String> response = Unirest.post("https://solana-mainnet.g.alchemy.com/v2/docs-demo")
  .header("Content-Type", "application/json")
  .body("{\n  \"jsonrpc\": \"2.0\",\n  \"id\": 1,\n  \"method\": \"getTokenHoldersAtSlot\",\n  \"params\": [\n    \"EPjFWdd5AufqSSqeM2qN1xzybapC8G4wEGGkZwyTDt1v\",\n    430276235,\n    2,\n    \"balance_desc\"\n  ]\n}")
  .asString();
```

### C#

```csharp
using RestSharp;


var options = new RestClientOptions("https://solana-mainnet.g.alchemy.com/v2/docs-demo");
var client = new RestClient(options);
var request = new RestRequest("");
request.AddJsonBody("{\n  \"jsonrpc\": \"2.0\",\n  \"id\": 1,\n  \"method\": \"getTokenHoldersAtSlot\",\n  \"params\": [\n    \"EPjFWdd5AufqSSqeM2qN1xzybapC8G4wEGGkZwyTDt1v\",\n    430276235,\n    2,\n    \"balance_desc\"\n  ]\n}", false);
var response = await client.PostAsync(request);

Console.WriteLine("{0}", response.Content);

```


## OpenRPC Method Specification

```yaml
name: getTokenHoldersAtSlot
summary: Returns the token accounts holding a single SPL Token or Token-2022 mint as of a specific slot, ranked by balance.
description: Returns the token accounts holding a single SPL Token or Token-2022 mint as of a specific slot, ranked by balance.
paramStructure: by-name
params:
  - name: mint
    required: true
    description: The base-58 encoded pubkey of the token mint. SPL Token and Token-2022 mints are both supported.
    schema:
      title: Pubkey
      type: string
      description: Base-58 encoded public key.
  - name: slot
    required: true
    description: The slot to reconstruct the holder list at. There is no "latest slot" default; omitting `slot` is an error.
    schema:
      type: integer
      minimum: 0
  - name: limit
    required: false
    description: How many holders to return. Defaults to 1000; the server ceiling is 10000.
    schema:
      type: integer
      minimum: 0
      default: 1000
  - name: sortBy
    required: false
    description: The ordering of the returned holders. Case-sensitive. `sort_by` is accepted as an alias.
    schema:
      title: GetTokenHoldersAtSlot SortBy
      type: string
      description: The ordering of the returned holders. `balance_desc` (default) returns the largest balance first; `balance_asc` returns the smallest non-zero balance first. Case-sensitive. `sort_by` is accepted as an alias for `sortBy`.
      enum:
        - balance_desc
        - balance_asc
      default: balance_desc
examples:
  - name: getTokenHoldersAtSlot example
    params:
      - name: mint
        value: EPjFWdd5AufqSSqeM2qN1xzybapC8G4wEGGkZwyTDt1v
      - name: slot
        value: 430276235
      - name: limit
        value: 2
      - name: sortBy
        value: balance_desc
    result:
      name: Holders at slot
      value:
        mint: EPjFWdd5AufqSSqeM2qN1xzybapC8G4wEGGkZwyTDt1v
        slot: 430276235
        sortBy: balance_desc
        holders:
          - holder: 3emsAVdmGKERbHjmGfQ6oZ1e35dkf5iYcS6U4CPKFVaa
            owner: 7VHUFJHWu2CuExkJcJrzhQPJ2oygupTWkL2A2For4BmE
            balanceRaw: '974620712305381'
            balanceUi: '974620712.305381'
          - holder: 7KJjY7rArbydeLBF7gQ5LdqXRKRYyPArT99NEctsHsgU
            owner: 5tzFkiKscXHK5ZXCGbXZxdw7gTjjD1mBwuoFbhUvuAi9
            balanceRaw: '694102667534076'
            balanceUi: '694102667.534076'
result:
  name: Holders at slot
  description: The token accounts that held the mint at the requested slot, ranked by balance, along with the slot the result was computed at and the sort order applied.
  schema:
    title: GetTokenHoldersAtSlot Result
    type: object
    description: The token accounts that held the mint at the requested slot, ranked by balance, along with the slot the result was computed at and the sort order applied. Accounts with a zero balance are excluded; accounts with equal balances have no defined relative order.
    properties:
      mint:
        title: Pubkey
        type: string
        description: The mint queried.
      slot:
        type: integer
        description: The slot the holder list was computed at.
      sortBy:
        title: GetTokenHoldersAtSlot SortBy
        type: string
        description: The ordering applied, echoed back.
        enum:
          - balance_desc
          - balance_asc
        default: balance_desc
      holders:
        type: array
        description: The holders of the mint, in `sortBy` order.
        items:
          title: Token Holders At Slot Holder
          type: object
          description: A single token account holding the mint at the requested slot. Balances are reported per token account and are never summed per owner; a wallet with several token accounts of the same mint occupies several rows.
          properties:
            holder:
              title: Pubkey
              type: string
              description: The token account address.
            owner:
              title: Pubkey
              type: string
              description: The wallet that controls the token account.
            balanceRaw:
              type: string
              description: Raw token amount, as an integer string. Returned as a string so large values survive JSON parsing without precision loss. Parse as a big integer, not a float.
            balanceUi:
              type: string
              description: Human-readable amount (`balanceRaw` scaled by the mint's decimals). Returned as a string for the same precision-preserving reasons as `balanceRaw`.
errors:
  - code: -32602
    message: Invalid params. Common causes include a missing or malformed `mint` (must be a 32-byte base-58 pubkey), a missing or non-integer `slot`, a non-integer `limit`, an unknown `sortBy` value (only `balance_desc` and `balance_asc` are accepted, case-sensitive), a `params` value that is neither an array nor an object, or a mint that is not present in the index.
  - code: -32601
    message: Method not found.
  - code: -32603
    message: Internal error. Retry the request; if it persists, contact support.
```
