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

# Subscribe Prices

> Subscribe to real-time price updates.

<Callout icon="activity" color="#FFC107" iconType="regular">To keep the connection alive, you need to send a ping message every less than 60 seconds.</Callout>

You can subscribe and unsubscribe to any amount of topics you want on a single connection.

To update a topic subscription, you can resubscribe to the same topic with new parameters.

Incoming messages will include a `topic` field that you can use to filter the type of message.

<Tip>When **subscribing**, you can leave any of the array fields of the `params` object empty to subscribe to all entries for that field.</Tip>
<Tip>When **unsubscribing**, you can leave the `topics` array empty to unsubscribe from all topics.</Tip>


## AsyncAPI

````yaml dist/asyncapi.yml solanaDexPricesSubscription
id: solanaDexPricesSubscription
title: Prices Subscription
description: Subscribe to real-time price updates.
servers:
  - id: production
    protocol: wss
    host: refract.prismapi.io
    bindings: []
    variables: []
address: /v1/ws
parameters: []
bindings: []
operations:
  - &ref_2
    id: receiveSolanaDexPricesSubscription
    title: Receive solana dex prices subscription
    type: send
    messages:
      - &ref_5
        id: pricesSubscriptionMessage
        contentType: application/json
        payload:
          - name: Price Message
            description: Message containing the price data.
            type: object
            properties:
              - name: topic
                type: string
                enumValues:
                  - solana.dex.prices
                  - solana.dex.swaps
                  - solana.dex.trades
                  - solana.dex.pools
                  - solana.dex.profiles.wallet
                  - solana.dex.profiles.token
                  - solana.dex.profiles.position
                  - solana.assets.transfers
                  - solana.assets.balance-changes
                required: false
              - name: data
                type: object
                required: false
                properties:
                  - name: token_address
                    type: string
                    required: false
                  - name: pool_address
                    type: string
                    required: false
                  - name: usd_price
                    type: number
                    required: false
                  - name: block_slot
                    type: integer
                    required: false
                  - name: block_time
                    type: string
                    required: false
        headers: []
        jsonPayloadSchema:
          type: object
          properties:
            topic:
              x-fern-type-name: SubscriptionTopicEnum
              type: string
              enum:
                - solana.dex.prices
                - solana.dex.swaps
                - solana.dex.trades
                - solana.dex.pools
                - solana.dex.profiles.wallet
                - solana.dex.profiles.token
                - solana.dex.profiles.position
                - solana.assets.transfers
                - solana.assets.balance-changes
              x-parser-schema-id: <anonymous-schema-2>
            data:
              x-fern-type-name: SolanaDexPriceMessage
              type: object
              properties:
                token_address:
                  type: string
                  x-parser-schema-id: <anonymous-schema-4>
                pool_address:
                  type: string
                  x-parser-schema-id: <anonymous-schema-5>
                usd_price:
                  type: number
                  x-parser-schema-id: <anonymous-schema-6>
                block_slot:
                  type: integer
                  x-parser-schema-id: <anonymous-schema-7>
                block_time:
                  type: string
                  format: date-time
                  x-parser-schema-id: <anonymous-schema-8>
              x-parser-schema-id: <anonymous-schema-3>
          x-parser-schema-id: <anonymous-schema-1>
        title: Price Message
        description: Message containing the price data.
        example: |-
          {
            "topic": "solana.dex.prices",
            "data": {
              "id": 1,
              "token_address": "13NyGvtCdrBUqRSRHJUfw6yXFLoZ9VBu27RL8fq4daos",
              "pool_address": "9wFFyRfZBdaj2EcWNxUkt4GAg6Ct8N29pbh66ziNhbn",
              "usd_price": 0.00035333766896967665,
              "usd_volume": 137.4446156388933,
              "block_slot": 382423380,
              "block_time": "2026-05-28T12:00:00Z"
            }
          }
        bindings: []
        extensions:
          - id: x-parser-unique-object-id
            value: pricesSubscriptionMessage
          - id: x-parser-message-name
            value: pricesSubscriptionMessage
    bindings: []
    extensions: &ref_0
      - id: x-parser-unique-object-id
        value: solanaDexPricesSubscription
  - &ref_1
    id: sendSolanaDexPricesSubscription
    title: Send solana dex prices subscription
    type: receive
    messages:
      - &ref_3
        id: subscribePrices
        contentType: application/json
        payload:
          - name: Subscribe Prices
            description: Subscribe to price updates.
            type: object
            properties:
              - name: method
                type: string
                enumValues:
                  - subscribe
                  - unsubscribe
                required: true
              - name: topic
                type: string
                enumValues:
                  - solana.dex.prices
                  - solana.dex.swaps
                  - solana.dex.trades
                  - solana.dex.pools
                  - solana.dex.profiles.wallet
                  - solana.dex.profiles.token
                  - solana.dex.profiles.position
                  - solana.assets.transfers
                  - solana.assets.balance-changes
                required: true
              - name: params
                type: object
                required: true
                properties:
                  - name: token_addresses
                    type: array
                    required: false
                    properties:
                      - name: item
                        type: string
                        required: false
                  - name: pool_addresses
                    type: array
                    required: false
                    properties:
                      - name: item
                        type: string
                        required: false
        headers: []
        jsonPayloadSchema:
          type: object
          required:
            - method
            - topic
            - params
          properties:
            method:
              x-fern-type-name: SubscriptionMethodEnum
              type: string
              enum:
                - subscribe
                - unsubscribe
              x-parser-schema-id: <anonymous-schema-10>
            topic:
              x-fern-type-name: SubscriptionTopicEnum
              type: string
              enum:
                - solana.dex.prices
                - solana.dex.swaps
                - solana.dex.trades
                - solana.dex.pools
                - solana.dex.profiles.wallet
                - solana.dex.profiles.token
                - solana.dex.profiles.position
                - solana.assets.transfers
                - solana.assets.balance-changes
              x-parser-schema-id: <anonymous-schema-11>
            params:
              type: object
              properties:
                token_addresses:
                  type: array
                  items:
                    type: string
                    x-parser-schema-id: <anonymous-schema-14>
                  x-parser-schema-id: <anonymous-schema-13>
                pool_addresses:
                  type: array
                  items:
                    type: string
                    x-parser-schema-id: <anonymous-schema-16>
                  x-parser-schema-id: <anonymous-schema-15>
              x-parser-schema-id: <anonymous-schema-12>
          x-parser-schema-id: <anonymous-schema-9>
        title: Subscribe Prices
        description: Subscribe to price updates.
        example: |-
          {
            "method": "subscribe",
            "topic": "solana.dex.prices",
            "params": {
              "token_addresses": [
                "13NyGvtCdrBUqRSRHJUfw6yXFLoZ9VBu27RL8fq4daos"
              ],
              "pool_addresses": [
                "9wFFyRfZBdaj2EcWNxUkt4GAg6Ct8N29pbh66ziNhbn"
              ]
            }
          }
        bindings: []
        extensions:
          - id: x-parser-unique-object-id
            value: subscribePrices
          - id: x-parser-message-name
            value: subscribePrices
      - &ref_4
        id: unsubscribePrices
        contentType: application/json
        payload:
          - name: Unsubscribe Prices
            description: Unsubscribe from price updates.
            type: object
            properties:
              - name: method
                type: string
                enumValues:
                  - subscribe
                  - unsubscribe
                required: true
              - name: topics
                type: array
                description: >-
                  The topics to unsubscribe from. Leave empty to unsubscribe
                  from all topics.
                required: true
                properties:
                  - name: item
                    type: string
                    enumValues:
                      - solana.dex.prices
                      - solana.dex.swaps
                      - solana.dex.trades
                      - solana.dex.pools
                      - solana.dex.profiles.wallet
                      - solana.dex.profiles.token
                      - solana.dex.profiles.position
                      - solana.assets.transfers
                      - solana.assets.balance-changes
                    required: false
        headers: []
        jsonPayloadSchema:
          type: object
          required:
            - method
            - topics
          properties:
            method:
              x-fern-type-name: SubscriptionMethodEnum
              type: string
              enum:
                - subscribe
                - unsubscribe
              x-parser-schema-id: <anonymous-schema-18>
            topics:
              type: array
              description: >-
                The topics to unsubscribe from. Leave empty to unsubscribe from
                all topics.
              items:
                x-fern-type-name: SubscriptionTopicEnum
                type: string
                enum:
                  - solana.dex.prices
                  - solana.dex.swaps
                  - solana.dex.trades
                  - solana.dex.pools
                  - solana.dex.profiles.wallet
                  - solana.dex.profiles.token
                  - solana.dex.profiles.position
                  - solana.assets.transfers
                  - solana.assets.balance-changes
                x-parser-schema-id: <anonymous-schema-20>
              x-parser-schema-id: <anonymous-schema-19>
          x-parser-schema-id: <anonymous-schema-17>
        title: Unsubscribe Prices
        description: Unsubscribe from price updates.
        example: |-
          {
            "method": "unsubscribe",
            "topics": [
              "solana.dex.prices"
            ]
          }
        bindings: []
        extensions:
          - id: x-parser-unique-object-id
            value: unsubscribePrices
          - id: x-parser-message-name
            value: unsubscribePrices
    bindings: []
    extensions: *ref_0
sendOperations:
  - *ref_1
receiveOperations:
  - *ref_2
sendMessages:
  - *ref_3
  - *ref_4
receiveMessages:
  - *ref_5
extensions:
  - id: x-parser-unique-object-id
    value: solanaDexPricesSubscription
securitySchemes:
  - id: WsApiKeyAuth
    name: x-api-key
    type: httpApiKey
    description: >
      Your Prism API key. You can get one for free in the [Prism
      Dashboard](https://dashboard.prismapi.io).

      You must include it in the `x-api-key` query parameter.
    in: query
    extensions: []

````