> ## 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: Perps Order Amends

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

Optional `markets` to filter.

Each update carries an order you amended, with its size and price from before the amend in `previousSize` and `previousPrice`. An amended take profit or stop loss carries `previousTriggerPrice` instead of `previousPrice`, in its current status: `untriggered`, or `pending` while its order rests on the book. Its `previousSize` is omitted when it closes the whole position. The amended order is also published on `ordersPerps`, like any other order update.



## OpenAPI

````yaml /api-reference/ws-spec.json post /ws/orderAmendsPerps
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/orderAmendsPerps:
    post:
      tags:
        - Private Channels
      summary: 'Subscribe: Perps Order Amends'
      description: >-
        Subscribe to the `orderAmendsPerps` channel. Requires authentication
        (login first).


        Optional `markets` to filter.


        Each update carries an order you amended, with its size and price from
        before the amend in `previousSize` and `previousPrice`. An amended take
        profit or stop loss carries `previousTriggerPrice` instead of
        `previousPrice`, in its current status: `untriggered`, or `pending`
        while its order rests on the book. Its `previousSize` is omitted when it
        closes the whole position. The amended order is also published on
        `ordersPerps`, like any other order update.
      operationId: subscribe_orderAmendsPerps
      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:
                    - orderAmendsPerps
                  example: orderAmendsPerps
                  description: Channel for this subscription.
                markets:
                  type: array
                  items:
                    type: string
                  example:
                    - NVDA-USD.P
                  description: >-
                    Markets to filter by. Optional; if omitted, all available
                    markets are used.
            example:
              op: subscribe
              channel: orderAmendsPerps
              markets:
                - NVDA-USD.P
      responses:
        '200':
          description: Channel update for `orderAmendsPerps`
          content:
            application/json:
              schema:
                type: object
                properties:
                  type:
                    type: string
                    enum:
                      - update
                  channel:
                    type: string
                    enum:
                      - orderAmendsPerps
                  data:
                    type: array
                    items:
                      oneOf:
                        - $ref: '#/components/schemas/OrderAmend'
                        - $ref: '#/components/schemas/StopOrderAmend'
              examples:
                order:
                  summary: Amended limit order
                  value:
                    type: update
                    channel: orderAmendsPerps
                    data:
                      - orderId: 197ec08e001658690721be129e7fa595
                        side: buy
                        price: '227.50'
                        size: '12.00'
                        market: AAPL-USD.P
                        filledSize: '0.00'
                        filledCost: '0.00'
                        fee: '0.00'
                        status: open
                        createdAt: '2025-03-05T14:30:00Z'
                        amendedAt: '2025-03-05T14:32:00Z'
                        version: 1
                        type: limit
                        timeInForce: GTC
                        previousSize: '10.00'
                        previousPrice: '227.50'
                stopOrder:
                  summary: Amended stop loss waiting for its order to fill
                  value:
                    type: update
                    channel: orderAmendsPerps
                    data:
                      - orderId: 7a8b9c0d1e2f4a3b5c6d7e8f9a0b1c2d
                        parentOrderId: 197ec08e001658690721be129e7fa595
                        side: sell
                        price: '0'
                        size: '12.00'
                        market: AAPL-USD.P
                        filledSize: '0'
                        lastFillSize: '0'
                        filledCost: '0'
                        fee: '0'
                        status: pending
                        createdAt: '2025-03-05T14:30:00Z'
                        version: 1
                        type: stopMarket
                        stopOrderType: stopLoss
                        triggerPrice: '215.00'
                        previousSize: '12.00'
                        previousTriggerPrice: '200.00'
components:
  schemas:
    OrderAmend:
      description: An amended order, with its size and price from before the amend.
      allOf:
        - $ref: '#/components/schemas/Order'
        - type: object
          properties:
            previousSize:
              type: string
              description: Total order size before this amend
              example: '10.00'
            previousPrice:
              type: string
              description: >-
                Limit price before this amend. Equals `price` when the amend
                changed only the size.
              example: '227.50'
    StopOrderAmend:
      description: >-
        An amended take profit or stop loss, with its trigger price and size
        from before the amend.
      allOf:
        - $ref: '#/components/schemas/Order'
        - type: object
          properties:
            previousTriggerPrice:
              type: string
              description: >-
                Trigger price before this amend. Equals `triggerPrice` when the
                amend changed only the quantity.
              example: '200.00'
            previousSize:
              type: string
              description: >-
                Size before this amend. Omitted for a stop order that closes the
                whole position, which has no size of its own. A pending stop
                order has its order's size, which an amend leaves as it was.
              example: '12.00'
    Order:
      type: object
      properties:
        orderId:
          type: string
          example: 197ec08e001658690721be129e7fa595
        clientOrderId:
          type: string
        parentOrderId:
          type: string
        side:
          type: string
          enum:
            - buy
            - sell
        price:
          type: string
          example: '227.50'
        size:
          type: string
          example: '10.00'
        market:
          type: string
          example: AAPL-USD.P
        filledSize:
          type: string
          example: '0.00'
        lastFillSize:
          type: string
          example: '0.00'
        filledCost:
          type: string
          example: '0.00'
        realizedPnl:
          type: string
        fee:
          type: string
          example: '0.00'
        feeRebate:
          type: string
        status:
          type: string
          enum:
            - open
            - fullyfilled
            - canceled
            - pending
            - untriggered
        createdAt:
          type: string
          format: date-time
        filledAt:
          type: string
          format: date-time
        canceledAt:
          type: string
          format: date-time
        amendedAt:
          type: string
          format: date-time
          description: Time of the order's most recent amend (if amended)
          example: '2026-10-20T08:25:52.581560822Z'
        version:
          type: integer
          description: >-
            Number of times the order has been amended. Omitted until the first
            amend; treat a missing value as `0`. Send it as `version` when you
            amend the order.
          example: 1
        cancelReason:
          type: string
        type:
          type: string
          enum:
            - limit
            - market
        timeInForce:
          type: string
          enum:
            - GTC
            - IOC
            - FOK
        reduceOnly:
          type: boolean
        liquidationId:
          type: string
        closePosition:
          type: boolean
        stopOrderType:
          type: string
        triggerPrice:
          type: string
      example:
        orderId: 197ec08e001658690721be129e7fa595
        side: buy
        price: '227.50'
        size: '10.00'
        market: AAPL-USD.P
        filledSize: '0.00'
        filledCost: '0.00'
        fee: '0.00'
        status: open
        createdAt: '2025-03-05T14:30:00Z'
        type: limit
        timeInForce: GTC

````

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