> ## 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 token balance

> Subscribe to specific token balance changes for a wallet



## AsyncAPI

````yaml datastream/wallet.json walletTokenBalance
id: walletTokenBalance
title: Wallet token balance
description: Subscribe to specific token balance changes for a wallet
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: subscribeToTokenBalance
    title: Subscribe to token balance
    description: Subscribe to token balance
    type: receive
    messages:
      - &ref_5
        id: joinTokenBalance
        payload:
          - name: joinTokenBalance
            description: Subscribe to specific token balance
            type: object
            properties:
              - name: type
                type: string
                description: join
                required: true
              - name: room
                type: string
                description: Wallet token balance room
                required: true
        headers: []
        jsonPayloadSchema:
          type: object
          required:
            - type
            - room
          properties:
            type:
              type: string
              const: join
              default: join
              x-parser-schema-id: <anonymous-schema-66>
            room:
              type: string
              pattern: ^wallet:[A-Za-z0-9]{32,44}:[A-Za-z0-9]{32,44}:balance$
              description: Wallet token balance room
              default: >-
                wallet:FV1r15rbNKkJanXLheoJA7fXEq6NDuMJ3bukXuhJWyV1:Es9vMFrzaCERmJfrF4H2FYD4KCoNkY11McCe8BenwNYB:balance
              x-parser-schema-id: <anonymous-schema-67>
          examples:
            - type: join
              room: >-
                wallet:FV1r15rbNKkJanXLheoJA7fXEq6NDuMJ3bukXuhJWyV1:Es9vMFrzaCERmJfrF4H2FYD4KCoNkY11McCe8BenwNYB:balance
          x-parser-schema-id: <anonymous-schema-65>
        title: Join token balance
        description: Subscribe to specific token balance
        example: |-
          {
            "type": "join",
            "room": "wallet:FV1r15rbNKkJanXLheoJA7fXEq6NDuMJ3bukXuhJWyV1:Es9vMFrzaCERmJfrF4H2FYD4KCoNkY11McCe8BenwNYB:balance"
          }
        bindings: []
        extensions:
          - id: x-parser-unique-object-id
            value: joinTokenBalance
          - id: x-parser-message-name
            value: joinTokenBalance
    bindings: []
    extensions: &ref_0
      - id: x-parser-unique-object-id
        value: walletTokenBalance
  - &ref_3
    id: receiveTokenBalanceConfirmation
    title: Receive token balance confirmation
    description: Receive confirmation
    type: send
    messages:
      - &ref_7
        id: tokenBalanceJoined
        payload:
          - name: tokenBalanceJoined
            description: Token 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-69>
            room:
              type: string
              x-parser-schema-id: <anonymous-schema-70>
          examples:
            - type: joined
              room: >-
                wallet:FV1r15rbNKkJanXLheoJA7fXEq6NDuMJ3bukXuhJWyV1:Es9vMFrzaCERmJfrF4H2FYD4KCoNkY11McCe8BenwNYB:balance
          x-parser-schema-id: <anonymous-schema-68>
        title: Token balance joined
        description: Token balance subscription confirmed
        example: |-
          {
            "type": "joined",
            "room": "wallet:FV1r15rbNKkJanXLheoJA7fXEq6NDuMJ3bukXuhJWyV1:Es9vMFrzaCERmJfrF4H2FYD4KCoNkY11McCe8BenwNYB:balance"
          }
        bindings: []
        extensions:
          - id: x-parser-unique-object-id
            value: tokenBalanceJoined
          - id: x-parser-message-name
            value: tokenBalanceJoined
    bindings: []
    extensions: *ref_0
  - &ref_4
    id: receiveTokenBalanceData
    title: Receive token balance data
    description: Receive balance updates
    type: send
    messages:
      - &ref_8
        id: tokenBalanceMessage
        payload:
          - name: tokenBalanceMessage
            description: Token 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-72>
            room:
              type: string
              x-parser-schema-id: <anonymous-schema-73>
            data:
              type: object
              properties:
                wallet:
                  type: string
                  x-parser-schema-id: <anonymous-schema-59>
                token:
                  type: string
                  x-parser-schema-id: <anonymous-schema-60>
                amount:
                  type: integer
                  x-parser-schema-id: <anonymous-schema-61>
              x-parser-schema-id: BalanceUpdate
          examples:
            - type: message
              data:
                wallet: FV1r15rbNKkJanXLheoJA7fXEq6NDuMJ3bukXuhJWyV1
                token: Es9vMFrzaCERmJfrF4H2FYD4KCoNkY11McCe8BenwNYB
                amount: 76989.158861
              room: >-
                wallet:FV1r15rbNKkJanXLheoJA7fXEq6NDuMJ3bukXuhJWyV1:Es9vMFrzaCERmJfrF4H2FYD4KCoNkY11McCe8BenwNYB:balance
          x-parser-schema-id: <anonymous-schema-71>
        title: Token balance message
        description: Token balance change notification
        example: |-
          {
            "type": "message",
            "data": {
              "wallet": "FV1r15rbNKkJanXLheoJA7fXEq6NDuMJ3bukXuhJWyV1",
              "token": "Es9vMFrzaCERmJfrF4H2FYD4KCoNkY11McCe8BenwNYB",
              "amount": 76989.158861
            },
            "room": "wallet:FV1r15rbNKkJanXLheoJA7fXEq6NDuMJ3bukXuhJWyV1:Es9vMFrzaCERmJfrF4H2FYD4KCoNkY11McCe8BenwNYB:balance"
          }
        bindings: []
        extensions:
          - id: x-parser-unique-object-id
            value: tokenBalanceMessage
          - id: x-parser-message-name
            value: tokenBalanceMessage
    bindings: []
    extensions: *ref_0
  - &ref_2
    id: unsubscribeFromTokenBalance
    title: Unsubscribe from token balance
    description: Unsubscribe
    type: receive
    messages:
      - &ref_6
        id: leaveTokenBalance
        payload:
          - name: leaveTokenBalance
            description: Unsubscribe from token balance
            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-75>
            room:
              type: string
              default: >-
                wallet:FV1r15rbNKkJanXLheoJA7fXEq6NDuMJ3bukXuhJWyV1:Es9vMFrzaCERmJfrF4H2FYD4KCoNkY11McCe8BenwNYB:balance
              x-parser-schema-id: <anonymous-schema-76>
          examples:
            - type: leave
              room: >-
                wallet:FV1r15rbNKkJanXLheoJA7fXEq6NDuMJ3bukXuhJWyV1:Es9vMFrzaCERmJfrF4H2FYD4KCoNkY11McCe8BenwNYB:balance
          x-parser-schema-id: <anonymous-schema-74>
        title: Leave token balance
        description: Unsubscribe from token balance
        example: |-
          {
            "type": "leave",
            "room": "wallet:FV1r15rbNKkJanXLheoJA7fXEq6NDuMJ3bukXuhJWyV1:Es9vMFrzaCERmJfrF4H2FYD4KCoNkY11McCe8BenwNYB:balance"
          }
        bindings: []
        extensions:
          - id: x-parser-unique-object-id
            value: leaveTokenBalance
          - id: x-parser-message-name
            value: leaveTokenBalance
    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: walletTokenBalance
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: []

````