{
  "openrpc": "1.2.6",
  "info": {
    "title": "Hyperliquid HyperCore JSON-RPC API",
    "description": "Quicknode Hyperliquid HyperCore JSON-RPC API reference",
    "version": "1.0.0"
  },
  "methods": [
    {
      "name": "hl_batchClearinghouseStates",
      "summary": "Retrieves clearinghouse states (perp positions and margin data) for multiple users simultaneously.",
      "description": "Retrieves clearinghouse states (perp positions and margin data) for multiple users simultaneously. Maximum of 1000 users per request",
      "params": [
        {
          "name": "users",
          "description": "Array of Ethereum wallet addresses (0x-prefixed, 42 characters each). Maximum 1000 addresses",
          "required": true,
          "schema": {
            "type": "array",
            "items": {}
          }
        },
        {
          "name": "dex",
          "description": "Optional. Omit for native DEX only, or use 'ALL_DEXES' to fetch data across all dexes. When using ALL_DEXES, each clearinghouse state will be organized by DEX name (native, xyz, flx, vntl, hyna, km, abcd, cash, para)",
          "schema": {
            "type": "string"
          }
        }
      ],
      "result": {
        "name": "result",
        "description": "Batch response containing successful states and failed wallets",
        "schema": {
          "type": "object",
          "properties": {
            "successful_states": {
              "type": "array",
              "items": {
                "type": "object",
                "properties": {
                  "address": {
                    "type": "string",
                    "description": "Ethereum wallet address (0x-prefixed)"
                  },
                  "data": {
                    "type": "object",
                    "properties": {
                      "marginSummary": {
                        "type": "object",
                        "properties": {
                          "accountValue": {
                            "type": "string",
                            "description": "Total account value as a stringified number"
                          },
                          "totalMarginUsed": {
                            "type": "string",
                            "description": "Total margin used across all positions as a stringified number"
                          },
                          "totalNtlPos": {
                            "type": "string",
                            "description": "Total notional position value as a stringified number"
                          },
                          "totalRawUsd": {
                            "type": "string",
                            "description": "Total raw USD value as a stringified number"
                          }
                        },
                        "description": "Summary of margin metrics"
                      },
                      "crossMarginSummary": {
                        "type": "object",
                        "description": "Summary of cross-margin metrics with identical structure to marginSummary"
                      },
                      "crossMaintenanceMarginUsed": {
                        "type": "string",
                        "description": "Cross maintenance margin used as a stringified number"
                      },
                      "withdrawable": {
                        "type": "string",
                        "description": "Amount available for withdrawal as a stringified number"
                      },
                      "assetPositions": {
                        "type": "array",
                        "items": {
                          "type": "object",
                          "properties": {
                            "position": {
                              "type": "object",
                              "properties": {
                                "coin": {
                                  "type": "string",
                                  "description": "Asset symbol (e.g., BTC, ETH)"
                                },
                                "entryPx": {
                                  "type": "string",
                                  "description": "Entry price as a stringified number"
                                },
                                "leverage": {
                                  "type": "object",
                                  "description": "Leverage settings for the position"
                                },
                                "liquidationPx": {
                                  "type": "string",
                                  "description": "Liquidation price as a stringified number"
                                },
                                "marginUsed": {
                                  "type": "string",
                                  "description": "Margin used for this position as a stringified number"
                                },
                                "unrealizedPnl": {
                                  "type": "string",
                                  "description": "Unrealized profit and loss as a stringified number"
                                }
                              },
                              "description": "Individual asset position data"
                            }
                          }
                        },
                        "description": "Array of position objects for each asset"
                      },
                      "time": {
                        "type": "integer",
                        "description": "Timestamp in milliseconds since Unix epoch"
                      }
                    },
                    "description": "Clearinghouse state data. Structure depends on dex parameter. Each clearinghouse state contains the following fields"
                  }
                }
              },
              "description": "Array of [address, data] tuples. When dex parameter is omitted: data is a clearinghouseState object. When dex='ALL_DEXES': data is an object keyed by DEX names (native, xyz, flx, vntl, hyna, km, abcd, cash, para), where each value is a clearinghouseState object"
            },
            "failed_wallets": {
              "type": "array",
              "items": {
                "type": "object",
                "properties": {
                  "address": {
                    "type": "string",
                    "description": "Ethereum wallet address that failed (0x-prefixed)"
                  }
                }
              },
              "description": "Array of wallet addresses that could not be fetched"
            }
          }
        }
      },
      "tags": [
        {
          "name": "hl"
        }
      ],
      "externalDocs": {
        "description": "Quicknode docs",
        "url": "https://www.quicknode.com/docs/hyperliquid/json-rpc/hl_batchClearinghouseStates"
      }
    },
    {
      "name": "hl_batchOpenOrders",
      "summary": "Retrieves open orders for multiple user addresses in a single batch request.",
      "description": "Retrieves open orders for multiple user addresses in a single batch request.",
      "params": [
        {
          "name": "users",
          "description": "Array of user wallet addresses (0x-prefixed hex strings) to query for open orders. Maximum of 100 addresses per request.",
          "required": true,
          "schema": {
            "type": "array",
            "items": {}
          }
        }
      ],
      "result": {
        "name": "result",
        "description": "Result payload containing successful and failed wallet queries",
        "schema": {
          "type": "object",
          "properties": {
            "successful_states": {
              "type": "array",
              "items": {
                "type": "object",
                "properties": {
                  "address": {
                    "type": "string",
                    "description": "User wallet address as a 0x-prefixed hex string"
                  },
                  "orders": {
                    "type": "array",
                    "items": {
                      "type": "object",
                      "properties": {
                        "coin": {
                          "type": "string",
                          "description": "Instrument symbol (e.g., HYPE, BTC, @294)"
                        },
                        "side": {
                          "type": "string",
                          "description": "Order side: A for Ask (sell) or B for Bid (buy)"
                        },
                        "limitPx": {
                          "type": "string",
                          "description": "Limit price as a stringified number"
                        },
                        "sz": {
                          "type": "string",
                          "description": "Current order size/quantity as a stringified number"
                        },
                        "oid": {
                          "type": "integer",
                          "description": "Order identifier"
                        },
                        "timestamp": {
                          "type": "integer",
                          "description": "Order timestamp in milliseconds since Unix epoch"
                        },
                        "origSz": {
                          "type": "string",
                          "description": "Original order size/quantity as a stringified number"
                        }
                      }
                    },
                    "description": "Array of open order objects for this address"
                  }
                }
              },
              "description": "Array of tuples containing wallet address and their open orders"
            },
            "failed_wallets": {
              "type": "array",
              "items": {},
              "description": "Array of wallet addresses that failed to be queried"
            }
          }
        }
      },
      "tags": [
        {
          "name": "hl"
        }
      ],
      "externalDocs": {
        "description": "Quicknode docs",
        "url": "https://www.quicknode.com/docs/hyperliquid/json-rpc/hl_batchOpenOrders"
      }
    },
    {
      "name": "hl_batchPortfolioStates",
      "summary": "Retrieves complete portfolio states (perp positions, spot balances, and account abstraction mode) for multiple users sim",
      "description": "Retrieves complete portfolio states (perp positions, spot balances, and account abstraction mode) for multiple users simultaneously. Maximum of 500 users per request",
      "params": [
        {
          "name": "users",
          "description": "Array of Ethereum wallet addresses (0x-prefixed, 42 characters each). Maximum 500 addresses",
          "required": true,
          "schema": {
            "type": "array",
            "items": {}
          }
        },
        {
          "name": "dex",
          "description": "Optional. Omit for native DEX only, or use 'ALL_DEXES' to fetch data across all dexes. When using ALL_DEXES, each clearinghouse state will be organized by DEX name (native, xyz, flx, vntl, hyna, km, abcd, cash, para)",
          "schema": {
            "type": "string"
          }
        }
      ],
      "result": {
        "name": "result",
        "description": "Batch response containing successful portfolio states and failed wallets",
        "schema": {
          "type": "object",
          "properties": {
            "successful_states": {
              "type": "array",
              "items": {
                "type": "object",
                "properties": {
                  "address": {
                    "type": "string",
                    "description": "Ethereum wallet address (0x-prefixed)"
                  },
                  "data": {
                    "type": "object",
                    "properties": {
                      "clearinghouseState": {
                        "type": "object",
                        "properties": {
                          "marginSummary": {
                            "type": "object",
                            "properties": {
                              "accountValue": {
                                "type": "string",
                                "description": "Total account value as a stringified number"
                              },
                              "totalMarginUsed": {
                                "type": "string",
                                "description": "Total margin used across all positions as a stringified number"
                              },
                              "totalNtlPos": {
                                "type": "string",
                                "description": "Total notional position value as a stringified number"
                              },
                              "totalRawUsd": {
                                "type": "string",
                                "description": "Total raw USD value as a stringified number"
                              },
                              "withdrawable": {
                                "type": "string",
                                "description": "Amount available for withdrawal as a stringified number"
                              }
                            },
                            "description": "Summary of margin metrics"
                          },
                          "crossMarginSummary": {
                            "type": "object",
                            "description": "Summary of cross-margin metrics with identical structure to marginSummary"
                          },
                          "assetPositions": {
                            "type": "array",
                            "items": {
                              "type": "object",
                              "properties": {
                                "position": {
                                  "type": "object",
                                  "properties": {
                                    "coin": {
                                      "type": "string",
                                      "description": "Asset symbol (e.g., BTC, ETH)"
                                    },
                                    "entryPx": {
                                      "type": "string",
                                      "description": "Entry price as a stringified number"
                                    },
                                    "leverage": {
                                      "type": "object",
                                      "description": "Leverage settings for the position"
                                    },
                                    "liquidationPx": {
                                      "type": "string",
                                      "description": "Liquidation price as a stringified number"
                                    },
                                    "marginUsed": {
                                      "type": "string",
                                      "description": "Margin used for this position as a stringified number"
                                    },
                                    "unrealizedPnl": {
                                      "type": "string",
                                      "description": "Unrealized profit and loss as a stringified number"
                                    }
                                  },
                                  "description": "Individual asset position data"
                                }
                              }
                            },
                            "description": "Array of position objects for each asset"
                          },
                          "time": {
                            "type": "integer",
                            "description": "Timestamp in milliseconds since Unix epoch"
                          }
                        },
                        "description": "When dex parameter is omitted: a single clearinghouse state object. When dex='ALL_DEXES': an object keyed by DEX names (native, xyz, flx, vntl, hyna, km, abcd, cash, para), where each value is a clearinghouse state object"
                      },
                      "spotClearinghouseState": {
                        "type": "object",
                        "properties": {
                          "balances": {
                            "type": "array",
                            "items": {
                              "type": "object",
                              "properties": {
                                "coin": {
                                  "type": "string",
                                  "description": "Coin symbol"
                                },
                                "token": {
                                  "type": "integer",
                                  "description": "Token index"
                                },
                                "total": {
                                  "type": "string",
                                  "description": "Total balance as a stringified number"
                                },
                                "hold": {
                                  "type": "string",
                                  "description": "Amount on hold as a stringified number"
                                },
                                "entryNtl": {
                                  "type": "string",
                                  "description": "Entry notional as a stringified number"
                                }
                              }
                            },
                            "description": "Array of spot balance objects"
                          },
                          "tokenToAvailableAfterMaintenance": {
                            "type": "array",
                            "items": {},
                            "description": "Array of [token_index, available_amount] tuples showing available balance after maintenance requirements for each token"
                          }
                        },
                        "description": "Spot clearinghouse state containing balances and available amounts after maintenance"
                      },
                      "userAbstraction": {
                        "type": "string",
                        "description": "Account mode: unifiedAccount, portfolioMargin, disabled, default, or dexAbstraction"
                      }
                    },
                    "description": "Portfolio state data. Structure depends on dex parameter"
                  }
                }
              },
              "description": "Array of [address, data] tuples. When dex parameter is omitted: data is a portfolioState object. When dex='ALL_DEXES': data is an object where clearinghouseState is keyed by DEX names (native, xyz, flx, vntl, hyna, km, abcd, cash, para), with each value being a clearinghouseState object"
            },
            "failed_wallets": {
              "type": "array",
              "items": {
                "type": "object",
                "properties": {
                  "address": {
                    "type": "string",
                    "description": "Ethereum wallet address that failed (0x-prefixed)"
                  }
                }
              },
              "description": "Array of wallet addresses that could not be fetched"
            }
          }
        }
      },
      "tags": [
        {
          "name": "hl"
        }
      ],
      "externalDocs": {
        "description": "Quicknode docs",
        "url": "https://www.quicknode.com/docs/hyperliquid/json-rpc/hl_batchPortfolioStates"
      }
    },
    {
      "name": "hl_getBatchBlocks",
      "summary": "Retrieves a batch of blocks from a specified Hyperliquid stream within a block range.",
      "description": "Retrieves a batch of blocks from a specified Hyperliquid stream within a block range.",
      "params": [
        {
          "name": "stream",
          "description": "The stream type to query (trades, orders, events, book, twap, writer_actions)",
          "required": true,
          "schema": {
            "type": "string"
          }
        },
        {
          "name": "from",
          "description": "Starting block number (inclusive)",
          "required": true,
          "schema": {
            "type": "integer"
          }
        },
        {
          "name": "to",
          "description": "Ending block number (inclusive)",
          "required": true,
          "schema": {
            "type": "integer"
          }
        }
      ],
      "result": {
        "name": "result",
        "description": "Result payload containing the requested blocks",
        "schema": {
          "type": "object",
          "properties": {
            "blocks": {
              "type": "array",
              "items": {
                "type": "object",
                "properties": {
                  "block_number": {
                    "type": "integer",
                    "description": "Block number on the Hyperliquid chain"
                  },
                  "block_time": {
                    "type": "string",
                    "description": "Block timestamp in ISO 8601 format"
                  },
                  "local_time": {
                    "type": "string",
                    "description": "Local server timestamp in ISO 8601 format"
                  },
                  "events": {
                    "type": "array",
                    "items": {
                      "type": "object",
                      "properties": {
                        "address": {
                          "type": "string",
                          "description": "Event address as a 0x-prefixed hex string"
                        },
                        "payload": {
                          "type": "object",
                          "properties": {
                            "coin": {
                              "type": "string",
                              "description": "Instrument symbol (e.g., HYPE, BTC, SUI, XRP, xyz:HOOD, xyz:XYZ100, @198)"
                            },
                            "px": {
                              "type": "string",
                              "description": "Execution price as a stringified number"
                            },
                            "sz": {
                              "type": "string",
                              "description": "Execution size/quantity as a stringified number"
                            },
                            "side": {
                              "type": "string",
                              "description": "Trade side indicator (e.g., B or A)"
                            },
                            "time": {
                              "type": "integer",
                              "description": "Event timestamp in milliseconds since Unix epoch"
                            },
                            "startPosition": {
                              "type": "string",
                              "description": "Position size before the event as a stringified number"
                            },
                            "dir": {
                              "type": "string",
                              "description": "Action direction describing the position change (e.g., Open Long, Open Short, Close Long, Close Short, Buy, Sell, Long > Short, Short > Long)"
                            },
                            "closedPnl": {
                              "type": "string",
                              "description": "Realized PnL from this event as a stringified number"
                            },
                            "hash": {
                              "type": "string",
                              "description": "Transaction hash as a 0x-prefixed hex string"
                            },
                            "oid": {
                              "type": "integer",
                              "description": "Order identifier"
                            },
                            "crossed": {
                              "type": "boolean",
                              "description": "Whether the order crossed the book"
                            },
                            "fee": {
                              "type": "string",
                              "description": "Fee amount as a stringified number (can be negative depending on rebates)"
                            },
                            "feeToken": {
                              "type": "string",
                              "description": "Token symbol used for fees (e.g., USDC, WOULD)"
                            },
                            "tid": {
                              "type": "integer",
                              "description": "Trade identifier"
                            },
                            "twapId": {
                              "type": "integer",
                              "description": "TWAP identifier if the event is associated with a TWAP; otherwise null"
                            },
                            "cloid": {
                              "type": "string",
                              "description": "Client order identifier"
                            },
                            "builder": {
                              "type": "string",
                              "description": "Builder address as a 0x-prefixed hex string"
                            },
                            "builderFee": {
                              "type": "string",
                              "description": "Builder fee amount as a stringified number"
                            }
                          },
                          "description": "Event payload data"
                        }
                      }
                    },
                    "description": "List of events in this block; each event is a 2-item tuple of [address, payload]"
                  }
                }
              },
              "description": "Array of block objects within the specified range"
            }
          }
        }
      },
      "tags": [
        {
          "name": "hl"
        }
      ],
      "externalDocs": {
        "description": "Quicknode docs",
        "url": "https://www.quicknode.com/docs/hyperliquid/json-rpc/hl_getBatchBlocks"
      }
    },
    {
      "name": "hl_getBlock",
      "summary": "Retrieves a specific block from a Hyperliquid stream by block number.",
      "description": "Retrieves a specific block from a Hyperliquid stream by block number.",
      "params": [
        {
          "name": "stream",
          "description": "The stream type to query (trades, orders, events, book, twap, writer_actions)",
          "required": true,
          "schema": {
            "type": "string"
          }
        },
        {
          "name": "block",
          "description": "The specific block number to retrieve",
          "required": true,
          "schema": {
            "type": "integer"
          }
        }
      ],
      "result": {
        "name": "result",
        "description": "The requested block object",
        "schema": {
          "type": "object",
          "properties": {
            "block_number": {
              "type": "integer",
              "description": "Block number on the Hyperliquid chain"
            },
            "block_time": {
              "type": "string",
              "description": "Block timestamp in ISO 8601 format"
            },
            "local_time": {
              "type": "string",
              "description": "Local server timestamp in ISO 8601 format"
            },
            "events": {
              "type": "array",
              "items": {
                "type": "object",
                "properties": {
                  "address": {
                    "type": "string",
                    "description": "Event address as a 0x-prefixed hex string"
                  },
                  "payload": {
                    "type": "object",
                    "properties": {
                      "builder": {
                        "type": "string",
                        "description": "Builder address as a 0x-prefixed hex string (only present for some events)"
                      },
                      "builderFee": {
                        "type": "string",
                        "description": "Builder fee amount as a stringified number (only present for some events)"
                      },
                      "cloid": {
                        "type": "string",
                        "description": "Client order identifier (only present for some events)"
                      },
                      "closedPnl": {
                        "type": "string",
                        "description": "Realized PnL from this event as a stringified number"
                      },
                      "coin": {
                        "type": "string",
                        "description": "Instrument symbol (e.g., BTC, xyz:XYZ100, xyz:HOOD)"
                      },
                      "crossed": {
                        "type": "boolean",
                        "description": "Whether the order crossed the book"
                      },
                      "dir": {
                        "type": "string",
                        "description": "Action direction describing the position change (e.g., Open Long, Open Short, Close Long, Close Short, Short > Long, Long > Short)"
                      },
                      "fee": {
                        "type": "string",
                        "description": "Fee amount as a stringified number (can be negative depending on rebates)"
                      },
                      "feeToken": {
                        "type": "string",
                        "description": "Token symbol used for fees (e.g., USDC)"
                      },
                      "hash": {
                        "type": "string",
                        "description": "Transaction hash as a 0x-prefixed hex string"
                      },
                      "oid": {
                        "type": "integer",
                        "description": "Order identifier"
                      },
                      "px": {
                        "type": "string",
                        "description": "Execution price as a stringified number"
                      },
                      "side": {
                        "type": "string",
                        "description": "Trade side indicator (e.g., B or A)"
                      },
                      "startPosition": {
                        "type": "string",
                        "description": "Position size before the event as a stringified number"
                      },
                      "sz": {
                        "type": "string",
                        "description": "Execution size/quantity as a stringified number"
                      },
                      "tid": {
                        "type": "integer",
                        "description": "Trade identifier"
                      },
                      "time": {
                        "type": "integer",
                        "description": "Event timestamp in milliseconds since Unix epoch"
                      },
                      "twapId": {
                        "type": "integer",
                        "description": "TWAP identifier if the event is associated with a TWAP; null if not associated with a TWAP"
                      }
                    },
                    "description": "Event payload data"
                  }
                }
              },
              "description": "List of events in this block; each event is a 2-item tuple of [address, payload]"
            }
          }
        }
      },
      "tags": [
        {
          "name": "hl"
        }
      ],
      "externalDocs": {
        "description": "Quicknode docs",
        "url": "https://www.quicknode.com/docs/hyperliquid/json-rpc/hl_getBlock"
      }
    },
    {
      "name": "hl_getLatestBlockNumber",
      "summary": "Retrieves the latest block number for a specified Hyperliquid stream.",
      "description": "Retrieves the latest block number for a specified Hyperliquid stream.",
      "params": [
        {
          "name": "stream",
          "description": "The stream type to query (trades, orders, events, book, twap, writer_actions)",
          "required": true,
          "schema": {
            "type": "string"
          }
        }
      ],
      "result": {
        "name": "result",
        "description": "The latest block number for the specified stream",
        "schema": {
          "type": "integer"
        }
      },
      "tags": [
        {
          "name": "hl"
        }
      ],
      "externalDocs": {
        "description": "Quicknode docs",
        "url": "https://www.quicknode.com/docs/hyperliquid/json-rpc/hl_getLatestBlockNumber"
      }
    },
    {
      "name": "hl_getLatestBlocks",
      "summary": "Retrieves the latest blocks for a specified Hyperliquid stream type (trades, orders, events, book, twap)",
      "description": "Retrieves the latest blocks for a specified Hyperliquid stream type (trades, orders, events, book, twap)",
      "params": [
        {
          "name": "stream",
          "description": "The stream type to query (trades, orders, events, book, twap, writer_actions)",
          "required": true,
          "schema": {
            "type": "string"
          }
        },
        {
          "name": "count",
          "description": "Number of latest blocks to retrieve",
          "required": true,
          "schema": {
            "type": "integer"
          }
        }
      ],
      "result": {
        "name": "result",
        "description": "Result payload containing the latest blocks",
        "schema": {
          "type": "object",
          "properties": {
            "blocks": {
              "type": "array",
              "items": {
                "type": "object",
                "properties": {
                  "local_time": {
                    "type": "string",
                    "description": "Local server timestamp in ISO 8601 format"
                  },
                  "block_time": {
                    "type": "string",
                    "description": "Block timestamp in ISO 8601 format"
                  },
                  "block_number": {
                    "type": "integer",
                    "description": "Block number on the Hyperliquid chain"
                  },
                  "events": {
                    "type": "array",
                    "items": {
                      "type": "object",
                      "properties": {
                        "address": {
                          "type": "string",
                          "description": "Event address as a 0x-prefixed hex string"
                        },
                        "object": {
                          "type": "object",
                          "properties": {
                            "coin": {
                              "type": "string",
                              "description": "Instrument symbol (e.g., ETH, BTC, PAXG, xyz:AMZN, hyna:ZEC, @142)"
                            },
                            "px": {
                              "type": "string",
                              "description": "Execution price as a stringified number"
                            },
                            "sz": {
                              "type": "string",
                              "description": "Execution size/quantity as a stringified number"
                            },
                            "side": {
                              "type": "string",
                              "description": "Trade side indicator (e.g., B or A)"
                            },
                            "time": {
                              "type": "integer",
                              "description": "Event timestamp in milliseconds since Unix epoch"
                            },
                            "startPosition": {
                              "type": "string",
                              "description": "Position size before the event as a stringified number"
                            },
                            "dir": {
                              "type": "string",
                              "description": "Action direction describing the position change (e.g., Open Long, Open Short, Close Long, Close Short, Buy, Sell)"
                            },
                            "closedPnl": {
                              "type": "string",
                              "description": "Realized PnL from this event as a stringified number"
                            },
                            "hash": {
                              "type": "string",
                              "description": "Transaction hash as a 0x-prefixed hex string"
                            },
                            "oid": {
                              "type": "integer",
                              "description": "Order identifier"
                            },
                            "crossed": {
                              "type": "boolean",
                              "description": "Whether the order crossed the book"
                            },
                            "fee": {
                              "type": "string",
                              "description": "Fee amount as a stringified number (can be negative depending on rebates)"
                            },
                            "tid": {
                              "type": "integer",
                              "description": "Trade identifier"
                            },
                            "feeToken": {
                              "type": "string",
                              "description": "Token symbol used for fees (e.g., USDC, USDE)"
                            },
                            "twapId": {
                              "type": [
                                "integer",
                                "null"
                              ],
                              "description": "TWAP identifier if the event is associated with a TWAP; otherwise null"
                            },
                            "cloid": {
                              "type": "string",
                              "description": "Client order identifier"
                            },
                            "builderFee": {
                              "type": "string",
                              "description": "Builder fee amount as a stringified number"
                            },
                            "builder": {
                              "type": "string",
                              "description": "Builder address as a 0x-prefixed hex string"
                            }
                          },
                          "description": "Event payload data object which contains the following fields:"
                        }
                      }
                    },
                    "description": "List of events in this block; each event is a 2-item tuple of [address, payload]"
                  }
                }
              },
              "description": "Array of block objects from the specified stream"
            }
          }
        }
      },
      "tags": [
        {
          "name": "hl"
        }
      ],
      "externalDocs": {
        "description": "Quicknode docs",
        "url": "https://www.quicknode.com/docs/hyperliquid/json-rpc/hl_getLatestBlocks"
      }
    },
    {
      "name": "hl_portfolioState",
      "summary": "Retrieves clearinghouse state (perp positions), spot clearinghouse state (spot balances), and account abstraction mode f",
      "description": "Retrieves clearinghouse state (perp positions), spot clearinghouse state (spot balances), and account abstraction mode for a single user in one request",
      "params": [
        {
          "name": "user",
          "description": "Ethereum wallet address (0x-prefixed, 42 characters)",
          "required": true,
          "schema": {
            "type": "string"
          }
        },
        {
          "name": "dex",
          "description": "Optional. Omit for native DEX only, or use 'ALL_DEXES' to fetch data across all dexes. When using ALL_DEXES, clearinghouseState will be organized by DEX name (native, xyz, flx, vntl, hyna, km, abcd, cash, para)",
          "schema": {
            "type": "string"
          }
        }
      ],
      "result": {
        "name": "result",
        "description": "Portfolio state containing perp positions, spot balances, and account mode",
        "schema": {
          "type": "object",
          "properties": {
            "clearinghouseState": {
              "type": "object",
              "properties": {
                "dexName (when using ALL_DEXES)": {
                  "type": "object",
                  "properties": {
                    "marginSummary": {
                      "type": "object",
                      "properties": {
                        "accountValue": {
                          "type": "string",
                          "description": "Total account value as a stringified number"
                        },
                        "totalNtlPos": {
                          "type": "string",
                          "description": "Total notional position value as a stringified number"
                        },
                        "totalRawUsd": {
                          "type": "string",
                          "description": "Total raw USD value as a stringified number"
                        },
                        "totalMarginUsed": {
                          "type": "string",
                          "description": "Total margin used across all positions as a stringified number"
                        }
                      },
                      "description": "Summary of margin metrics"
                    },
                    "crossMarginSummary": {
                      "type": "object",
                      "properties": {
                        "accountValue": {
                          "type": "string",
                          "description": "Total account value as a stringified number"
                        },
                        "totalNtlPos": {
                          "type": "string",
                          "description": "Total notional position value as a stringified number"
                        },
                        "totalRawUsd": {
                          "type": "string",
                          "description": "Total raw USD value as a stringified number"
                        },
                        "totalMarginUsed": {
                          "type": "string",
                          "description": "Total margin used across all positions as a stringified number"
                        }
                      },
                      "description": "Summary of cross-margin metrics with same structure as marginSummary"
                    },
                    "crossMaintenanceMarginUsed": {
                      "type": "string",
                      "description": "Cross maintenance margin used as a stringified number"
                    },
                    "withdrawable": {
                      "type": "string",
                      "description": "Amount available for withdrawal as a stringified number"
                    },
                    "assetPositions": {
                      "type": "array",
                      "items": {
                        "type": "object",
                        "properties": {
                          "assetPosition": {
                            "type": "object",
                            "properties": {
                              "type": {
                                "type": "string",
                                "description": "Position type (e.g., oneWay)"
                              },
                              "position": {
                                "type": "object",
                                "properties": {
                                  "coin": {
                                    "type": "string",
                                    "description": "Asset symbol (e.g., BTC, ETH, HYPE). For non-native DEXes, prefixed with dex name (e.g., flx:USDE)"
                                  },
                                  "szi": {
                                    "type": "string",
                                    "description": "Signed position size as a stringified number (negative for short, positive for long)"
                                  },
                                  "leverage": {
                                    "type": "object",
                                    "properties": {
                                      "type": {
                                        "type": "string",
                                        "description": "Leverage type (e.g., cross, isolated)"
                                      },
                                      "value": {
                                        "type": "integer",
                                        "description": "Leverage multiplier value"
                                      }
                                    },
                                    "description": "Leverage configuration"
                                  },
                                  "entryPx": {
                                    "type": "string",
                                    "description": "Entry price as a stringified number"
                                  },
                                  "positionValue": {
                                    "type": "string",
                                    "description": "Current position value as a stringified number"
                                  },
                                  "unrealizedPnl": {
                                    "type": "string",
                                    "description": "Unrealized profit and loss as a stringified number"
                                  },
                                  "returnOnEquity": {
                                    "type": "string",
                                    "description": "Return on equity as a stringified number"
                                  },
                                  "liquidationPx": {
                                    "type": "string",
                                    "description": "Liquidation price as a stringified number"
                                  },
                                  "marginUsed": {
                                    "type": "string",
                                    "description": "Margin used for this position as a stringified number"
                                  },
                                  "maxLeverage": {
                                    "type": "integer",
                                    "description": "Maximum allowed leverage for this asset"
                                  },
                                  "cumFunding": {
                                    "type": "object",
                                    "properties": {
                                      "allTime": {
                                        "type": "string",
                                        "description": "All-time cumulative funding as a stringified number"
                                      },
                                      "sinceOpen": {
                                        "type": "string",
                                        "description": "Cumulative funding since position opened as a stringified number"
                                      },
                                      "sinceChange": {
                                        "type": "string",
                                        "description": "Cumulative funding since last position change as a stringified number"
                                      }
                                    },
                                    "description": "Cumulative funding information"
                                  }
                                },
                                "description": "Position details"
                              }
                            },
                            "description": "Asset position wrapper"
                          }
                        }
                      },
                      "description": "Array of asset position objects"
                    },
                    "time": {
                      "type": "integer",
                      "description": "Timestamp in milliseconds since Unix epoch"
                    }
                  },
                  "description": "DEX-specific clearinghouse state (e.g., native, xyz, flx). Each DEX contains the following structure"
                }
              },
              "description": "When dex parameter is omitted: returns clearinghouse state object directly with keys marginSummary, crossMarginSummary, crossMaintenanceMarginUsed, withdrawable, assetPositions, time. When dex='ALL_DEXES': returns an object keyed by DEX names (native, xyz, flx, vntl, hyna, km, abcd, cash, para), where each value is a clearinghouse state object with the same structure"
            },
            "spotClearinghouseState": {
              "type": "object",
              "properties": {
                "balances": {
                  "type": "array",
                  "items": {
                    "type": "object",
                    "properties": {
                      "balance": {
                        "type": "object",
                        "properties": {
                          "coin": {
                            "type": "string",
                            "description": "Coin symbol (e.g., USDC, HYPE, USDE)"
                          },
                          "token": {
                            "type": "integer",
                            "description": "Token index number"
                          },
                          "total": {
                            "type": "string",
                            "description": "Total balance as a stringified number"
                          },
                          "hold": {
                            "type": "string",
                            "description": "Amount on hold as a stringified number"
                          },
                          "entryNtl": {
                            "type": "string",
                            "description": "Entry notional value as a stringified number"
                          }
                        },
                        "description": "Individual spot balance data"
                      }
                    }
                  },
                  "description": "Array of spot balance objects"
                },
                "tokenToAvailableAfterMaintenance": {
                  "type": "array",
                  "items": {
                    "type": "object",
                    "properties": {
                      "tuple": {
                        "type": "array",
                        "items": {
                          "type": "object",
                          "properties": {
                            "tokenId": {
                              "type": "integer",
                              "description": "Token index number"
                            },
                            "availableAmount": {
                              "type": "string",
                              "description": "Available amount after maintenance margin as a stringified number"
                            }
                          }
                        },
                        "description": "[tokenId, availableAmount] tuple"
                      }
                    }
                  },
                  "description": "Array of [tokenId, availableAmount] tuples showing available balance after maintenance margin"
                }
              },
              "description": "Spot balances and available amounts"
            },
            "userAbstraction": {
              "type": "string",
              "description": "Account mode: unifiedAccount, portfolioMargin, disabled, default, or dexAbstraction"
            }
          }
        }
      },
      "tags": [
        {
          "name": "hl"
        }
      ],
      "externalDocs": {
        "description": "Quicknode docs",
        "url": "https://www.quicknode.com/docs/hyperliquid/json-rpc/hl_portfolioState"
      }
    },
    {
      "name": "hl_subscribe",
      "summary": "Subscribes to real-time updates from a specified Hyperliquid stream via WebSocket using JSON-RPC protocol.",
      "description": "Subscribes to real-time updates from a specified Hyperliquid stream via WebSocket using JSON-RPC protocol.",
      "params": [
        {
          "name": "streamType",
          "description": "Stream type to subscribe to: 'trades' (executed trades), 'orders' (order statuses - high volume), 'book_updates' (order book updates), 'twap' (TWAP history), 'events' (liquidations, transfers), 'writer_actions' (writer action events)",
          "required": true,
          "schema": {
            "type": "string"
          }
        },
        {
          "name": "filters",
          "description": "Optional filters to apply to the stream. Each field maps directly to an array of filter values.",
          "schema": {
            "type": "object"
          }
        },
        {
          "name": "filterName",
          "description": "Optional name for this filter set (enables OR logic and named unsubscribe)",
          "schema": {
            "type": "string"
          }
        }
      ],
      "result": {
        "name": "result",
        "description": "On subscribe: a confirmation object with a subscribed key. Afterwards, the server pushes data messages with the following shape for each new block containing stream events",
        "schema": {
          "type": "object",
          "properties": {
            "type": {
              "type": "string",
              "description": "Message type; always \"data\" for stream events"
            },
            "stream": {
              "type": "string",
              "description": "Stream identifier for the subscribed stream. One of: \"hl.trades\", \"hl.orders\", \"hl.book_updates\", \"hl.twap\", \"hl.events\", \"hl.writer_actions\""
            },
            "block": {
              "type": "object",
              "properties": {
                "local_time": {
                  "type": "string",
                  "description": "Server-side receive timestamp in ISO 8601 format with nanosecond precision"
                },
                "block_time": {
                  "type": "string",
                  "description": "Chain block timestamp in ISO 8601 format with nanosecond precision"
                },
                "block_number": {
                  "type": "integer",
                  "description": "Hyperliquid block height"
                },
                "events": {
                  "type": "array",
                  "items": {},
                  "description": "Stream events for this block. Event format varies by stream type — see the datasets documentation for per-stream field definitions"
                }
              },
              "description": "Block envelope containing stream events for this block"
            }
          }
        }
      },
      "tags": [
        {
          "name": "hl"
        }
      ],
      "externalDocs": {
        "description": "Quicknode docs",
        "url": "https://www.quicknode.com/docs/hyperliquid/json-rpc/hl_subscribe"
      }
    },
    {
      "name": "hl_unsubscribe",
      "summary": "Unsubscribes from specified Hyperliquid streams or named filters via WebSocket.",
      "description": "Unsubscribes from specified Hyperliquid streams or named filters via WebSocket.",
      "params": [
        {
          "name": "streamType",
          "description": "Stream type to unsubscribe from: 'trades', 'orders', 'book_updates', 'twap', 'events', 'writer_actions'",
          "schema": {
            "type": "string"
          }
        },
        {
          "name": "filterName",
          "description": "Name of the specific filter to unsubscribe from (if subscription was created with a filterName)",
          "schema": {
            "type": "string"
          }
        }
      ],
      "result": {
        "name": "result",
        "description": "Returns confirmation of successfully unsubscribed stream or filter",
        "schema": {
          "type": "object"
        }
      },
      "tags": [
        {
          "name": "hl"
        }
      ],
      "externalDocs": {
        "description": "Quicknode docs",
        "url": "https://www.quicknode.com/docs/hyperliquid/json-rpc/hl_unsubscribe"
      }
    }
  ],
  "servers": [
    {
      "name": "HyperCore JSON-RPC API",
      "url": "https://docs-demo.hype-mainnet.quiknode.pro/hypercore"
    }
  ]
}