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

> ## Agent Instructions
> This page is part of the Solana developer documentation at https://solana.com/developers/docs. Append `.md` to any docs URL, or send `Accept: text/markdown`, to get the page as Markdown.
> Index of all pages: https://solana.com/llms.txt. Per-section indexes such as https://solana.com/developers/docs/payments/llms.txt are smaller; prefer them when working on one task.
> Coding agents: install the official Solana skill for current APIs and conventions with `npx skills add https://github.com/solana-foundation/solana-dev-skill` (also served at https://solana.com/SKILL.md).
> Code in the cookbook and task pages comes from tested example files. Prefer it over writing API calls from memory.

# getVoteAccounts

> Returns vote accounts visible at the requested commitment, partitioned into current and delinquent.

<Info>
  **Source**

  [`get_vote_accounts`](https://github.com/anza-xyz/agave/blob/v4.3.2/rpc/src/rpc.rs#L1158)
</Info>

<RequestExample>
  ```bash cURL
  curl https://api.devnet.solana.com -s -X POST \
    -H "Content-Type: application/json" \
    -d '
    {
      "jsonrpc": "2.0",
      "id": 1,
      "method": "getVoteAccounts",
      "params": [
        {
          "commitment": "finalized",
          "votePubkey": "i7NyKBMJCA9bLM2nsGyAGCKHECuR2L5eh4GqFciuwNT"
        }
      ]
    }
  '
  ```

  ```ts Kit
  import { address, createSolanaRpc } from "@solana/kit";

  const rpc_url = "https://api.devnet.solana.com";
  const rpc = createSolanaRpc(rpc_url);

  let votePubkey = address("5ZWgXcyqrrNpQHCme5SdC5hCeYb2o3fEJhF7Gok3bTVN");

  let voteAccounts = await rpc
    .getVoteAccounts({
      votePubkey
    })
    .send();

  console.log(voteAccounts);
  ```

  ```ts web3.js
  import { Connection, PublicKey, clusterApiUrl } from "@solana/web3.js";

  const connection = new Connection(clusterApiUrl("devnet"), "confirmed");

  let voteAccounts = await connection.getVoteAccounts();

  console.log(voteAccounts);
  ```

  ```rs Rust
  use anyhow::Result;
  use solana_client::{nonblocking::rpc_client::RpcClient, rpc_config::RpcGetVoteAccountsConfig};
  use solana_commitment_config::CommitmentConfig;

  #[tokio::main]
  async fn main() -> Result<()> {
      let client = RpcClient::new_with_commitment(
          String::from("https://api.devnet.solana.com"),
          CommitmentConfig::confirmed(),
      );

      let vote_pubkey = String::from("5ZWgXcyqrrNpQHCme5SdC5hCeYb2o3fEJhF7Gok3bTVN");

      let config = RpcGetVoteAccountsConfig {
          vote_pubkey: Some(vote_pubkey),
          commitment: CommitmentConfig::finalized().into(),
          ..Default::default()
      };

      let vote_accounts = client.get_vote_accounts_with_config(config).await?;

      println!("{:#?}", vote_accounts);

      Ok(())
  }
  ```
</RequestExample>

<ResponseExample>
  ```json Response
  {
    "jsonrpc": "2.0",
    "result": {
      "current": [
        {
          "activatedStake": 38263229364446900,
          "commission": 95,
          "epochCredits": [
            [902, 1383125544, 1376213656],
            [903, 1390037304, 1383125544],
            [904, 1396949288, 1390037304],
            [905, 1403861272, 1396949288],
            [906, 1406766600, 1403861272]
          ],
          "epochVoteAccount": true,
          "inflationRewardsCommissionBps": 9500,
          "lastVote": 391573587,
          "nodePubkey": "dv2eQHeP4RFrJZ6UeiZWoc3XTtmtZCUKxxCApCDcRNV",
          "rootSlot": 391573556,
          "votePubkey": "i7NyKBMJCA9bLM2nsGyAGCKHECuR2L5eh4GqFciuwNT"
        }
      ],
      "delinquent": []
    },
    "id": 1
  }
  ```
</ResponseExample>

## Parameters

<ParamField body="config" type="object">
  Configuration object containing the following fields:

  <Expandable title="properties" defaultOpen>
    <ParamField body="commitment" type="string" default="finalized">
      Values: `processed`, `confirmed`, `finalized`

      Solana RPC uses the following commitment levels:

      | Value       | Description                                                                                                                                                                               |
      | ----------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
      | `processed` | Return data from the highest slot this node has processed. This is the newest view, but the block can still be skipped.                                                                   |
      | `confirmed` | Return data from the same slot as `finalized`. Kept for compatibility and planned for removal in a later release.                                                                         |
      | `finalized` | Return data from the highest slot with a finalization certificate, from votes by 80% of stake in one round or 60% of stake in each of two rounds. This is the strongest commitment level. |
    </ParamField>

    <ParamField body="votePubkey" type="string">
      Return only entries for this vote account address, as a base-58 encoded string.
    </ParamField>

    <ParamField body="keepUnstakedDelinquents" type="bool" default="false">
      Values: `true`, `false`

      Keep delinquent vote accounts even if their activated stake is zero.

      ```json Example
      { "keepUnstakedDelinquents": true }
      ```
    </ParamField>

    <ParamField body="delinquentSlotDistance" type="u64" default="128">
      Number of slots a validator may trail the selected slot before the RPC node
      classifies it as delinquent. **Note:** ecosystem tools usually leave this unset
      to preserve consistent behavior.

      ```json Example
      { "delinquentSlotDistance": 256 }
      ```
    </ParamField>
  </Expandable>
</ParamField>

## Result

<ResponseField name="result" type="object">
  Vote-account status object containing `current` and `delinquent` arrays of vote
  account records.

  <Expandable title="properties" defaultOpen>
    <ResponseField name="current" type="array">
      Vote accounts the RPC node classifies as current at the requested commitment.
    </ResponseField>

    <ResponseField name="delinquent" type="array">
      Vote accounts the RPC node classifies as delinquent at the requested commitment.

      Each element of `current` and `delinquent` is a vote-account object containing:

      | Field                           | Type     | Description                                                                                                                                                              |
      | ------------------------------- | -------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------ |
      | `activatedStake`                | `u64`    | Stake, in lamports, delegated to this vote account and active in the current epoch.                                                                                      |
      | `commission`                    | `u8`     | Commission rate used for rewards payout, as a percentage. Once SIMD-0291 is active, derived from `inflationRewardsCommissionBps`, rounded up to a whole percent.         |
      | `epochCredits`                  | `array`  | Recent history of earned credits for up to five epochs. Each element is `[epoch, credits, previousCredits]`.                                                             |
      | `epochVoteAccount`              | `bool`   | Whether this vote account is staked for the current epoch.                                                                                                               |
      | `inflationRewardsCommissionBps` | `u16`    | Commission rate used for inflation rewards, in basis points (`500` is 5%). Before SIMD-0291 activates, this is `commission` × 100. Nodes that predate the field omit it. |
      | `lastVote`                      | `u64`    | Most recent slot this vote account voted on. Returns `0` if no votes exist.                                                                                              |
      | `nodePubkey`                    | `string` | Validator identity pubkey, as a base-58 encoded string.                                                                                                                  |
      | `rootSlot`                      | `u64`    | Current root slot for this vote account. Returns `0` if no root slot exists.                                                                                             |
      | `votePubkey`                    | `string` | Vote account pubkey, as a base-58 encoded string.                                                                                                                        |
    </ResponseField>
  </Expandable>
</ResponseField>
