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

# getAccountInfo

> Returns all information associated with an account

Returns all information associated with the account of provided public key.

## Parameters

<ParamField query="account" type="string" required>
  The public key of the account to query (base-58 encoded string)
</ParamField>

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

  <Expandable title="config fields">
    <ParamField query="commitment" type="string" optional>
      The level of commitment to use for querying the network:

      * `processed`: Latest block (unconfirmed)
      * `confirmed`: Confirmed by supermajority
      * `finalized`: Finalized by supermajority
    </ParamField>

    <ParamField query="encoding" type="string" optional default="base64">
      Encoding format for the account data:

      * `base58`
      * `base64`
      * `base64+zstd`
      * `jsonParsed` (limited to certain account types)
    </ParamField>

    <ParamField query="dataSlice" type="object" optional>
      Request a slice of the account's data:

      * `offset`: number - Start position (in bytes)
      * `length`: number - Number of bytes to return
    </ParamField>

    <ParamField query="minContextSlot" type="number" optional>
      The minimum slot that the request can be evaluated at
    </ParamField>
  </Expandable>
</ParamField>

## Response

<ResponseField name="result" type="object | null">
  If the requested account doesn't exist, returns `null`. Otherwise, returns an object containing:

  <Expandable title="result fields">
    <ResponseField name="context" type="object">
      <ResponseField name="slot" type="number">
        The slot the request was processed at
      </ResponseField>
    </ResponseField>

    <ResponseField name="value" type="object">
      <ResponseField name="lamports" type="number">
        Number of lamports assigned to the account
      </ResponseField>

      <ResponseField name="owner" type="string">
        Base-58 encoded public key of the program that owns this account
      </ResponseField>

      <ResponseField name="executable" type="boolean">
        Whether this account contains a program
      </ResponseField>

      <ResponseField name="rentEpoch" type="number">
        The epoch at which this account will next owe rent
      </ResponseField>

      <ResponseField name="data" type="[string, string] | object">
        The account's data. Format depends on the encoding parameter:

        * `[string, encoding]` tuple if encoded as base58/base64
        * Parsed JSON object if encoding is "jsonParsed"
      </ResponseField>

      <ResponseField name="space" type="number">
        The space used by the account's data
      </ResponseField>
    </ResponseField>
  </Expandable>
</ResponseField>

## Code Examples

### Basic Request

```bash theme={null}
curl https://fra.rpc.orbitflare.com?api_key=YOUR-API-KEY -X POST -H "Content-Type: application/json" -d '{
  "jsonrpc": "2.0",
  "id": 1,
  "method": "getAccountInfo",
  "params": [
    "vines1vzrYbzLMRdu58ou5XTby4qAqVRLmqo36NKPTg",
    {
      "encoding": "base58"
    }
  ]
}'
```

### Response

```json theme={null}
{
  "jsonrpc": "2.0",
  "result": {
    "context": {
      "slot": 430
    },
    "value": {
      "data": ["", "base58"],
      "executable": false,
      "lamports": 5000000000,
      "owner": "11111111111111111111111111111111",
      "rentEpoch": 18446744073709551615,
      "space": 0
    }
  },
  "id": 1
}
```

### Request with Data Slice

```bash theme={null}
curl https://fra.rpc.orbitflare.com?api_key=YOUR-API-KEY -X POST -H "Content-Type: application/json" -d '{
  "jsonrpc": "2.0",
  "id": 1,
  "method": "getAccountInfo",
  "params": [
    "vines1vzrYbzLMRdu58ou5XTby4qAqVRLmqo36NKPTg",
    {
      "encoding": "base64",
      "dataSlice": {
        "offset": 0,
        "length": 64
      }
    }
  ]
}'
```

### Using web3.js

```typescript theme={null}
import { Connection, PublicKey } from '@solana/web3.js';

const connection = new Connection('https://fra.rpc.orbitflare.com?api_key=YOUR-API-KEY');
const publicKey = new PublicKey('vines1vzrYbzLMRdu58ou5XTby4qAqVRLmqo36NKPTg');

const accountInfo = await connection.getAccountInfo(
  publicKey,
  'confirmed'
);
```

## Notes

1. The `jsonParsed` encoding is only available for certain account types:
   * Stake account
   * Token account
   * Token mint
   * Token metadata

2. When using `dataSlice`, the data field will be limited to the requested slice only.

3. The account data may be encoded differently based on the program that owns the account.

## Common Errors

| Code   | Message                                  | Solution                                |
| ------ | ---------------------------------------- | --------------------------------------- |
| -32602 | Invalid param: WrongSize                 | Verify the public key is valid          |
| -32602 | Invalid param: not base58 encoded string | Ensure the public key is base58 encoded |
| -32007 | Account not found                        | The requested account does not exist    |
