> ## 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.

# Token transactions

> Subscribe to swap transactions for a token



## AsyncAPI

````yaml datastream/transactions.json tokenTransactions
id: tokenTransactions
title: Token transactions
description: Subscribe to swap transactions for a token
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: subscribeToTokenTx
    title: Subscribe to token tx
    description: Subscribe to token transactions
    type: receive
    messages:
      - &ref_5
        id: joinTokenTx
        payload:
          - name: joinTokenTx
            description: Subscribe to token transactions
            type: object
            properties:
              - name: type
                type: string
                description: join
                required: true
              - name: room
                type: string
                description: Transaction room identifier (transaction:{tokenAddress})
                required: true
        headers: []
        jsonPayloadSchema:
          type: object
          required:
            - type
            - room
          properties:
            type:
              type: string
              const: join
              default: join
              x-parser-schema-id: <anonymous-schema-2>
            room:
              type: string
              pattern: ^transaction:[A-Za-z0-9]{32,44}$
              description: Transaction room identifier (transaction:{tokenAddress})
              default: transaction:6p6xgHyF7AeE6TZkSmFsko444wqoP15icUSqi2jfGiPN
              x-parser-schema-id: <anonymous-schema-3>
          examples:
            - type: join
              room: transaction:6p6xgHyF7AeE6TZkSmFsko444wqoP15icUSqi2jfGiPN
          x-parser-schema-id: <anonymous-schema-1>
        title: Join token tx
        description: Subscribe to token transactions
        example: |-
          {
            "type": "join",
            "room": "transaction:6p6xgHyF7AeE6TZkSmFsko444wqoP15icUSqi2jfGiPN"
          }
        bindings: []
        extensions:
          - id: x-parser-unique-object-id
            value: joinTokenTx
          - id: x-parser-message-name
            value: joinTokenTx
    bindings: []
    extensions: &ref_0
      - id: x-parser-unique-object-id
        value: tokenTransactions
  - &ref_3
    id: receiveTokenTxConfirmation
    title: Receive token tx confirmation
    description: Receive transaction confirmation
    type: send
    messages:
      - &ref_7
        id: tokenTxJoined
        payload:
          - name: tokenTxJoined
            description: Transaction 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-5>
            room:
              type: string
              pattern: ^transaction:[A-Za-z0-9]{32,44}$
              x-parser-schema-id: <anonymous-schema-6>
          examples:
            - type: joined
              room: transaction:6p6xgHyF7AeE6TZkSmFsko444wqoP15icUSqi2jfGiPN
          x-parser-schema-id: <anonymous-schema-4>
        title: Token tx joined
        description: Transaction subscription confirmed
        example: |-
          {
            "type": "joined",
            "room": "transaction:6p6xgHyF7AeE6TZkSmFsko444wqoP15icUSqi2jfGiPN"
          }
        bindings: []
        extensions:
          - id: x-parser-unique-object-id
            value: tokenTxJoined
          - id: x-parser-message-name
            value: tokenTxJoined
    bindings: []
    extensions: *ref_0
  - &ref_4
    id: receiveTokenTxData
    title: Receive token tx data
    description: Receive transactions
    type: send
    messages:
      - &ref_8
        id: tokenTxMessage
        payload:
          - name: tokenTxMessage
            description: Transaction notification
            type: object
            properties:
              - name: type
                type: string
                description: message
                required: false
              - name: room
                type: string
                required: false
              - name: data
                type: array
                required: false
        headers: []
        jsonPayloadSchema:
          type: object
          properties:
            type:
              type: string
              const: message
              x-parser-schema-id: <anonymous-schema-8>
            room:
              type: string
              pattern: ^transaction:[A-Za-z0-9]{32,44}$
              x-parser-schema-id: <anonymous-schema-9>
            data:
              type: array
              items:
                type: object
                properties:
                  tx:
                    type: string
                    x-parser-schema-id: <anonymous-schema-11>
                  amount:
                    type: number
                    x-parser-schema-id: <anonymous-schema-12>
                  priceUsd:
                    type: number
                    x-parser-schema-id: <anonymous-schema-13>
                  volume:
                    type: number
                    x-parser-schema-id: <anonymous-schema-14>
                  volumeSol:
                    type: number
                    x-parser-schema-id: <anonymous-schema-15>
                  type:
                    type: string
                    enum:
                      - buy
                      - sell
                    x-parser-schema-id: <anonymous-schema-16>
                  wallet:
                    type: string
                    x-parser-schema-id: <anonymous-schema-17>
                  time:
                    type: integer
                    x-parser-schema-id: <anonymous-schema-18>
                  program:
                    type: string
                    x-parser-schema-id: <anonymous-schema-19>
                  pools:
                    type: array
                    items:
                      type: string
                      x-parser-schema-id: <anonymous-schema-21>
                    x-parser-schema-id: <anonymous-schema-20>
                x-parser-schema-id: Transaction
              x-parser-schema-id: <anonymous-schema-10>
          examples:
            - type: message
              data:
                - tx: >-
                    5V4apVkgHf49J5acYPiuh5rB89EGsF8ocSysgnD9vFfZsTtDamhN3MFDKJSq7Dn7Z6Y5XhjghuVYuvvYWnSFpnvW
                  amount: 90
                  priceUsd: 6.002467911111111
                  solVolume: 2.9566243262290475
                  volume: 540.222112
                  type: sell
                  wallet: F7R61te4Ac8xZ4pfkJUdF6iaaHy9tnM8nVRUPv8H8EMi
                  time: 1760201288835
                  program: okx
                  token:
                    from:
                      name: OFFICIAL TRUMP
                      symbol: TRUMP
                      image: >-
                        https://image.solanatracker.io/proxy?url=https%3A%2F%2Farweave.net%2FVQrPjACwnQRmxdKBTqNwPiyo65x7LAT773t8Kd7YBzw
                      decimals: 6
                      amount: 90
                      address: 6p6xgHyF7AeE6TZkSmFsko444wqoP15icUSqi2jfGiPN
                      price:
                        usd: 6.002467911111111
                    to:
                      name: USD Coin
                      symbol: USDC
                      image: >-
                        https://image.solanatracker.io/proxy?url=https%3A%2F%2Fraw.githubusercontent.com%2Fsolana-labs%2Ftoken-list%2Fmain%2Fassets%2Fmainnet%2FEPjFWdd5AufqSSqeM2qN1xzybapC8G4wEGGkZwyTDt1v%2Flogo.png
                      decimals: 6
                      amount: 540.222112
                      address: EPjFWdd5AufqSSqeM2qN1xzybapC8G4wEGGkZwyTDt1v
                      price:
                        usd: 1
              room: transaction:6p6xgHyF7AeE6TZkSmFsko444wqoP15icUSqi2jfGiPN
          x-parser-schema-id: <anonymous-schema-7>
        title: Token tx message
        description: Transaction notification
        example: |-
          {
            "type": "message",
            "data": [
              {
                "tx": "5V4apVkgHf49J5acYPiuh5rB89EGsF8ocSysgnD9vFfZsTtDamhN3MFDKJSq7Dn7Z6Y5XhjghuVYuvvYWnSFpnvW",
                "amount": 90,
                "priceUsd": 6.002467911111111,
                "solVolume": 2.9566243262290475,
                "volume": 540.222112,
                "type": "sell",
                "wallet": "F7R61te4Ac8xZ4pfkJUdF6iaaHy9tnM8nVRUPv8H8EMi",
                "time": 1760201288835,
                "program": "okx",
                "token": {
                  "from": {
                    "name": "OFFICIAL TRUMP",
                    "symbol": "TRUMP",
                    "image": "https://image.solanatracker.io/proxy?url=https%3A%2F%2Farweave.net%2FVQrPjACwnQRmxdKBTqNwPiyo65x7LAT773t8Kd7YBzw",
                    "decimals": 6,
                    "amount": 90,
                    "address": "6p6xgHyF7AeE6TZkSmFsko444wqoP15icUSqi2jfGiPN",
                    "price": {
                      "usd": 6.002467911111111
                    }
                  },
                  "to": {
                    "name": "USD Coin",
                    "symbol": "USDC",
                    "image": "https://image.solanatracker.io/proxy?url=https%3A%2F%2Fraw.githubusercontent.com%2Fsolana-labs%2Ftoken-list%2Fmain%2Fassets%2Fmainnet%2FEPjFWdd5AufqSSqeM2qN1xzybapC8G4wEGGkZwyTDt1v%2Flogo.png",
                    "decimals": 6,
                    "amount": 540.222112,
                    "address": "EPjFWdd5AufqSSqeM2qN1xzybapC8G4wEGGkZwyTDt1v",
                    "price": {
                      "usd": 1
                    }
                  }
                }
              }
            ],
            "room": "transaction:6p6xgHyF7AeE6TZkSmFsko444wqoP15icUSqi2jfGiPN"
          }
        bindings: []
        extensions:
          - id: x-parser-unique-object-id
            value: tokenTxMessage
          - id: x-parser-message-name
            value: tokenTxMessage
    bindings: []
    extensions: *ref_0
  - &ref_2
    id: unsubscribeFromTokenTx
    title: Unsubscribe from token tx
    description: Unsubscribe from transactions
    type: receive
    messages:
      - &ref_6
        id: leaveTokenTx
        payload:
          - name: leaveTokenTx
            description: Unsubscribe from token transactions
            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-23>
            room:
              type: string
              pattern: ^transaction:[A-Za-z0-9]{32,44}$
              default: transaction:6p6xgHyF7AeE6TZkSmFsko444wqoP15icUSqi2jfGiPN
              x-parser-schema-id: <anonymous-schema-24>
          examples:
            - type: leave
              room: transaction:6p6xgHyF7AeE6TZkSmFsko444wqoP15icUSqi2jfGiPN
          x-parser-schema-id: <anonymous-schema-22>
        title: Leave token tx
        description: Unsubscribe from token transactions
        example: |-
          {
            "type": "leave",
            "room": "transaction:6p6xgHyF7AeE6TZkSmFsko444wqoP15icUSqi2jfGiPN"
          }
        bindings: []
        extensions:
          - id: x-parser-unique-object-id
            value: leaveTokenTx
          - id: x-parser-message-name
            value: leaveTokenTx
    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: tokenTransactions
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: []

````