account Subscribe
Emits a notification each time a single account's lamports or data change.
wss://ws-newyork.constant-k.com:1337/ws?api-key=YOUR_API_KEYaccountSubscribe opens a live feed for one account as an alternative to polling getAccountInfo. Each time the account's data or lamport balance changes at or above the requested commitment, constant-k's node emits one accountNotification carrying the account's new state and the slot the change landed in.
encoding controls how the data field is serialized in each notification, dataSlice shrinks the payload to a byte window for part of a large account, and commitment trades notification latency against the chance of the change being rolled back. The stream stays open until accountUnsubscribe is called or the socket closes.
Parameters
params is a JSON array, with values in this order: pubkey, config.
Base58-encoded public key of the account to watch.
SysvarC1ock11111111111111111111111111111111Optional subscription settings.
Show propertiesProperties
Format for the returned account data. base58 is the legacy default (also accepted under its old name binary) and is slow for large accounts; jsonParsed asks the node to run a program-specific parser and silently falls back to base64 when no parser exists for the account's owner.
base58base64base64+zstdjsonParsedHow settled the account/transaction state must be before the node acts on it. processed is fastest and can roll back; finalized is slowest and never rolls back.
processedconfirmedfinalizedReturns only a byte range of data instead of the whole payload. Not compatible with jsonParsed encoding.
Show propertiesProperties
Byte offset to start the slice at.
0Number of bytes to return.
0Minimum slot the node must have reached before it will process the subscription. Accepted for parity with the HTTP RpcAccountInfoConfig struct; Agave's pubsub handler does not currently gate notifications on it.
0Result
The subscription id, returned once in the initial RPC response. Passed to accountUnsubscribe, it cancels the stream.
Notifications
Updates arrive as accountNotification messages on the same socket. result.context.slot is the slot the change was observed in; result.value is the account's new state, shaped like the value of getAccountInfo (lamports, data, owner, executable, rentEpoch, space), with data encoded per the requested encoding.
Notification payload.
Show propertiesProperties
Response context, including the slot the data was read at.
Show propertiesProperties
Slot number this applies to.
The requested data; see the fields below.
Show propertiesProperties
Account balance, in lamports.
Account data, shaped by the requested encoding (an object for jsonParsed, a [string, encoding] tuple otherwise).
Base58 address of the program (or, for a token account, the wallet) that owns this account.
Whether this account is a program.
Legacy rent-exemption epoch; not meaningful for accounts created after rent-exempt minimums became mandatory.
Size of the account's data, in bytes.
Unsubscribe
accountUnsubscribe, called with the subscription id, stops the notifications and returns true once the subscription is removed.
{
"jsonrpc": "2.0",
"id": 2,
"method": "accountUnsubscribe",
"params": [26917684]
}Notes
- WebSocket access is included on the Operator plan and above; it is not available on Free.
- Concurrent connections are capped per API key: 10 on Operator, 50 on Blade Runner, 100 on Nexus.
- Subscribe and unsubscribe calls draw from the same global per-plan request-rate limit as HTTP calls: 50 req/s on Operator, 200 req/s on Blade Runner, 500 req/s on Nexus.
- Only subscription methods (the
*Subscribe/*Unsubscribefamily) are accepted on the WebSocket endpoint; standard request/response RPC methods must go over HTTPS instead. - A
getHealthrequest sent over the open socket on a regular interval serves as a keepalive; connections that go quiet can be dropped by intermediate load balancers. - Each region has its own WebSocket hostname, for example
wss://ws-newyork.constant-k.com:1337/ws?api-key=YOUR_API_KEY; every region is listed on the Endpoints page. - Captured live from
wss://api.mainnet-beta.solana.comagainst the Clock sysvar, which updates every slot, useful for confirming a subscription is alive.