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)
subaccountIndicesarrayArray of subaccount indices. - Empty array []: Subscribes to ALL subaccounts (owner only - delegation not allowed) - Non-empty array: Subscribes to the 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",
"subaccountIndices": []
},
"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
subaccountIndexintegerSubaccount index
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
}