Legend WebSocket API

Legend's Hyperliquid-compatible WebSocket at wss://api.legend.trade/ws, using subscription-based messaging. Public marketData channels stream trades, candles, and active asset context; account userData channels stream fills, open orders, order updates, clearinghouse state, funding, ledger updates, TWAP state and history, and notifications.

Work with this as data

Every API here is available over the APIs.io API and to AI agents over MCP.

MCP server

One button, every client — Claude, Cursor, VS Code and the rest.

https://apis.io/mcp

Tools for apis

7 MCP tools reach this
  • find_apisBrowse and filter every API in the catalog.
  • get_api_artifactsOne API's artifacts, grouped by type.
  • get_openapiThe primary OpenAPI for this API.
  • find_similar_apisAPIs that look like this one.
  • apis_io_searchSTART HERE — APIs, providers and tags for one query, each with its total.
  • resolveTurn a domain, URL or GitHub org into the provider it belongs to.
  • find_cohortsEvery scored population of providers in the catalog.
All 92 tools →

Call it yourself

curl for this page
This API
curl "https://apis.io/api/v1/apis/websocket"
All apis
curl "https://apis.io/api/v1/apis?limit=25"

Discovery needs no key. Ratings and market analysis are Pro.

Get an API key

Free tier, no form to fill in. Signing in shares your email address with us — we store it to create your key and to recognise you if you sign in with another provider. See our Privacy Policy and Terms.

A second provider on the same verified email joins the account you already have.

AsyncAPI Specification

legendtrade-ws-asyncapi.yml Raw ↑
asyncapi: 3.0.0
info:
  title: Legend WebSocket API
  version: 0.1.0
  description: >-
    Legend's Hyperliquid-compatible WebSocket at wss://api.legend.trade/ws,
    using subscription-based messaging. Clients subscribe to named channels;
    the server streams matching events.

    GENERATED by the API Evangelist enrichment pipeline on 2026-07-19 from the
    API's own self-describing root document (GET https://api.legend.trade),
    which enumerates the `/ws` path and the exact `wsSubscriptions` channel
    names under `marketData` and `userData`. Channel names are verbatim from
    that document. Message payload schemas are NOT modelled — Legend does not
    publish them and they were not observed on the wire, so they are left as
    open objects rather than invented.
  contact:
    name: Legend
    url: https://docs.legend.trade
  x-api-evangelist:
    method: generated
    generated: '2026-07-19'
    source: https://api.legend.trade (self-describing root, `wsSubscriptions`)
    upstream: https://hyperliquid.xyz
    caveat: >-
      Channel names are provider-published; payload schemas are unmodelled by
      design. A plain HTTPS GET to /ws returns 404 — the path is upgrade-only.
servers:
  production:
    host: api.legend.trade
    pathname: /ws
    protocol: wss
    description: Production WebSocket endpoint.
