Subscribe Balance
Subscribe to real-time balance updates for owned or delegated accounts. Can subscribe to all subaccounts or a specific subaccount.
Subscribe to balance updates for an account (requires authentication, supports delegation)#
Subscribe to real-time balance updates for owned or delegated accounts. Can subscribe to all subaccounts or a specific subaccount.
Request to subscribe to balance updates (requires authentication, supports delegation)
Parameters
sourcestringMust be 'balance'
accountstringEthereum address of the account (must match authenticated user or user must be a delegate)
subaccount_indices?arrayOptional array of subaccount indices. - If OMITTED or EMPTY: Subscribes to ALL subaccounts (owner only - delegation not allowed) - If PROVIDED: Subscribes to specified subaccounts (delegation allowed) For delegated access, delegation is checked for ALL specified subaccounts. Subscription fails if user lacks delegation for any subaccount in the array.
{
"jsonrpc": "2.0",
"method": "subscribe",
"params": {
"source": "balance",
"account": "0xe1c03ec3bcf509b3e8e63abcd03edc661ffe6a78"
},
"id": 7
}Generic success response for subscription requests
Parameters
message?stringSuccess message
{
"jsonrpc": "2.0",
"result": {
"message": "Subscribed to trades"
},
"usIn": 1234567890123,
"usOut": 1234567890456,
"usDiff": 333,
"id": 2
}Published each time an account balance is created or updated for the subscribed account. Supports delegation - users can receive updates for accounts they are delegated to access. Wrapped with type field to identify the message type.
Parameters
accountstringEthereum address of the account
subaccountIndexstringSubaccount index as string
balancestringCurrent account balance as Fixed6 decimal string
updatedAtintegerTimestamp when balance was last updated in milliseconds
{
"type": "Balance Update",
"data": {
"account": "0xc2cbbb5bea8fdefb1f441feaf017a0df72e89c9f",
"subaccountIndex": "0",
"balance": "1000.500000",
"updatedAt": 1752846925000
}
}Error response for failed requests
Parameters
jsonrpcstringJSON-RPC version
errorobjectusInintegerRequest received timestamp in milliseconds
usOutintegerResponse sent timestamp in milliseconds
usDiffintegerProcessing time in milliseconds
id?string | integer | nullRequest identifier (if provided in request, otherwise null)
{
"jsonrpc": "2.0",
"error": {
"code": -32602,
"message": "Invalid subscription params"
},
"usIn": 1234567890123,
"usOut": 1234567890456,
"usDiff": 333,
"id": 2
}