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

# Stream real-time data for multiple assets

> Establishes an SSE stream payload subscription for multiplexing multiple assets within a single pipeline.
**Stream Constraints:** Maximum payload array length is **25 assets**.
**Supported Channel Events:** - `token_price`: Real-time asset evaluation. Schema matches `PriceResponse`. - `t_p` (Deprecated): Scheduled for removal in 2027. Schema matches `PriceLegacyResponse`. - `ping`: Infrastructure keep-alive payload (`PingEvent`). - `error`: Stream-level operational exceptions (`ErrorEvent`).




## OpenAPI

````yaml /streaming/api-streaming.yml post /sse/prices
openapi: 3.1.0
info:
  title: DexPaprika Streaming API
  version: 1.0.1
  license:
    name: UNLICENSED
    identifier: UNLICENSED
  description: >
    The DexPaprika Streaming API delivers real-time updates for token prices
    utilizing the Server-Sent Events (SSE) protocol.

    ### Connection Quotas and Limits To ensure high availability and
    infrastructure stability, the following constraints are strictly enforced:

    - **Concurrent Streams:** A maximum of **10 active SSE streams** are
    permitted per IP address. Exceeding this threshold results in a `429 Too
    Many Requests` response containing the message `ip stream limit exceeded`.

    - **Subscription Capacity:** Batch subscription endpoints (POST) are limited
    to a maximum of **25 requests per stream**.

    - **Keep-Alive Protocol:** The server dispatches a `ping` event every 15
    seconds to maintain active TCP connections.

    ### Deprecation Notice The `/stream` endpoint architecture has been
    refactored. 

    - Legacy path `/stream` is **deprecated** and scheduled for
    decommissioning. 

    - Active implementations must migrate to `/sse/prices`.

    ### Server-Sent Events (SSE) Protocol Messages conform to the standard W3C
    SSE specification with an additional `request_id` field for tracking
    multiplexed requests: ``` event: [event_name] request_id: [your_request_id]
    data: [json_payload] ```

    #### Request correlation (`request_id`) Every streaming endpoint accepts an
    optional `request_id` query parameter. When supplied, the server echoes it
    back on every message of the stream as an SSE `request_id:` field, so you
    can correlate emitted events with the subscription that produced them. This
    is most useful on multiplexed POST streams where several subscriptions share
    one connection. The `request_id` is included on all non-legacy, non-system
    events — it is omitted from `ping`, `warning`, and `error` events.

    - **Format:** the value must be a non-negative integer. Any non-numeric
    value is rejected with `{"message": "invalid query parameters: request_id
    (must be a number)"}`. - **Default:** when omitted, the server emits
    `request_id: 0` on every message.

    #### Core System Events

    - `ping`: Sent every 15 seconds for connection keep-alive.
      ```
      event: ping
      data: {"time": 1715162400}
      ```
    - `warning`: Non-breaking operational alerts (e.g., deprecation warnings).
      ```
      event: warning
      data: {"message": "Deprecation notice description"}
      ```
    - `error`: Sent prior to abnormal stream termination. The payload is always
    a single `{"message": "..."}` object.
      ```
      event: error
      data: {"message": "Error description"}
      ```
servers:
  - url: https://streaming.dexpaprika.com
    description: Production Streaming Gateway
security: []
paths:
  /sse/prices:
    post:
      summary: Stream real-time data for multiple assets
      description: >
        Establishes an SSE stream payload subscription for multiplexing multiple
        assets within a single pipeline.

        **Stream Constraints:** Maximum payload array length is **25 assets**.

        **Supported Channel Events:** - `token_price`: Real-time asset
        evaluation. Schema matches `PriceResponse`. - `t_p` (Deprecated):
        Scheduled for removal in 2027. Schema matches `PriceLegacyResponse`. -
        `ping`: Infrastructure keep-alive payload (`PingEvent`). - `error`:
        Stream-level operational exceptions (`ErrorEvent`).
      operationId: streamBatchAssetPrices
      parameters:
        - name: limit
          in: query
          required: false
          schema:
            type: integer
            minimum: 1
          description: >-
            Maximum event count processing threshold before server-initiated
            connection teardown.
        - $ref: '#/components/parameters/requestIdParam'
      requestBody:
        required: true
        content:
          application/json:
            schema:
              type: array
              maxItems: 25
              description: Batch allocation payload containing targeted asset definitions.
              items:
                $ref: '#/components/schemas/AssetDataRequest'
      responses:
        '200':
          description: Multiplexed SSE stream successfully established.
          content:
            text/event-stream:
              schema:
                oneOf:
                  - $ref: '#/components/schemas/PriceResponse'
                  - $ref: '#/components/schemas/PriceLegacyResponse'
                  - $ref: '#/components/schemas/PingEvent'
                  - $ref: '#/components/schemas/WarningEvent'
                  - $ref: '#/components/schemas/ErrorEvent'
        4XX:
          description: >-
            Client error (e.g., invalid payload, batch limit exceeded, or stream
            limit exceeded).
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorEvent'
components:
  parameters:
    requestIdParam:
      name: request_id
      in: query
      required: false
      schema:
        type: integer
        minimum: 0
      description: >-
        Optional correlation ID echoed back on every message of the stream as an
        SSE `request_id:` field. Must be a non-negative integer; non-numeric
        values are rejected with `{"message": "invalid query parameters:
        request_id (must be a number)"}`. Defaults to `0` when omitted.
  schemas:
    AssetDataRequest:
      type: object
      required:
        - chain
        - address
        - method
      properties:
        chain:
          type: string
          example: ethereum
        address:
          type: string
          example: '0x7a250d5630B4cF539739dF2C5dAcb4c659F2488D'
        method:
          type: string
          enum:
            - token_price
            - t_p
          description: '`t_p` parameter format is deprecated and slated for future removal.'
        request_id:
          type: integer
          minimum: 0
          maximum: 4294967295
          description: >-
            Optional identifier for tracking multiplexed requests. If not
            provided for POST requests, defaults to the index in the array.
        filter:
          type: object
    PriceResponse:
      type: object
      description: Payload envelope mapping to the `token_price` event channel.
      properties:
        address:
          type: string
          description: Token smart contract address.
        chain:
          type: string
          description: Cryptographic network runtime string identifier.
        price:
          type: string
          description: Asset evaluation calculation in USD.
        timestamp:
          type: string
          description: System transaction ingestion timestamp.
        timestamp_price:
          type: string
          description: Historical oracle evaluation layer execution timestamp.
        token_price:
          type: string
          description: Explicit alias structure referencing timestamp_price.
    PriceLegacyResponse:
      type: object
      description: Payload envelope mapping to the deprecated `t_p` event channel.
      properties:
        a:
          type: string
          description: Asset address proxy value.
        c:
          type: string
          description: Network chain namespace.
        p:
          type: string
          description: Absolute unit representation in USD.
        t:
          type: string
          description: Epoch entry log system timestamp.
        t_p:
          type: string
          description: Data ingestion layer price stamp execution timeline.
    PingEvent:
      type: object
      description: Connection structural lifecycle verify payload.
      properties:
        time:
          type: integer
          description: Standard Unix system epoch format validation anchor.
          example: 1715162400
    WarningEvent:
      type: object
      description: Informational pipeline lifecycle event indicators.
      properties:
        message:
          type: string
          description: Internal compliance metrics alert description.
          example: stream is deprecated, move to /sse/prices instead
    ErrorEvent:
      type: object
      description: Runtime system stream rejection payload exception details.
      properties:
        message:
          type: string
          description: Machine-readable reason for connection fault or stream termination.
          example: 'invalid search query parameters: address (not found)'

````