channels:
  trades:
    address: trades
    title: Trades
    description: Market data — executed trades.
    messages:
      trades:
        $ref: '#/components/messages/MarketDataEvent'
  candle:
    address: candle
    title: Candle
    description: Market data — candle updates.
    messages:
      candle:
        $ref: '#/components/messages/MarketDataEvent'
  activeAssetCtx:
    address: activeAssetCtx
    title: Active asset context
    description: Market data — context for the active asset.
    messages:
      activeAssetCtx:
        $ref: '#/components/messages/MarketDataEvent'
  userFills:
    address: userFills
    title: User fills
    description: User data — fills for the subscribed account.
    messages:
      userFills:
        $ref: '#/components/messages/UserDataEvent'
  openOrders:
    address: openOrders
    title: Open orders
    description: User data — current open orders.
    messages:
      openOrders:
        $ref: '#/components/messages/UserDataEvent'
  orderUpdates:
    address: orderUpdates
    title: Order updates
    description: User data — order lifecycle updates.
    messages:
      orderUpdates:
        $ref: '#/components/messages/UserDataEvent'
  clearinghouseState:
    address: clearinghouseState
    title: Clearinghouse state
    description: User data — margin and position state.
    messages:
      clearinghouseState:
        $ref: '#/components/messages/UserDataEvent'
  notification:
    address: notification
    title: Notification
    description: User data — account notifications.
    messages:
      notification:
        $ref: '#/components/messages/UserDataEvent'
  webData3:
    address: webData3
    title: Web data
    description: User data — aggregated client state payload.
    messages:
      webData3:
        $ref: '#/components/messages/UserDataEvent'
  twapStates:
    address: twapStates
    title: TWAP states
    description: User data — state of running TWAP orders.
    messages:
      twapStates:
        $ref: '#/components/messages/UserDataEvent'
  userEvents:
    address: userEvents
    title: User events
    description: User data — account events.
    messages:
      userEvents:
        $ref: '#/components/messages/UserDataEvent'
  userFundings:
    address: userFundings
    title: User fundings
    description: User data — funding payments.
    messages:
      userFundings:
        $ref: '#/components/messages/UserDataEvent'
  userNonFundingLedgerUpdates:
    address: userNonFundingLedgerUpdates
    title: User non-funding ledger updates
    description: User data — ledger updates other than funding.
    messages:
      userNonFundingLedgerUpdates:
        $ref: '#/components/messages/UserDataEvent'
  activeAssetData:
    address: activeAssetData
    title: Active asset data
    description: User data — per-asset account data.
    messages:
      activeAssetData:
        $ref: '#/components/messages/UserDataEvent'
  userTwapSliceFills:
    address: userTwapSliceFills
    title: User TWAP slice fills
    description: User data — fills from individual TWAP slices.
    messages:
      userTwapSliceFills:
        $ref: '#/components/messages/UserDataEvent'
  userTwapHistory:
    address: userTwapHistory
    title: User TWAP history
    description: User data — historical TWAP orders.
    messages:
      userTwapHistory:
        $ref: '#/components/messages/UserDataEvent'
operations:
  receiveTrades:
    action: receive
    channel:
      $ref: '#/channels/trades'
  receiveCandle:
    action: receive
    channel:
      $ref: '#/channels/candle'
  receiveActiveAssetCtx:
    action: receive
    channel:
      $ref: '#/channels/activeAssetCtx'
  receiveUserFills:
    action: receive
    channel:
      $ref: '#/channels/userFills'
  receiveOpenOrders:
    action: receive
    channel:
      $ref: '#/channels/openOrders'
  receiveOrderUpdates:
    action: receive
    channel:
      $ref: '#/channels/orderUpdates'
  receiveClearinghouseState:
    action: receive
    channel:
      $ref: '#/channels/clearinghouseState'
  receiveNotification:
    action: receive
    channel:
      $ref: '#/channels/notification'
  receiveWebData3:
    action: receive
    channel:
      $ref: '#/channels/webData3'
  receiveTwapStates:
    action: receive
    channel:
      $ref: '#/channels/twapStates'
  receiveUserEvents:
    action: receive
    channel:
      $ref: '#/channels/userEvents'
  receiveUserFundings:
    action: receive
    channel:
      $ref: '#/channels/userFundings'
  receiveUserNonFundingLedgerUpdates:
    action: receive
    channel:
      $ref: '#/channels/userNonFundingLedgerUpdates'
  receiveActiveAssetData:
    action: receive
    channel:
      $ref: '#/channels/activeAssetData'
  receiveUserTwapSliceFills:
    action: receive
    channel:
      $ref: '#/channels/userTwapSliceFills'
  receiveUserTwapHistory:
    action: receive
    channel:
      $ref: '#/channels/userTwapHistory'
components:
  messages:
    MarketDataEvent:
      name: MarketDataEvent
      title: Market data event
      summary: A market-data event on a public channel. Payload schema not published by Legend.
      contentType: application/json
      payload:
        type: object
        additionalProperties: true
    UserDataEvent:
      name: UserDataEvent
      title: User data event
      summary: An account-scoped event. Payload schema not published by Legend.
      contentType: application/json
      payload:
        type: object
        additionalProperties: true