Skip to content

GET /v1/stream/accounts

Stream real-time updates for accounts owned by a Solana program, filtered server-side by dataSize and optional memcmp byte matches. Matches the filter primitives you already use with getProgramAccounts, delivered over SSE so the work the client used to poll for now arrives push-style.

Request

http
GET /v1/stream/accounts?programId=whirLbMiicVdio4qvUfM5KAg6Ct8VwpYzGff3uctyCc&dataSize=653
x-api-key: YOUR_API_KEY

Browser-native EventSource cannot set custom headers. For browser clients, use ?apiKey=YOUR_API_KEY instead.

Query parameters

FieldTypeRequiredDefaultDescription
programIdstringYesBase58-encoded 32-byte program pubkey to watch
dataSizeintegerNo(any)Exact account data length to match
memcmpstringNo(none)Repeatable: offset:base58Bytes. Up to 4 entries, ≤ 64 bytes each
includeOptimisticbooleanNofalseAlso receive pre-confirmation predicted updates

Multiple memcmp filters can be combined with dataSize. All filters must match for an update to be delivered to your stream.

Events

EventDescription
readyStream accepted; sent immediately on connect
accountConfirmed account update at the slot indicated
account-optimisticPre-confirmation predicted update (only when includeOptimistic=true)
heartbeatConnection keepalive
errorTerminal error; the server closes the stream after this event

Example payload

text
event: account
data: {"address":"BqnpCdDLPV2pXuPLghYJgRopSnyqWzVxQpcKgwsCe9w","owner":"whirLbMiicVdio4qvUfM5KAg6Ct8VwpYzGff3uctyCc","slot":284502931,"lamports":null,"data":"AQAAAA...base64...","confidence":"confirmed"}

The data field is a base64-encoded copy of the raw on-chain account bytes — the same shape getProgramAccounts would have returned for that account at that slot. Decode it with your program's existing schema.

Confidence model

confidenceMeaning
optimisticPre-confirmation predicted state, usually the lowest-latency update
confirmedObserved at processed commitment from on-chain state

Optimistic events are followed by the matching confirmed event at the same slot. Consumers that need strict consistency should ignore optimistic (do not set includeOptimistic=true) or reconcile by (address, slot) and act only on confidence: "confirmed".

Slot ordering is preserved within a single subscription. Within a slot, a single account may produce one or two events (an optimistic emit and a confirmed emit). Treat the latest event for a given address as authoritative.

Initial snapshot

On connect, the server emits one account event per currently-known matching account before live updates begin. Subscribers then receive updates as they happen. There is no replay buffer beyond the connect-time snapshot — reconnect to receive a fresh snapshot.

Example

bash
curl -N -H "x-api-key: YOUR_API_KEY" \
  "https://api.venum.dev/v1/stream/accounts?programId=whirLbMiicVdio4qvUfM5KAg6Ct8VwpYzGff3uctyCc&dataSize=653"

# Browser/EventSource fallback
curl -N \
  "https://api.venum.dev/v1/stream/accounts?programId=whirLbMiicVdio4qvUfM5KAg6Ct8VwpYzGff3uctyCc&dataSize=653&apiKey=YOUR_API_KEY"

Filter by memcmp (token account vault authority):

bash
curl -N -H "x-api-key: YOUR_API_KEY" \
  "https://api.venum.dev/v1/stream/accounts?\
programId=TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA&\
dataSize=165&\
memcmp=32:5Q544fKrFoe6tsEbD7S8EmxGTJYAKtTVhAW5Q5pge4j1"

Errors

StatusBodyDescription
400programId requiredprogramId query param missing
400programId must be a base58 32-byte pubkeyBad programId encoding
400dataSize must be a non-negative integerBad dataSize value
400malformed memcmp filter: …Bad memcmp shape (expect offset:base58Bytes)
400memcmp bytes length out of range: …memcmp bytes empty or > 64 bytes
400too many memcmp filters (max 4)Too many memcmp entries
401Invalid or missing API keyAuth required
429SSE connection limit exceededExceeded your plan's concurrent SSE connection cap
503service-disabledEndpoint temporarily disabled by the operator

Latency

Best-effort sub-second on common programs. No latency guarantee. If you need hard sub-second guarantees across all programs, run your own validator with a Geyser plugin.

Rate Limit

Counts against the SSE streams connection limit in Plans & Rate Limits.