> ## 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 reserve updates for multiple pools or tokens

> Establishes a multiplexed SSE stream for reserve updates across multiple pools or tokens within a single connection.
**Stream Constraints:** Maximum payload array length is **25 subscriptions**.
**Supported Channel Events:** - `pool_reserves`: Per-block reserve update for a pool. Schema matches `PoolReservesResponse`. - `token_reserves`: Aggregated reserve update for a token. Schema matches `TokenReservesResponse`. - `ping`: Infrastructure keep-alive payload (`PingEvent`). - `error`: Stream-level operational exceptions (`ErrorEvent`).




## OpenAPI

````yaml /streaming/api-streaming.yml post /sse/reserves
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,
    swap transactions,

    and pool reserves over Server-Sent Events (SSE).


    ## Rate Limits


    - **Concurrent SSE streams per IP:** 10. Excess returns `429` with
    `{"message": "ip stream limit exceeded"}`.

    - **Assets per `POST /sse/prices`:** 25. Excess returns `400` with
    `{"message": "too many assets, max 25 allowed"}`.

    - **Request body on `POST /sse/prices`:** 256 KB. Excess returns `413
    Payload Too Large`.

    - **Request rate (per IP x path x method):** 60 req / 60 s. Excess returns
    `429` with `{"message": "you have reached maximum request limit"}`.


    ## HTTP Response Codes


    - `200` — SSE connection established.

    - `400` — Invalid request (bad params, unknown chain, unknown asset, or
    asset cap exceeded).

    - `413` — Request body exceeds the route limit.

    - `429` — Per-IP stream limit, per-route rate limit, or global stream slot
    pool exhausted.

    - `503` — Service saturated (concurrent in-flight cap reached).


    ## SSE Event Format


    Events conform to the W3C SSE specification. Non-system events on
    multiplexed streams include

    an optional `request_id` line for correlating events to subscriptions:


    ```

    event: [event_name]

    request_id: [request_id]

    data: [json_payload]

    ```


    ## Event Types


    - `token_price` (`PriceResponse`) — Real-time price update.

    - `ping` (`PingEvent`) — Heartbeat sent every 15 s. Treat absence for >30 s
    as a potential connection problem.

    - `warning` (`WarningEvent`) — Non-fatal notice (e.g. partial subscription
    accepted).

    - `error` (`ErrorEvent`) — Terminal stream-level error sent before
    connection close.


    ## Error Message Catalog


    400 errors:

    - `at least one asset is required`

    - `invalid method`

    - `unsupported chain`

    - `asset not found`

    - `too many assets, max 25 allowed`


    429 errors:

    - `ip stream limit exceeded`

    - `Cannot create new subscriptions, global stream limit exceeded`

    - `you have reached maximum request limit`


    503 errors:

    - `Too many concurrent requests`


    ## Deprecation


    The `/stream` path is deprecated and scheduled for decommissioning — migrate
    to `/sse/prices`.

    See the deprecated `/stream` operations below for migration guidance.
servers:
  - url: https://streaming.dexpaprika.com
    description: Production Streaming Gateway
