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

# accountSubscribe

> Subscribe to an account to receive notifications when the lamports or data for a given account public key changes.

## Endpoints

Websockets are available on mainnet and devnet with the following URLs:

* **Mainnet** `wss://mainnet.helius-rpc.com/?api-key=<api-key>`
* **Devnet** `wss://devnet.helius-rpc.com/?api-key=<api-key>`

> [!NOTE]
>
> Websockets have a 10-minute inactivity timer; implementing health checks and sending pings every minute is heavily recommended to keep the websocket connection alive.

## Authorizations

**api-key** `string` *required*

Your Helius API key. You can get one for free in the [dashboard](https://dashboard.helius.dev/api-keys).

## Body

**params** `array` *required*

**properties**

**pubkey** `string` *required*

Account Pubkey, as base-58 encoded string.

**encoding** `string`

Encoding format for account data. Can be `base58`, `base64`, `base64+zstd`, or `jsonParsed`.

* `base58` is slow
* `jsonParsed` encoding attempts to use program-specific state parsers to return more human-readable and explicit account state data
* If `jsonParsed` is requested but a parser cannot be found, the field falls back to binary encoding, detectable when the data field is type string.

**commitment** `string`

The commitment level for the subscription. Can be `finalized`, `confirmed`, or `processed`.

**notifyOn** `string` *deprecated*

**Deprecated — no-op as of Agave 4.2.** Setting `notifyOn` has no effect. The field will be removed at a later date.

## Response

**result** `integer`

Subscription id (needed to unsubscribe)

```json Request theme={"system"}
{
  "jsonrpc": "2.0",
  "id": 1,
  "method": "accountSubscribe",
  "params": [
    "CM78CPUeXjn8o3yroDHxUtKsZZgoy4GPkPPXfouKNH12",
    {
      "encoding": "jsonParsed",
      "commitment": "finalized"
    }
  ]
}
```

```json Response theme={"system"}
{
  "jsonrpc": "2.0",
  "result": 23784,
  "id": 1
}
```

```json Message (base58) theme={"system"}
{
  "jsonrpc": "2.0",
  "method": "accountNotification",
  "params": {
    "result": {
      "context": {
        "slot": 5199307
      },
      "value": {
        "data": [
          "11116bv5nS2h3y12kD1yUKeMZvGcKLSjQgX6BeV7u1FrjeJcKfsHPXHRDEHrBesJhZyqnnq9qJeUuF7WHxiuLuL5twc38w2TXNLxnDbjmuR",
          "base58"
        ],
        "executable": false,
        "lamports": 33594,
        "owner": "11111111111111111111111111111111",
        "rentEpoch": 635,
        "space": 80
      }
    },
    "subscription": 23784
  }
}
```

```json Message (jsonParsed) theme={"system"}
{
  "jsonrpc": "2.0",
  "method": "accountNotification",
  "params": {
    "result": {
      "context": {
        "slot": 5199307
      },
      "value": {
        "data": {
          "program": "nonce",
          "parsed": {
            "type": "initialized",
            "info": {
              "authority": "Bbqg1M4YVVfbhEzwA9SpC9FhsaG83YMTYoR4a8oTDLX",
              "blockhash": "LUaQTmM7WbMRiATdMMHaRGakPtCkc2GHtH57STKXs6k",
              "feeCalculator": {
                "lamportsPerSignature": 5000
              }
            }
          }
        },
        "executable": false,
        "lamports": 33594,
        "owner": "11111111111111111111111111111111",
        "rentEpoch": 635,
        "space": 80
      }
    },
    "subscription": 23784
  }
}
```


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.