---
title: getAccountInfo
description: >-
  Returns the account state and metadata for a single address. Returns null if
  the account does not exist at the requested commitment.
url: /docs/rpc/http/getaccountinfo
type: reference
hideTableOfContents: true
---

Returns the account state and metadata for a single address. Returns `null` if
the account does not exist at the requested commitment.

<Callout type="info" title="Source">
  [`get_account_info`](https://github.com/anza-xyz/agave/blob/v3.1.8/rpc/src/rpc.rs#L530)
</Callout>

<APIMethod>

```jsonc !!request curl
{
  "jsonrpc": "2.0",
  "id": 1,
  "method": "getAccountInfo",
  "params": [
    // !hover pubkey
    "vines1vzrYbzLMRdu58ou5XTby4qAqVRLmqo36NKPTg",
    // !hover(1:4) config
    {
      // !hover commitment
      "commitment": "finalized",
      // !hover encoding
      "encoding": "base64"
    }
  ]
}
```

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

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

// !hover pubkey
const publicKey = address("vines1vzrYbzLMRdu58ou5XTby4qAqVRLmqo36NKPTg");
const accountInfo = await rpc.getAccountInfo(publicKey).send();

console.log("Account Info:", accountInfo);
```

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

const connection = new Connection(clusterApiUrl("devnet"), "confirmed");
// !hover pubkey
const publicKey = new PublicKey("vines1vzrYbzLMRdu58ou5XTby4qAqVRLmqo36NKPTg");
const accountInfo = await connection.getAccountInfo(publicKey);

console.log("Account Info:", JSON.stringify(accountInfo, null, 2));
```

```rs !!request title="Rust"
use anyhow::Result;
use solana_client::nonblocking::rpc_client::RpcClient;
use solana_commitment_config::CommitmentConfig;
use solana_sdk::pubkey::Pubkey;
use std::str::FromStr;

#[tokio::main]
async fn main() -> Result<()> {
    let client = RpcClient::new_with_commitment(
        String::from("https://api.devnet.solana.com"),
        CommitmentConfig::confirmed(),
    );
    let pubkey = Pubkey::from_str("vines1vzrYbzLMRdu58ou5XTby4qAqVRLmqo36NKPTg")?;
    let account = client.get_account(&pubkey).await?;

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

    Ok(())
}
```

### !params

#### !! pubkey

!type string  
!required

Pubkey of account to query, as base-58 encoded string.

#### !! config

!type object

Configuration object.

##### !! commitment

!type string  
!values processed confirmed finalized  
!default finalized

Solana RPC uses the following commitment levels:

| Value       | Description                                                                                                                                                                                                                                                                |
| ----------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| `processed` | Return data from the highest slot this node has processed on the fork it currently considers best. This is the newest view, but it can still change if the cluster switches forks.                                                                                         |
| `confirmed` | Return data from the highest slot that at least two-thirds of active stake has directly voted to confirm. This is more stable than `processed`, but it is still a weaker guarantee than `finalized`.                                                                       |
| `finalized` | Return data from the highest slot that the cluster recognizes as finalized. In practice, this means the slot has reached maximum vote lockout in validators' vote towers and is recognized by at least two-thirds of active stake. This is the strongest commitment level. |

##### !! encoding

!type string  
!values base58 base64 base64+zstd binary jsonParsed  
!default binary

Encoding format for account data.

| Encoding      | Data format                | Notes                                                                                                                                                                                                                       |
| ------------- | -------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| `base64`      | `[data, "base64"]`         | Recommended                                                                                                                                                                                                                 |
| `base58`      | `[data, "base58"]`         | Slow. The account's data field must be 128 bytes or fewer                                                                                                                                                                   |
| `base64+zstd` | `[data, "base64+zstd"]`    | [Zstandard](https://facebook.github.io/zstd/) compressed                                                                                                                                                                    |
| `jsonParsed`  | `{program, parsed, space}` | Falls back to `[data, "base64"]` if no parser found                                                                                                                                                                         |
| `binary`      | `string`                   | ⚠️ Deprecated. Legacy encoding retained for backwards compatibility. Same base58 encoding as `base58` with the same 128-byte data field limit, but returns data as a plain string instead of an array. Use `base64` instead |

If you use `jsonParsed`, the returned data object uses the stable wrapper
`{program, parsed, space}`. The `program` field identifies the parser that
produced `parsed`. If no parser is available, the RPC node falls back to
`[data, "base64"]`.

| `program` value          | Parsed account type                            |
| ------------------------ | ---------------------------------------------- |
| `address-lookup-table`   | Address lookup table accounts                  |
| `bpf-upgradeable-loader` | Upgradeable loader program and buffer accounts |
| `config`                 | Config accounts                                |
| `nonce`                  | Durable nonce accounts                         |
| `spl-token`              | SPL Token accounts                             |
| `spl-token-2022`         | SPL Token 2022 accounts                        |
| `stake`                  | Stake accounts                                 |
| `sysvar`                 | Sysvar accounts                                |
| `vote`                   | Vote accounts                                  |

The nested `parsed` payload remains program-specific.

For the shared account wrapper returned by this method, see
[Account Data](/docs/rpc/json-structures#account-data).

##### !! dataSlice

!type object

Request a slice of the account&apos;s data.

| Field    | Type    | Description                                           |
| -------- | ------- | ----------------------------------------------------- |
| `offset` | `usize` | Byte offset from which to start reading account data. |
| `length` | `usize` | Number of bytes to return.                            |

```json title="Example"
{ "offset": 0, "length": 32 }
```

<Callout type="info">
  Data slicing is only available for `base58`, `base64`, `base64+zstd`, and
  `binary` encodings.
</Callout>

##### !! minContextSlot

!type number

The minimum slot that the request can be evaluated at.

```json title="Example"
{ "minContextSlot": 341197000 }
```

### !!result

```jsonc !response
{
  "jsonrpc": "2.0",
  // !hover(1:11) result
  "result": {
    // !hover context
    "context": { "apiVersion": "3.1.8", "slot": 341197053 },
    // !hover(1:8) value
    "value": {
      "data": ["", "base64"],
      "executable": false,
      "lamports": 88849814690250,
      "owner": "11111111111111111111111111111111",
      "rentEpoch": 18446744073709551615,
      "space": 0
    }
  },
  "id": 1
}
```

!type object

RpcResponse object containing:

#### !! context

!type object

Slot and API version the node used to answer this request.

| Field        | Type     | Description                                                                     |
| ------------ | -------- | ------------------------------------------------------------------------------- |
| `slot`       | `u64`    | Slot at which the node evaluated this request.                                  |
| `apiVersion` | `string` | RPC API version reported by the node. This field may be omitted by older nodes. |

#### !! value

!type object | null

If the requested account does not exist, `value` is `null`. Otherwise, it is an
account object with the following fields:

This uses the shared [Account Data](/docs/rpc/json-structures#account-data)
structure.

| Field        | Type                                     | Description                                                                                                                                                                                                                                                                                              |
| ------------ | ---------------------------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| `data`       | `string \| [string, encoding] \| object` | Account data. If `encoding` is `binary`, this is a plain base-58 string. If `encoding` is `base58`, `base64`, or `base64+zstd`, this is `[data, encoding]`. If `encoding` is `jsonParsed`, this is `{program, parsed, space}`; if no parser is available, the RPC node falls back to `[data, "base64"]`. |
| `executable` | `bool`                                   | Whether the account contains a program and is therefore read-only.                                                                                                                                                                                                                                       |
| `lamports`   | `u64`                                    | Lamports assigned to this account.                                                                                                                                                                                                                                                                       |
| `owner`      | `string`                                 | Program owner pubkey, as a base-58 encoded string.                                                                                                                                                                                                                                                       |
| `rentEpoch`  | `u64`                                    | Epoch at which this account next owes rent.                                                                                                                                                                                                                                                              |
| `space`      | `u64 \| null`                            | Account data size in bytes. Current Solana RPC responses populate this field for encoded account responses.                                                                                                                                                                                              |

When `data` is returned as an object, it contains:

| Field     | Type     | Description                                                                                 |
| --------- | -------- | ------------------------------------------------------------------------------------------- |
| `program` | `string` | Name of the parser that produced the decoded account data.                                  |
| `parsed`  | `object` | Parser-specific JSON payload. Its structure depends on the owning program and account type. |
| `space`   | `u64`    | Account data size in bytes.                                                                 |

</APIMethod>
