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

# Subscribe: Spot Orders

> Subscribe to the `ordersSpot` channel. Requires authentication (login first).

Optional `markets` to filter.

Send this subscription over the shared /ws connection; /ws/ordersSpot is a documentation route, not a separate socket URL. See the [Spot API guide](/api-reference/spot-api-guide). Events do not include a complete history at subscription. Initialize and reconcile through REST after reconnects.



## OpenAPI

````yaml /api-reference/ws-spec.json post /ws/ordersSpot
openapi: 3.0.3
info:
  title: Ondo Perps WebSocket API
  version: '1.0'
  description: >-
    WebSocket API for Ondo Perps: real-time market data, order updates,
    positions, balance, funding, and more.


    ## Connection


    Connect via `wss://api.ondoperps.xyz/ws`. The server enforces a 32 KB max
    message size and a rate limit of 25 requests/second (burst 50).


    ## Authentication


    Public channels (market data) require no authentication. Private channels
    (orders, fills, positions, balance, etc.) require a `login` message first.


    ### JWT Login

    ```json

    {"op": "login", "args": {"token": "<JWT>"}}

    ```


    ### API Key Login

    ```json

    {"op": "login", "args": {"key": "<api_key_id>", "time": "<unix_ms>", "sign":
    "<hex_hmac>"}}

    ```


    Signature: `HMAC-SHA256(api_secret, time + "ondo_perps_ws_login" )`


    ## Heartbeat


    Send `{"op": "ping"}` periodically. The server responds with `{"type":
    "pong"}`. Connections idle for 180 seconds are closed.


    ## Message Format


    ### Client → Server

    All client messages use the `op` field: `ping`, `login`, `subscribe`,
    `unsubscribe`, `sendMessage`.


    ### Server → Client

    All server messages use the `type` field: `pong`, `loggedIn`, `subscribed`,
    `unsubscribed`, `update`, `error`.

    Channel data updates arrive as `{"type": "update", "channel": "<name>",
    "data": <payload>}`.
servers:
  - url: wss://api.ondoperps.xyz
    description: Production
security: []
paths:
  /ws/ordersSpot:
    post:
      tags:
        - Spot private channels
      summary: 'Subscribe: Spot Orders'
      description: >-
        Subscribe to the `ordersSpot` channel. Requires authentication (login
        first).


        Optional `markets` to filter.


        Send this subscription over the shared /ws connection; /ws/ordersSpot is
        a documentation route, not a separate socket URL. See the [Spot API
        guide](/api-reference/spot-api-guide). Events do not include a complete
        history at subscription. Initialize and reconcile through REST after
        reconnects.
      operationId: subscribe_ordersSpot
      requestBody:
        content:
          application/json:
            schema:
              type: object
              required:
                - op
                - channel
              properties:
                op:
                  type: string
                  enum:
                    - subscribe
                    - unsubscribe
                  example: subscribe
                  description: Operation type.
                channel:
                  type: string
                  enum:
                    - ordersSpot
                  example: ordersSpot
                  description: Channel for this subscription.
                markets:
                  type: array
                  items:
                    type: string
                  example:
                    - NVDA-USDC
                  description: >-
                    Markets to filter by. Optional; if omitted, all available
                    markets are used.
            example:
              op: subscribe
              channel: ordersSpot
              markets:
                - NVDA-USDC
      responses:
        '200':
          description: Channel update for `ordersSpot`
          content:
            application/json:
              schema:
                type: object
                properties:
                  type:
                    type: string
                    enum:
                      - update
                  channel:
                    type: string
                    enum:
                      - ordersSpot
                  data:
                    type: array
                    items:
                      $ref: '#/components/schemas/SpotOrder'
              example:
                type: update
                channel: ordersSpot
                data:
                  - orderId: 197ec08e001658690721be129e7fa595
                    side: buy
                    price: '227.50'
                    size: '10.00'
                    market: SPY-USDC
                    filledSize: '0.00'
                    filledCost: '0.00'
                    fee: '0.00'
                    status: open
                    createdAt: '2025-03-05T14:30:00Z'
                    type: limit
                    timeInForce: GTC
components:
  schemas:
    SpotOrder:
      type: object
      required:
        - orderId
        - side
        - price
        - size
        - market
        - filledSize
        - lastFillSize
        - filledCost
        - fee
        - status
        - createdAt
        - type
      properties:
        orderId:
          type: string
          description: Internal order ID
          example: 70a37d8f972f2494837f9dba8364cbb4
        clientOrderId:
          type: string
          description: Client-provided order ID (if set)
          example: order123
        side:
          type: string
          description: buy or sell
          enum:
            - buy
            - sell
          example: buy
        price:
          type: string
          description: Limit price
          example: '1.55'
        size:
          type: string
          description: Order quantity in base currency
          example: '20.30'
        market:
          type: string
          description: Trading market
          example: SPY-USDC
        filledSize:
          type: string
          description: Quantity of the order that has been filled
          example: '5.403'
        lastFillSize:
          type: string
          description: Quantity filled in the most recent trade
          example: '5.403'
        filledCost:
          type: string
          description: Cost of the filled portion of the order (filledSize × fill price)
          example: '8.37465'
        fee:
          type: string
          description: >-
            Fee in the asset received: base equivalent quantity for buys, USDC
            for sells. Zero during the launch promotion.
          example: '0.0837'
        status:
          type: string
          description: Order status
          enum:
            - open
            - fullyfilled
            - canceled
          example: open
        createdAt:
          type: string
          format: date-time
          description: Order creation time
          example: '2022-06-16T12:35:11.123456Z'
        filledAt:
          type: string
          format: date-time
          description: Time when the order was fully filled (if applicable)
          example: '2022-06-16T12:35:11.123456Z'
        canceledAt:
          type: string
          format: date-time
          description: Order cancellation time (if cancelled)
          example: '2022-06-16T12:35:11.123456Z'
        cancelReason:
          type: string
          description: >-
            Cancellation reason when provided. Treat this as an extensible
            string.
          example: liquidation
        type:
          type: string
          description: Order type
          enum:
            - limit
            - market
          example: limit
        timeInForce:
          type: string
          description: Time in force (GTC or IOC). Not returned for market orders.
          enum:
            - GTC
            - IOC
          example: GTC

````

This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.