> ## 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 Dead Man's Switch

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

**Required**: `timeout_seconds` (the dead man's switch duration in seconds).

Send this subscription over the shared /ws connection; /ws/cancelAllOrdersAfterSpot is a documentation route, not a separate socket URL. See the [Spot API guide](/api-reference/spot-api-guide). Cancels all open Spot orders for the account after no client activity for timeout_seconds. Inbound ping refreshes the timer; outbound data does not. Omit markets. A new connection replaces the account timer. The timer remains armed after disconnect; re-arm after reconnect. Set timeout_seconds to 0 or unsubscribe to disarm without canceling existing orders.



## OpenAPI

````yaml /api-reference/ws-spec.json post /ws/cancelAllOrdersAfterSpot
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/cancelAllOrdersAfterSpot:
    post:
      tags:
        - Spot private channels
      summary: 'Subscribe: Spot Dead Man''s Switch'
      description: >-
        Subscribe to the `cancelAllOrdersAfterSpot` channel. Requires
        authentication (login first).


        **Required**: `timeout_seconds` (the dead man's switch duration in
        seconds).


        Send this subscription over the shared /ws connection;
        /ws/cancelAllOrdersAfterSpot is a documentation route, not a separate
        socket URL. See the [Spot API guide](/api-reference/spot-api-guide).
        Cancels all open Spot orders for the account after no client activity
        for timeout_seconds. Inbound ping refreshes the timer; outbound data
        does not. Omit markets. A new connection replaces the account timer. The
        timer remains armed after disconnect; re-arm after reconnect. Set
        timeout_seconds to 0 or unsubscribe to disarm without canceling existing
        orders.
      operationId: subscribe_cancelAllOrdersAfterSpot
      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:
                    - cancelAllOrdersAfterSpot
                  example: cancelAllOrdersAfterSpot
                  description: Channel for this subscription.
                timeout_seconds:
                  type: integer
                  example: 30
                  description: >-
                    Required when subscribing. Zero disarms. Omit when
                    unsubscribing.
            example:
              op: subscribe
              channel: cancelAllOrdersAfterSpot
              timeout_seconds: 30
      responses:
        '200':
          description: Channel update for `cancelAllOrdersAfterSpot`
          content:
            application/json:
              schema:
                type: object
                properties:
                  type:
                    type: string
                    enum:
                      - subscribed
                      - unsubscribed
                      - update
                  channel:
                    type: string
                    enum:
                      - cancelAllOrdersAfterSpot
                  data:
                    type: object

````

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