security: []
paths:
  /sse/reserves:
    post:
      summary: Stream real-time reserve updates for multiple pools or tokens
      description: >
        Establishes a multiplexed SSE stream for reserve updates across multiple
        pools or tokens within a single connection.

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

        **Supported Channel Events:** - `pool_reserves`: Per-block reserve
        update for a pool. Schema matches `PoolReservesResponse`. -
        `token_reserves`: Aggregated reserve update for a token. Schema matches
        `TokenReservesResponse`. - `ping`: Infrastructure keep-alive payload
        (`PingEvent`). - `error`: Stream-level operational exceptions
        (`ErrorEvent`).
      operationId: streamBatchReserves
      parameters:
        - name: limit
          in: query
          required: false
          schema:
            type: integer
            minimum: 1
          description: Maximum event count before server-initiated connection teardown.
      requestBody:
        required: true
        content:
          application/json:
            schema:
              type: array
              maxItems: 25
              description: >-
                Batch subscription payload containing targeted pool or token
                definitions.
              items:
                $ref: '#/components/schemas/ReserveStreamRequest'
      responses:
        '200':
          description: Multiplexed SSE stream successfully established.
          content:
            text/event-stream:
              schema:
                oneOf:
                  - $ref: '#/components/schemas/PoolReservesResponse'
                  - $ref: '#/components/schemas/TokenReservesResponse'
                  - $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:
  schemas:
    ReserveStreamRequest:
      type: object
      required:
        - chain
        - address
        - method
      properties:
        chain:
          type: string
          example: ethereum
          description: Target blockchain network identifier.
        address:
          type: string
          example: '0x88e6a0c2ddd26feeb64f039a2c41296fcb3f5640'
          description: Pool or token smart contract address.
        method:
          type: string
          enum:
            - pool_reserves
            - token_reserves
          description: >-
            Subscription target type — `pool_reserves` for pool-level data,
            `token_reserves` for token-level aggregated data.
        request_id:
          type: integer
          minimum: 0
          maximum: 4294967295
          description: >-
            Optional identifier for tracking multiplexed requests. Defaults to
            the array index if omitted.
    PoolReservesResponse:
      type: object
      description: >-
        Per-block reserve update for a pool. Emitted on the `pool_reserves`
        event channel.
      properties:
        chain:
          type: string
          description: Blockchain network identifier.
          example: ethereum
        pool_id:
          type: string
          description: Pool smart contract address.
          example: '0x88e6a0c2ddd26feeb64f039a2c41296fcb3f5640'
        block:
          type: string
          description: >-
            Block number in which the reserve update was confirmed
            (string-encoded integer).
          example: '19000000'
        previous_block:
          type: string
          description: >-
            Previous block number for this pool (string-encoded integer).
            Omitted if unavailable.
          example: '18999999'
        tokens:
          type: array
          description: Per-token reserve statistics for this pool.
          items:
            $ref: '#/components/schemas/TokenReserveStat'
        total_reserve_usd:
          type: number
          description: Total USD value of all reserves in the pool.
          example: 2000000.75
        total_delta_usd:
          type: number
          description: >-
            Total USD change across all reserves. Negative values indicate a net
            decrease.
          example: -1000.5
        timestamp:
          type: integer
          description: Server ingestion timestamp (Unix epoch seconds).
          example: 1715162400
        block_timestamp:
          type: integer
          description: On-chain block timestamp (Unix epoch seconds).
          example: 1715162388
    TokenReservesResponse:
      type: object
      description: >-
        Aggregated reserve update across all pools for a token. Emitted on the
        `token_reserves` event channel.
      properties:
        chain:
          type: string
          description: Blockchain network identifier.
          example: ethereum
        token_id:
          type: string
          description: Token smart contract address.
          example: '0xa0b86991c6218b36c1d19d4a2e9eb0ce3606eb48'
        reserve:
          type: string
          description: >-
            Total raw token reserve across all pools (big integer,
            string-encoded).
          example: '5000000000000'
        delta:
          type: string
          description: >-
            Change in aggregated reserve since the previous update (big integer,
            string-encoded).
          example: '-500000'
        block:
          type: string
          description: Block number of the triggering update (string-encoded integer).
          example: '19000000'
        price_usd:
          type: number
          description: USD price per one unit of the token (after decimal normalisation).
          example: 1.0005
        reserve_usd:
          type: number
          description: USD value of the total aggregated reserve.
          example: 5000250
        delta_usd:
          type: number
          description: >-
            USD value of the aggregated reserve change. Negative values indicate
            a decrease.
          example: -500.25
        updated_at:
          type: integer
          description: >-
            On-chain block timestamp of the triggering update (Unix epoch
            seconds).
          example: 1715162388
        timestamp:
          type: integer
          description: Server ingestion timestamp (Unix epoch seconds).
          example: 1715162400
    PingEvent:
      type: object
      description: Heartbeat sent every 15 s to keep the connection alive.
      properties:
        time:
          type: integer
          description: Unix epoch seconds at the time of the ping.
          example: 1715162400
    WarningEvent:
      type: object
      description: >-
        Non-fatal notice sent over the stream without closing it (e.g. a partial
        subscription was accepted).
      properties:
        message:
          type: string
          description: Human-readable warning description.
          example: stream is deprecated, move to /sse/prices instead
    ErrorEvent:
      type: object
      description: >-
        Terminal error sent before the server closes the stream. Also used as
        the body for 4XX/5XX HTTP error responses.
      properties:
        message:
          type: string
          description: >-
            Human-readable error description. See the Error Message Catalog in
            the overview for the full list of stable values.
          example: asset not found
    TokenReserveStat:
      type: object
      description: Reserve statistics for a single token within a pool.
      properties:
        token_id:
          type: string
          description: Token smart contract address.
          example: '0xa0b86991c6218b36c1d19d4a2e9eb0ce3606eb48'
        reserve:
          type: string
          description: Raw token reserve amount (big integer, string-encoded).
          example: '1000000000000'
        delta:
          type: string
          description: >-
            Change in reserve since the previous block (big integer,
            string-encoded). Negative values indicate a decrease.
          example: '-500000'
        price_usd:
          type: number
          description: USD price per one unit of the token (after decimal normalisation).
          example: 1.0005
        reserve_usd:
          type: number
          description: USD value of the total reserve held in this pool.
          example: 1000000.5
        delta_usd:
          type: number
          description: >-
            USD value of the reserve change. Negative values indicate a
            decrease.
          example: -500.25

````