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

# Wallet balance

> Subscribe to wallet balance changes



## AsyncAPI

````yaml datastream/asyncapi.json walletBalance
id: walletBalance
title: Wallet balance
description: Subscribe to wallet balance changes
servers:
  - id: production
    protocol: wss
    host: datastream.solanatracker.io
    bindings: []
    variables:
      - id: apiKey
        description: Your unique API key from Data API subscription
        allowedValues: []
        examples: []
address: /
parameters: []
bindings: []
operations:
  - &ref_1
    id: subscribeToBalance
    title: Subscribe to balance
    description: Subscribe to wallet balance
    type: receive
    messages:
      - &ref_5
        id: joinBalance
        payload:
          - name: joinBalance
            description: Subscribe to wallet balance changes
            type: object
            properties:
              - name: type
                type: string
                description: join
                required: true
              - name: room
                type: string
                description: Wallet balance room (wallet:{walletAddress}:balance)
                required: true
        headers: []
        jsonPayloadSchema:
          type: object
          required:
            - type
            - room
          properties:
            type:
              type: string
              const: join
              default: join
              x-parser-schema-id: <anonymous-schema-326>
            room:
              type: string
              pattern: ^wallet:[A-Za-z0-9]{32,44}:balance$
              description: Wallet balance room (wallet:{walletAddress}:balance)
              default: wallet:FV1r15rbNKkJanXLheoJA7fXEq6NDuMJ3bukXuhJWyV1:balance
              x-parser-schema-id: <anonymous-schema-327>
          examples:
            - type: join
              room: wallet:FV1r15rbNKkJanXLheoJA7fXEq6NDuMJ3bukXuhJWyV1:balance
          x-parser-schema-id: <anonymous-schema-325>
        title: Join balance
        description: Subscribe to wallet balance changes
        example: |-
          {
            "type": "join",
            "room": "wallet:FV1r15rbNKkJanXLheoJA7fXEq6NDuMJ3bukXuhJWyV1:balance"
          }
        bindings: []
        extensions:
          - id: x-parser-unique-object-id
            value: joinBalance
          - id: x-parser-message-name
            value: joinBalance
    bindings: []
    extensions: &ref_0
      - id: x-parser-unique-object-id
        value: walletBalance
  - &ref_3
    id: receiveBalanceConfirmation
    title: Receive balance confirmation
    description: Receive balance confirmation
    type: send
    messages:
      - &ref_7
        id: balanceJoined
        payload:
          - name: balanceJoined
            description: Balance subscription confirmed
            type: object
            properties:
              - name: type
                type: string
                description: joined
                required: false
              - name: room
                type: string
                required: false
        headers: []
        jsonPayloadSchema:
          type: object
          properties:
            type:
              type: string
              const: joined
              x-parser-schema-id: <anonymous-schema-329>
            room:
              type: string
              x-parser-schema-id: <anonymous-schema-330>
          examples:
            - type: joined
              room: wallet:FV1r15rbNKkJanXLheoJA7fXEq6NDuMJ3bukXuhJWyV1:balance
          x-parser-schema-id: <anonymous-schema-328>
        title: Balance joined
        description: Balance subscription confirmed
        example: |-
          {
            "type": "joined",
            "room": "wallet:FV1r15rbNKkJanXLheoJA7fXEq6NDuMJ3bukXuhJWyV1:balance"
          }
        bindings: []
        extensions:
          - id: x-parser-unique-object-id
            value: balanceJoined
          - id: x-parser-message-name
            value: balanceJoined
    bindings: []
    extensions: *ref_0
  - &ref_4
    id: receiveBalanceData
    title: Receive balance data
    description: Receive balance updates
    type: send
    messages:
      - &ref_8
        id: balanceMessage
        payload:
          - name: balanceMessage
            description: Balance change notification
            type: object
            properties:
              - name: type
                type: string
                description: message
                required: false
              - name: room
                type: string
                required: false
              - name: data
                type: object
                required: false
                properties:
                  - name: wallet
                    type: string
                    required: false
                  - name: token
                    type: string
                    required: false
                  - name: amount
                    type: integer
                    required: false
        headers: []
        jsonPayloadSchema:
          type: object
          properties:
            type:
              type: string
              const: message
              x-parser-schema-id: <anonymous-schema-332>
            room:
              type: string
              x-parser-schema-id: <anonymous-schema-333>
            data:
              type: object
              properties:
                wallet:
                  type: string
                  x-parser-schema-id: <anonymous-schema-334>
                token:
                  type: string
                  x-parser-schema-id: <anonymous-schema-335>
                amount:
                  type: integer
                  x-parser-schema-id: <anonymous-schema-336>
              x-parser-schema-id: BalanceUpdate
          examples:
            - type: message
              data:
                wallet: FV1r15rbNKkJanXLheoJA7fXEq6NDuMJ3bukXuhJWyV1
                token: Es9vMFrzaCERmJfrF4H2FYD4KCoNkY11McCe8BenwNYB
                amount: 78816.844996
              room: wallet:FV1r15rbNKkJanXLheoJA7fXEq6NDuMJ3bukXuhJWyV1:balance
          x-parser-schema-id: <anonymous-schema-331>
        title: Balance message
        description: Balance change notification
        example: |-
          {
            "type": "message",
            "data": {
              "wallet": "FV1r15rbNKkJanXLheoJA7fXEq6NDuMJ3bukXuhJWyV1",
              "token": "Es9vMFrzaCERmJfrF4H2FYD4KCoNkY11McCe8BenwNYB",
              "amount": 78816.844996
            },
            "room": "wallet:FV1r15rbNKkJanXLheoJA7fXEq6NDuMJ3bukXuhJWyV1:balance"
          }
        bindings: []
        extensions:
          - id: x-parser-unique-object-id
            value: balanceMessage
          - id: x-parser-message-name
            value: balanceMessage
    bindings: []
    extensions: *ref_0
  - &ref_2
    id: unsubscribeFromBalance
    title: Unsubscribe from balance
    description: Unsubscribe from balance
    type: receive
    messages:
      - &ref_6
        id: leaveBalance
        payload:
          - name: leaveBalance
            description: Unsubscribe from balance updates
            type: object
            properties:
              - name: type
                type: string
                description: leave
                required: true
              - name: room
                type: string
                required: true
        headers: []
        jsonPayloadSchema:
          type: object
          required:
            - type
            - room
          properties:
            type:
              type: string
              const: leave
              default: leave
              x-parser-schema-id: <anonymous-schema-338>
            room:
              type: string
              default: wallet:FV1r15rbNKkJanXLheoJA7fXEq6NDuMJ3bukXuhJWyV1:balance
              x-parser-schema-id: <anonymous-schema-339>
          examples:
            - type: leave
              room: wallet:FV1r15rbNKkJanXLheoJA7fXEq6NDuMJ3bukXuhJWyV1:balance
          x-parser-schema-id: <anonymous-schema-337>
        title: Leave balance
        description: Unsubscribe from balance updates
        example: |-
          {
            "type": "leave",
            "room": "wallet:FV1r15rbNKkJanXLheoJA7fXEq6NDuMJ3bukXuhJWyV1:balance"
          }
        bindings: []
        extensions:
          - id: x-parser-unique-object-id
            value: leaveBalance
          - id: x-parser-message-name
            value: leaveBalance
    bindings: []
    extensions: *ref_0
sendOperations:
  - *ref_1
  - *ref_2
receiveOperations:
  - *ref_3
  - *ref_4
sendMessages:
  - *ref_5
  - *ref_6
receiveMessages:
  - *ref_7
  - *ref_8
extensions:
  - id: x-parser-unique-object-id
    value: walletBalance
securitySchemes:
  - id: apiKeyAuth
    name: apiKey
    type: httpApiKey
    description: >-
      API key for authentication. Include your Datastream key in the connection
      URL: wss://datastream.solanatracker.io/{DATASTREAM_KEY}
    in: header
    extensions: []

````