# Table of Contents
- [Introduction | Hyperliquid](#introduction-hyperliquid)
- [Connect to Hyperliquid | Hyperliquid](#connect-to-hyperliquid-hyperliquid)
- [Market orders | Hyperliquid](#market-orders-hyperliquid)
- [Utilities | Hyperliquid](#utilities-hyperliquid)
- [Error handling | Hyperliquid](#error-handling-hyperliquid)
- [Agent wallets and vaults | Hyperliquid](#agent-wallets-and-vaults-hyperliquid)
- [Tree-shaking | Hyperliquid](#tree-shaking-hyperliquid)
- [Clients | Hyperliquid](#clients-hyperliquid)
- [Signing | Hyperliquid](#signing-hyperliquid)
- [Browser wallets | Hyperliquid](#browser-wallets-hyperliquid)
- [activeAssetData | Hyperliquid](#activeassetdata-hyperliquid)
- [activeAssetCtx | Hyperliquid](#activeassetctx-hyperliquid)
- [activeSpotAssetCtx | Hyperliquid](#activespotassetctx-hyperliquid)
- [allMids | Hyperliquid](#allmids-hyperliquid)
- [explorerTxs | Hyperliquid](#explorertxs-hyperliquid)
- [bbo | Hyperliquid](#bbo-hyperliquid)
- [assetCtxs | Hyperliquid](#assetctxs-hyperliquid)
- [explorerBlock | Hyperliquid](#explorerblock-hyperliquid)
- [allDexsClearinghouseState | Hyperliquid](#alldexsclearinghousestate-hyperliquid)
- [l2Book | Hyperliquid](#l2book-hyperliquid)
- [clearinghouseState | Hyperliquid](#clearinghousestate-hyperliquid)
- [notification | Hyperliquid](#notification-hyperliquid)
- [openOrders | Hyperliquid](#openorders-hyperliquid)
- [spotState | Hyperliquid](#spotstate-hyperliquid)
- [spotAssetCtxs | Hyperliquid](#spotassetctxs-hyperliquid)
- [trades | Hyperliquid](#trades-hyperliquid)
- [userTwapHistory | Hyperliquid](#usertwaphistory-hyperliquid)
- [candle | Hyperliquid](#candle-hyperliquid)
- [userFills | Hyperliquid](#userfills-hyperliquid)
- [allDexsAssetCtxs | Hyperliquid](#alldexsassetctxs-hyperliquid)
- [webData3 | Hyperliquid](#webdata3-hyperliquid)
- [twapStates | Hyperliquid](#twapstates-hyperliquid)
- [Subscription Methods | Hyperliquid](#subscription-methods-hyperliquid)
- [userHistoricalOrders | Hyperliquid](#userhistoricalorders-hyperliquid)
- [userFundings | Hyperliquid](#userfundings-hyperliquid)
- [userNonFundingLedgerUpdates | Hyperliquid](#usernonfundingledgerupdates-hyperliquid)
- [orderUpdates | Hyperliquid](#orderupdates-hyperliquid)
- [webData2 | Hyperliquid](#webdata2-hyperliquid)
- [userEvents | Hyperliquid](#userevents-hyperliquid)
- [userTwapSliceFills | Hyperliquid](#usertwapslicefills-hyperliquid)
- [activeAssetData | Hyperliquid](#activeassetdata-hyperliquid)
- [approveAgent | Hyperliquid](#approveagent-hyperliquid)
- [Exchange Methods | Hyperliquid](#exchange-methods-hyperliquid)
- [agentSetAbstraction | Hyperliquid](#agentsetabstraction-hyperliquid)
- [agentEnableDexAbstraction | Hyperliquid](#agentenabledexabstraction-hyperliquid)
- [approveBuilderFee | Hyperliquid](#approvebuilderfee-hyperliquid)
- [cDeposit | Hyperliquid](#cdeposit-hyperliquid)
- [cancel | Hyperliquid](#cancel-hyperliquid)
- [linkStakingUser | Hyperliquid](#linkstakinguser-hyperliquid)
- [noop | Hyperliquid](#noop-hyperliquid)
- [claimRewards | Hyperliquid](#claimrewards-hyperliquid)
- [cValidatorAction | Hyperliquid](#cvalidatoraction-hyperliquid)
- [evmUserModify | Hyperliquid](#evmusermodify-hyperliquid)
- [borrowLend | Hyperliquid](#borrowlend-hyperliquid)
- [registerReferrer | Hyperliquid](#registerreferrer-hyperliquid)
- [createSubAccount | Hyperliquid](#createsubaccount-hyperliquid)
- [cWithdraw | Hyperliquid](#cwithdraw-hyperliquid)
- [createVault | Hyperliquid](#createvault-hyperliquid)
- [batchModify | Hyperliquid](#batchmodify-hyperliquid)
- [setReferrer | Hyperliquid](#setreferrer-hyperliquid)
- [modify | Hyperliquid](#modify-hyperliquid)
- [spotSend | Hyperliquid](#spotsend-hyperliquid)
- [reserveRequestWeight | Hyperliquid](#reserverequestweight-hyperliquid)
- [withdraw3 | Hyperliquid](#withdraw3-hyperliquid)
- [convertToMultiSigUser | Hyperliquid](#converttomultisiguser-hyperliquid)
- [scheduleCancel | Hyperliquid](#schedulecancel-hyperliquid)
- [order | Hyperliquid](#order-hyperliquid)
- [setDisplayName | Hyperliquid](#setdisplayname-hyperliquid)
- [cancelByCloid | Hyperliquid](#cancelbycloid-hyperliquid)
- [userDexAbstraction | Hyperliquid](#userdexabstraction-hyperliquid)
- [vaultTransfer | Hyperliquid](#vaulttransfer-hyperliquid)
- [cSignerAction | Hyperliquid](#csigneraction-hyperliquid)
- [sendToEvmWithData | Hyperliquid](#sendtoevmwithdata-hyperliquid)
- [sendAsset | Hyperliquid](#sendasset-hyperliquid)
- [updateIsolatedMargin | Hyperliquid](#updateisolatedmargin-hyperliquid)
- [updateLeverage | Hyperliquid](#updateleverage-hyperliquid)
- [tokenDelegate | Hyperliquid](#tokendelegate-hyperliquid)
- [twapCancel | Hyperliquid](#twapcancel-hyperliquid)
- [vaultDistribute | Hyperliquid](#vaultdistribute-hyperliquid)
- [subAccountTransfer | Hyperliquid](#subaccounttransfer-hyperliquid)
- [spotUser | Hyperliquid](#spotuser-hyperliquid)
- [userPortfolioMargin | Hyperliquid](#userportfoliomargin-hyperliquid)
- [subAccountSpotTransfer | Hyperliquid](#subaccountspottransfer-hyperliquid)
- [validatorL1Stream | Hyperliquid](#validatorl1stream-hyperliquid)
- [userSetAbstraction | Hyperliquid](#usersetabstraction-hyperliquid)
- [spotDeploy | Hyperliquid](#spotdeploy-hyperliquid)
- [twapOrder | Hyperliquid](#twaporder-hyperliquid)
- [usdSend | Hyperliquid](#usdsend-hyperliquid)
- [vaultModify | Hyperliquid](#vaultmodify-hyperliquid)
- [subAccountModify | Hyperliquid](#subaccountmodify-hyperliquid)
- [usdClassTransfer | Hyperliquid](#usdclasstransfer-hyperliquid)
- [perpDeploy | Hyperliquid](#perpdeploy-hyperliquid)
- [topUpIsolatedOnlyMargin | Hyperliquid](#topupisolatedonlymargin-hyperliquid)
- [Info Methods | Hyperliquid](#info-methods-hyperliquid)
- [approvedBuilders | Hyperliquid](#approvedbuilders-hyperliquid)
- [allMids | Hyperliquid](#allmids-hyperliquid)
- [borrowLendReserveState | Hyperliquid](#borrowlendreservestate-hyperliquid)
- [borrowLendUserState | Hyperliquid](#borrowlenduserstate-hyperliquid)
- [candleSnapshot | Hyperliquid](#candlesnapshot-hyperliquid)
- [blockDetails | Hyperliquid](#blockdetails-hyperliquid)
- [delegatorHistory | Hyperliquid](#delegatorhistory-hyperliquid)
- [allBorrowLendReserveStates | Hyperliquid](#allborrowlendreservestates-hyperliquid)
- [allPerpMetas | Hyperliquid](#allperpmetas-hyperliquid)
- [exchangeStatus | Hyperliquid](#exchangestatus-hyperliquid)
- [delegatorRewards | Hyperliquid](#delegatorrewards-hyperliquid)
- [alignedQuoteTokenInfo | Hyperliquid](#alignedquotetokeninfo-hyperliquid)
- [delegatorSummary | Hyperliquid](#delegatorsummary-hyperliquid)
- [extraAgents | Hyperliquid](#extraagents-hyperliquid)
- [fundingHistory | Hyperliquid](#fundinghistory-hyperliquid)
- [gossipRootIps | Hyperliquid](#gossiprootips-hyperliquid)
- [clearinghouseState | Hyperliquid](#clearinghousestate-hyperliquid)
- [legalCheck | Hyperliquid](#legalcheck-hyperliquid)
- [isVip | Hyperliquid](#isvip-hyperliquid)
- [marginTable | Hyperliquid](#margintable-hyperliquid)
- [delegations | Hyperliquid](#delegations-hyperliquid)
- [frontendOpenOrders | Hyperliquid](#frontendopenorders-hyperliquid)
- [historicalOrders | Hyperliquid](#historicalorders-hyperliquid)
- [leadingVaults | Hyperliquid](#leadingvaults-hyperliquid)
- [liquidatable | Hyperliquid](#liquidatable-hyperliquid)
- [maxBuilderFee | Hyperliquid](#maxbuilderfee-hyperliquid)
- [maxMarketOrderNtls | Hyperliquid](#maxmarketorderntls-hyperliquid)
- [perpDexStatus | Hyperliquid](#perpdexstatus-hyperliquid)
- [predictedFundings | Hyperliquid](#predictedfundings-hyperliquid)
- [openOrders | Hyperliquid](#openorders-hyperliquid)
- [outcomeMeta | Hyperliquid](#outcomemeta-hyperliquid)
- [perpDeployAuctionStatus | Hyperliquid](#perpdeployauctionstatus-hyperliquid)
- [recentTrades | Hyperliquid](#recenttrades-hyperliquid)
- [perpAnnotation | Hyperliquid](#perpannotation-hyperliquid)
- [spotClearinghouseState | Hyperliquid](#spotclearinghousestate-hyperliquid)
- [portfolio | Hyperliquid](#portfolio-hyperliquid)
- [metaAndAssetCtxs | Hyperliquid](#metaandassetctxs-hyperliquid)
- [perpDexLimits | Hyperliquid](#perpdexlimits-hyperliquid)
- [l2Book | Hyperliquid](#l2book-hyperliquid)
- [perpsAtOpenInterestCap | Hyperliquid](#perpsatopeninterestcap-hyperliquid)
- [perpCategories | Hyperliquid](#perpcategories-hyperliquid)
- [spotDeployState | Hyperliquid](#spotdeploystate-hyperliquid)
- [meta | Hyperliquid](#meta-hyperliquid)
- [preTransferCheck | Hyperliquid](#pretransfercheck-hyperliquid)
- [referral | Hyperliquid](#referral-hyperliquid)
- [perpDexs | Hyperliquid](#perpdexs-hyperliquid)
- [orderStatus | Hyperliquid](#orderstatus-hyperliquid)
- [spotMeta | Hyperliquid](#spotmeta-hyperliquid)
- [spotMetaAndAssetCtxs | Hyperliquid](#spotmetaandassetctxs-hyperliquid)
- [spotPairDeployAuctionStatus | Hyperliquid](#spotpairdeployauctionstatus-hyperliquid)
- [validatorL1Votes | Hyperliquid](#validatorl1votes-hyperliquid)
- [userBorrowLendInterest | Hyperliquid](#userborrowlendinterest-hyperliquid)
- [tokenDetails | Hyperliquid](#tokendetails-hyperliquid)
- [subAccounts | Hyperliquid](#subaccounts-hyperliquid)
- [subAccounts2 | Hyperliquid](#subaccounts2-hyperliquid)
- [userDexAbstraction | Hyperliquid](#userdexabstraction-hyperliquid)
- [txDetails | Hyperliquid](#txdetails-hyperliquid)
- [userVaultEquities | Hyperliquid](#uservaultequities-hyperliquid)
- [userFillsByTime | Hyperliquid](#userfillsbytime-hyperliquid)
- [userAbstraction | Hyperliquid](#userabstraction-hyperliquid)
- [userRole | Hyperliquid](#userrole-hyperliquid)
- [userRateLimit | Hyperliquid](#userratelimit-hyperliquid)
- [userDetails | Hyperliquid](#userdetails-hyperliquid)
- [userTwapSliceFills | Hyperliquid](#usertwapslicefills-hyperliquid)
- [userToMultiSigSigners | Hyperliquid](#usertomultisigsigners-hyperliquid)
- [userTwapSliceFillsByTime | Hyperliquid](#usertwapslicefillsbytime-hyperliquid)
- [userFunding | Hyperliquid](#userfunding-hyperliquid)
- [vaultSummaries | Hyperliquid](#vaultsummaries-hyperliquid)
- [userFills | Hyperliquid](#userfills-hyperliquid)
- [userFees | Hyperliquid](#userfees-hyperliquid)
- [twapHistory | Hyperliquid](#twaphistory-hyperliquid)
- [validatorSummaries | Hyperliquid](#validatorsummaries-hyperliquid)
- [vaultDetails | Hyperliquid](#vaultdetails-hyperliquid)
- [userNonFundingLedgerUpdates | Hyperliquid](#usernonfundingledgerupdates-hyperliquid)
- [webData2 | Hyperliquid](#webdata2-hyperliquid)
---
# Introduction | Hyperliquid
A community-supported [Hyperliquid APIarrow-up-right](https://hyperliquid.gitbook.io/hyperliquid-docs/for-developers/api)
SDK for all major JS runtimes, written in TypeScript.
[hashtag](https://nktkas.gitbook.io/hyperliquid#installation)
Installation
-------------------------------------------------------------------------------
npm
pnpm
yarn
bun
deno
CDN
Copy
npm i @nktkas/hyperliquid
Copy
pnpm add @nktkas/hyperliquid
Copy
yarn add @nktkas/hyperliquid
Copy
bun add @nktkas/hyperliquid
Copy
deno add jsr:@nktkas/hyperliquid
Copy
[hashtag](https://nktkas.gitbook.io/hyperliquid#quick-start)
Quick start
-----------------------------------------------------------------------------
InfoClient
ExchangeClient
SubscriptionClient
Read market data, account state, order book. [Learn more](https://nktkas.gitbook.io/hyperliquid/clients#read-data)
Copy
import { HttpTransport, InfoClient } from "@nktkas/hyperliquid";
const transport = new HttpTransport();
const client = new InfoClient({ transport });
const mids = await client.allMids();
Place orders, transfer funds, manage accounts. [Learn more](https://nktkas.gitbook.io/hyperliquid/clients#trading)
Copy
import { ExchangeClient, HttpTransport } from "@nktkas/hyperliquid";
import { privateKeyToAccount } from "viem/accounts";
const wallet = privateKeyToAccount("0x...");
const transport = new HttpTransport();
const client = new ExchangeClient({ transport, wallet });
await client.order({
orders: [{\
a: 0,\
b: true,\
p: "50000",\
s: "0.01",\
r: false,\
t: { limit: { tif: "Gtc" } },\
}],
grouping: "na",
});
Receive real-time updates via WebSocket. [Learn more](https://nktkas.gitbook.io/hyperliquid/clients#real-time-updates)
Copy
import { SubscriptionClient, WebSocketTransport } from "@nktkas/hyperliquid";
const transport = new WebSocketTransport();
const client = new SubscriptionClient({ transport });
await client.allMids((data) => {
console.log(data.mids);
});
[NextConnect to Hyperliquidchevron-right](https://nktkas.gitbook.io/hyperliquid/transports)
Last updated 5 days ago
---
# Connect to Hyperliquid | Hyperliquid
The SDK communicates with Hyperliquid through a transport. Choose HTTP or WebSocket and pass it to any [client](https://nktkas.gitbook.io/hyperliquid/clients)
.
[hashtag](https://nktkas.gitbook.io/hyperliquid/transports#http-vs-websocket)
HTTP vs WebSocket
----------------------------------------------------------------------------------------------------
The following table compares the two transport types:
HTTP
WebSocket
**Best for**
Serverless, simple scripts
Real-time data, low latency
**Connection**
Per-request, stateless
Persistent
**Subscriptions**
No
Required
[hashtag](https://nktkas.gitbook.io/hyperliquid/transports#http)
HTTP
--------------------------------------------------------------------------
Copy
import { HttpTransport, InfoClient } from "@nktkas/hyperliquid";
const transport = new HttpTransport();
const client = new InfoClient({ transport });
const mids = await client.allMids();
Each request is an independent HTTP POST. No connection state to manage, so it works well in serverless functions, edge workers, or unstable networks.
###
[hashtag](https://nktkas.gitbook.io/hyperliquid/transports#endpoints)
Endpoints
Two built-in endpoints: `apiUrl` for info and exchange requests, `rpcUrl` for explorer requests (block details, transactions). The following table lists the default URLs:
Mainnet
Testnet
`apiUrl`
`https://api.hyperliquid.xyz`
`https://api.hyperliquid-testnet.xyz`
`rpcUrl`
`https://rpc.hyperliquid.xyz`
`https://rpc.hyperliquid-testnet.xyz`
Override when running your [own nodearrow-up-right](https://github.com/hyperliquid-dex/node)
or using a proxy:
###
[hashtag](https://nktkas.gitbook.io/hyperliquid/transports#fetch-options)
Fetch options
Pass custom options to the underlying [`fetch`arrow-up-right](https://developer.mozilla.org/en-US/docs/Web/API/Fetch_API)
call, such as headers, credentials, and cache settings.
[hashtag](https://nktkas.gitbook.io/hyperliquid/transports#websocket)
WebSocket
------------------------------------------------------------------------------------
The transport maintains a single persistent connection, required for [subscriptionsarrow-up-right](https://hyperliquid.gitbook.io/hyperliquid-docs/for-developers/api/websocket/subscriptions)
and lower-latency for high-frequency [POST requestsarrow-up-right](https://hyperliquid.gitbook.io/hyperliquid-docs/for-developers/api/websocket/post-requests)
:
###
[hashtag](https://nktkas.gitbook.io/hyperliquid/transports#endpoints-1)
Endpoints
`url` for info, exchange, and subscription requests. Explorer requests (block details, transactions) need a separate transport on the RPC endpoint. The following table lists the default URLs:
Mainnet
Testnet
`url`
`wss://api.hyperliquid.xyz/ws`
`wss://api.hyperliquid-testnet.xyz/ws`
`MAINNET_RPC_WS_URL`
`wss://rpc.hyperliquid.xyz/ws`
`TESTNET_RPC_WS_URL`
`wss://rpc.hyperliquid-testnet.xyz/ws`
Override when running your [own nodearrow-up-right](https://github.com/hyperliquid-dex/node)
or using a proxy:
For explorer, pass the RPC constant as `url`:
###
[hashtag](https://nktkas.gitbook.io/hyperliquid/transports#reconnection)
Reconnection
When the connection drops, the transport reconnects automatically via [`@nktkas/rews`arrow-up-right](https://github.com/nktkas/rews)
:
See [`ReconnectingWebSocketOptions`arrow-up-right](https://github.com/nktkas/rews#options)
for all available options.
* * *
After reconnection, all active subscriptions are restored automatically. Disable this with `resubscribe`:
If a subscription fails to restore, its `failureSignal` is aborted. For details, see [Handle failures](https://nktkas.gitbook.io/hyperliquid/clients#handle-failures)
.
[hashtag](https://nktkas.gitbook.io/hyperliquid/transports#common-options)
Common options
----------------------------------------------------------------------------------------------
###
[hashtag](https://nktkas.gitbook.io/hyperliquid/transports#testnet)
Testnet
Connect to the Hyperliquid testnet for development and testing:
###
[hashtag](https://nktkas.gitbook.io/hyperliquid/transports#timeout)
Timeout
Both transports abort requests after 10 seconds by default. Set a custom timeout or `null` to disable:
[PreviousIntroductionchevron-left](https://nktkas.gitbook.io/hyperliquid)
[NextClientschevron-right](https://nktkas.gitbook.io/hyperliquid/clients)
Last updated 5 days ago
* [HTTP vs WebSocket](https://nktkas.gitbook.io/hyperliquid/transports#http-vs-websocket)
* [HTTP](https://nktkas.gitbook.io/hyperliquid/transports#http)
* [Endpoints](https://nktkas.gitbook.io/hyperliquid/transports#endpoints)
* [Fetch options](https://nktkas.gitbook.io/hyperliquid/transports#fetch-options)
* [WebSocket](https://nktkas.gitbook.io/hyperliquid/transports#websocket)
* [Endpoints](https://nktkas.gitbook.io/hyperliquid/transports#endpoints-1)
* [Reconnection](https://nktkas.gitbook.io/hyperliquid/transports#reconnection)
* [Common options](https://nktkas.gitbook.io/hyperliquid/transports#common-options)
* [Testnet](https://nktkas.gitbook.io/hyperliquid/transports#testnet)
* [Timeout](https://nktkas.gitbook.io/hyperliquid/transports#timeout)
sun-brightdesktopmoon
Copy
import { HttpTransport } from "@nktkas/hyperliquid";
const transport = new HttpTransport({
apiUrl: "https://custom-api.example.com",
rpcUrl: "https://custom-rpc.example.com",
});
Copy
import { HttpTransport } from "@nktkas/hyperliquid";
const transport = new HttpTransport({
fetchOptions: {
headers: { "Authorization": "Bearer ..." },
},
});
Copy
import { SubscriptionClient, WebSocketTransport } from "@nktkas/hyperliquid";
const transport = new WebSocketTransport();
const client = new SubscriptionClient({ transport });
await client.allMids((data) => {
console.log(data.mids);
});
Copy
import { InfoClient, WebSocketTransport } from "@nktkas/hyperliquid";
const transport = new WebSocketTransport();
const client = new InfoClient({ transport });
const mids = await client.allMids();
Copy
import { WebSocketTransport } from "@nktkas/hyperliquid";
const transport = new WebSocketTransport({
url: "wss://custom-api.example.com/ws",
});
Copy
import { MAINNET_RPC_WS_URL, WebSocketTransport } from "@nktkas/hyperliquid";
const explorerTransport = new WebSocketTransport({ url: MAINNET_RPC_WS_URL });
Copy
import { WebSocketTransport } from "@nktkas/hyperliquid";
const transport = new WebSocketTransport({
reconnect: {
maxRetries: 10,
reconnectionDelay: 1_000,
},
});
Copy
const transport = new WebSocketTransport({ resubscribe: false });
Copy
const transport = new HttpTransport({ isTestnet: true });
// or
const transport = new WebSocketTransport({ isTestnet: true });
Copy
const transport = new HttpTransport({ timeout: 30_000 });
// or
const transport = new WebSocketTransport({ timeout: 30_000 });
sun-brightdesktopmoon
---
# Market orders | Hyperliquid
Hyperliquid doesn't have a dedicated market order type. Simulate market orders using a limit order with `tif: "Ioc"` (Immediate or Cancel) and a price that guarantees immediate execution.
[hashtag](https://nktkas.gitbook.io/hyperliquid/guides/market-orders#ioc-order-workflow)
IoC order workflow
----------------------------------------------------------------------------------------------------------------
An IoC order fills immediately at the best available price and cancels any unfilled portion. Set the price aggressively to ensure a fill:
* **Buy:** price above current mid (for example, +1%)
* **Sell:** price below current mid (for example, -1%)
The 1% buffer is a starting point. Volatile markets or large orders may need a wider margin.
[hashtag](https://nktkas.gitbook.io/hyperliquid/guides/market-orders#example)
Example
------------------------------------------------------------------------------------------
Copy
import { ExchangeClient, HttpTransport, InfoClient } from "@nktkas/hyperliquid";
import { formatPrice, formatSize, SymbolConverter } from "@nktkas/hyperliquid/utils";
import { privateKeyToAccount } from "viem/accounts";
const wallet = privateKeyToAccount("0x...");
const transport = new HttpTransport();
const converter = await SymbolConverter.create({ transport });
const info = new InfoClient({ transport });
const exchange = new ExchangeClient({ transport, wallet });
// Parameters
const coin = "ETH";
const size = "0.1";
const isBuy = true;
const tolerance = 0.01; // 1% price buffer
// Get aggressive price based on current mid price with tolerance
const mids = await info.allMids();
const mid = parseFloat(mids[coin]);
const price = mid * (1 + (isBuy ? tolerance : -tolerance));
// ! asserts the symbol exists - handle undefined in production
const assetId = converter.getAssetId(coin)!;
const szDecimals = converter.getSzDecimals(coin)!;
// Place IoC order with aggressive price to ensure fill
await exchange.order({
orders: [{\
a: assetId,\
b: isBuy,\
p: formatPrice(price, szDecimals),\
s: formatSize(size, szDecimals),\
r: false,\
t: { limit: { tif: "Ioc" } },\
}],
grouping: "na",
});
[PreviousSigningchevron-left](https://nktkas.gitbook.io/hyperliquid/signing)
[NextAgent wallets and vaultschevron-right](https://nktkas.gitbook.io/hyperliquid/guides/agent-wallets-and-vaults)
Last updated 5 days ago
* [IoC order workflow](https://nktkas.gitbook.io/hyperliquid/guides/market-orders#ioc-order-workflow)
* [Example](https://nktkas.gitbook.io/hyperliquid/guides/market-orders#example)
sun-brightdesktopmoon
sun-brightdesktopmoon
---
# Utilities | Hyperliquid
Helper functions for formatting orders and resolving asset symbols, imported from `@nktkas/hyperliquid/utils`.
[hashtag](https://nktkas.gitbook.io/hyperliquid/utilities#format-prices)
Format prices
-------------------------------------------------------------------------------------------
`formatPrice` truncates a price to the Hyperliquid [tick sizearrow-up-right](https://hyperliquid.gitbook.io/hyperliquid-docs/for-developers/api/tick-and-lot-size)
precision.
Copy
import { formatPrice } from "@nktkas/hyperliquid/utils";
formatPrice("97123.456789", 0); // "97123"
formatPrice("1.23456789", 5); // "1.2"
formatPrice("0.0000123456789", 0, "spot"); // "0.00001234"
[hashtag](https://nktkas.gitbook.io/hyperliquid/utilities#format-sizes)
Format sizes
-----------------------------------------------------------------------------------------
`formatSize` truncates a size to the asset [lot sizearrow-up-right](https://hyperliquid.gitbook.io/hyperliquid-docs/for-developers/api/tick-and-lot-size)
precision.
Copy
import { formatSize } from "@nktkas/hyperliquid/utils";
formatSize("1.23456789", 5); // "1.23456"
formatSize("0.123456789", 2); // "0.12"
formatSize("100", 0); // "100"
[hashtag](https://nktkas.gitbook.io/hyperliquid/utilities#resolve-symbols)
Resolve symbols
-----------------------------------------------------------------------------------------------
`SymbolConverter` maps human-readable symbols to Hyperliquid [asset IDsarrow-up-right](https://hyperliquid.gitbook.io/hyperliquid-docs/for-developers/api/asset-ids)
and formatting metadata. It fetches data from the API on creation.
###
[hashtag](https://nktkas.gitbook.io/hyperliquid/utilities#asset-ids)
Asset IDs
`getAssetId` returns the numeric ID used in order parameters:
Perpetuals use the coin name. Spot markets use `"BASE/QUOTE"` format. Returns `undefined` if the symbol is not found.
###
[hashtag](https://nktkas.gitbook.io/hyperliquid/utilities#size-decimals)
Size decimals
`getSzDecimals` returns the lot size precision for an asset:
###
[hashtag](https://nktkas.gitbook.io/hyperliquid/utilities#spot-pair-ids)
Spot pair IDs
`getSpotPairId` returns the identifier used in info requests and subscriptions for spot markets:
###
[hashtag](https://nktkas.gitbook.io/hyperliquid/utilities#refresh-data)
Refresh data
Call `reload` to update the symbol mappings when new assets are listed:
###
[hashtag](https://nktkas.gitbook.io/hyperliquid/utilities#builder-dex-support)
Builder DEX support
Pass `dexs` to include assets from [builder DEXsarrow-up-right](https://hyperliquid.gitbook.io/hyperliquid-docs/hyperliquid-improvement-proposals-hips/hip-3-builder-deployed-perpetuals)
:
Builder DEX assets use `"DEX:ASSET"` format:
[hashtag](https://nktkas.gitbook.io/hyperliquid/utilities#format-and-place-an-order)
Format and place an order
-------------------------------------------------------------------------------------------------------------------
[PreviousError handlingchevron-left](https://nktkas.gitbook.io/hyperliquid/error-handling)
[NextSigningchevron-right](https://nktkas.gitbook.io/hyperliquid/signing)
Last updated 5 days ago
* [Format prices](https://nktkas.gitbook.io/hyperliquid/utilities#format-prices)
* [Format sizes](https://nktkas.gitbook.io/hyperliquid/utilities#format-sizes)
* [Resolve symbols](https://nktkas.gitbook.io/hyperliquid/utilities#resolve-symbols)
* [Asset IDs](https://nktkas.gitbook.io/hyperliquid/utilities#asset-ids)
* [Size decimals](https://nktkas.gitbook.io/hyperliquid/utilities#size-decimals)
* [Spot pair IDs](https://nktkas.gitbook.io/hyperliquid/utilities#spot-pair-ids)
* [Refresh data](https://nktkas.gitbook.io/hyperliquid/utilities#refresh-data)
* [Builder DEX support](https://nktkas.gitbook.io/hyperliquid/utilities#builder-dex-support)
* [Format and place an order](https://nktkas.gitbook.io/hyperliquid/utilities#format-and-place-an-order)
sun-brightdesktopmoon
Copy
import { HttpTransport } from "@nktkas/hyperliquid";
import { SymbolConverter } from "@nktkas/hyperliquid/utils";
const transport = new HttpTransport();
const converter = await SymbolConverter.create({ transport });
Copy
converter.getAssetId("BTC"); // 0
converter.getAssetId("HYPE/USDC"); // 10107
Copy
converter.getSzDecimals("BTC"); // 5
converter.getSzDecimals("HYPE/USDC"); // 2
Copy
converter.getSpotPairId("HYPE/USDC"); // "@107"
converter.getSpotPairId("PURR/USDC"); // "PURR/USDC"
Copy
await converter.reload();
Copy
const converter = await SymbolConverter.create({
transport,
dexs: true, // all DEXs
});
Copy
const converter = await SymbolConverter.create({
transport,
dexs: ["test", "other"], // specific DEXs
});
Copy
converter.getAssetId("test:ABC"); // 110000
converter.getSzDecimals("test:ABC"); // 0
Copy
import { ExchangeClient, HttpTransport } from "@nktkas/hyperliquid";
import { formatPrice, formatSize, SymbolConverter } from "@nktkas/hyperliquid/utils";
import { privateKeyToAccount } from "viem/accounts";
const wallet = privateKeyToAccount("0x...");
const transport = new HttpTransport();
const converter = await SymbolConverter.create({ transport });
const client = new ExchangeClient({ transport, wallet });
// Parameters
const coin = "BTC";
const price = "97123.456789";
const size = "0.00123456789";
const isBuy = true;
// ! asserts the symbol exists - handle undefined in production
const assetId = converter.getAssetId(coin)!;
const szDecimals = converter.getSzDecimals(coin)!;
await client.order({
orders: [{\
a: assetId, // asset index\
b: isBuy, // buy\
p: formatPrice(price, szDecimals), // price\
s: formatSize(size, szDecimals), // size\
r: false, // not reduce-only\
t: { limit: { tif: "Gtc" } }, // Good-Til-Cancelled\
}],
grouping: "na",
});
sun-brightdesktopmoon
---
# Error handling | Hyperliquid
The SDK throws `HyperliquidError` and its subclasses. Each subclass represents a specific failure category, such as validation, transport, API, or wallet errors.
[hashtag](https://nktkas.gitbook.io/hyperliquid/error-handling#error-hierarchy)
Error hierarchy
----------------------------------------------------------------------------------------------------
Copy
Error
└─ HyperliquidError
├─ ValidationError
├─ AbstractWalletError
├─ TransportError
│ ├─ HttpRequestError
│ └─ WebSocketRequestError
└─ ApiRequestError
[hashtag](https://nktkas.gitbook.io/hyperliquid/error-handling#transport-errors)
Transport errors
------------------------------------------------------------------------------------------------------
These errors are thrown when the request itself fails, such as network issues, timeouts, or non-JSON responses.
###
[hashtag](https://nktkas.gitbook.io/hyperliquid/error-handling#httprequesterror)
HttpRequestError
This error is thrown when an HTTP request fails, such as non-200 status codes, non-JSON responses, or network-level failures.
Has `response` (the [`Response`arrow-up-right](https://developer.mozilla.org/en-US/docs/Web/API/Response)
object) when the server responded, `undefined` for network-level failures.
Copy
import { HttpRequestError } from "@nktkas/hyperliquid";
try {
await client.allMids();
} catch (error) {
if (error instanceof HttpRequestError) {
console.error(error.message); // "429 Too Many Requests - ..."
console.error(error.response?.status); // 429
console.error(await error.response?.text()); // response body
}
}
###
[hashtag](https://nktkas.gitbook.io/hyperliquid/error-handling#websocketrequesterror)
WebSocketRequestError
This error is thrown when a WebSocket request or subscription fails, such as connection failures, server errors, or exceeded subscription limits.
[hashtag](https://nktkas.gitbook.io/hyperliquid/error-handling#api-errors)
API errors
------------------------------------------------------------------------------------------
`ApiRequestError` is thrown when the Hyperliquid API processes the request but returns an error, such as insufficient margin, invalid price, or unknown wallet address.
Has `response` with the full API response object:
[hashtag](https://nktkas.gitbook.io/hyperliquid/error-handling#wallet-errors)
Wallet errors
------------------------------------------------------------------------------------------------
`AbstractWalletError` is thrown when a wallet operation fails, such as signature creation, address retrieval, or chain ID detection. The original error is in `cause`.
[hashtag](https://nktkas.gitbook.io/hyperliquid/error-handling#validation-errors)
Validation errors
--------------------------------------------------------------------------------------------------------
`ValidationError` is thrown when request parameters fail schema validation before sending.
The `cause` property contains the original [`ValiError`arrow-up-right](https://valibot.dev/api/ValiError/)
with detailed issue information:
[hashtag](https://nktkas.gitbook.io/hyperliquid/error-handling#timeouts-and-cancellation)
Timeouts and cancellation
------------------------------------------------------------------------------------------------------------------------
Both transports use [`AbortSignal`arrow-up-right](https://developer.mozilla.org/en-US/docs/Web/API/AbortSignal)
internally, so timeouts and user-initiated cancellations produce a [`DOMException`arrow-up-right](https://developer.mozilla.org/en-US/docs/Web/API/DOMException)
in `cause`:
[hashtag](https://nktkas.gitbook.io/hyperliquid/error-handling#catch-all-errors)
Catch all errors
------------------------------------------------------------------------------------------------------
[PreviousClientschevron-left](https://nktkas.gitbook.io/hyperliquid/clients)
[NextUtilitieschevron-right](https://nktkas.gitbook.io/hyperliquid/utilities)
Last updated 4 days ago
* [Error hierarchy](https://nktkas.gitbook.io/hyperliquid/error-handling#error-hierarchy)
* [Transport errors](https://nktkas.gitbook.io/hyperliquid/error-handling#transport-errors)
* [HttpRequestError](https://nktkas.gitbook.io/hyperliquid/error-handling#httprequesterror)
* [WebSocketRequestError](https://nktkas.gitbook.io/hyperliquid/error-handling#websocketrequesterror)
* [API errors](https://nktkas.gitbook.io/hyperliquid/error-handling#api-errors)
* [Wallet errors](https://nktkas.gitbook.io/hyperliquid/error-handling#wallet-errors)
* [Validation errors](https://nktkas.gitbook.io/hyperliquid/error-handling#validation-errors)
* [Timeouts and cancellation](https://nktkas.gitbook.io/hyperliquid/error-handling#timeouts-and-cancellation)
* [Catch all errors](https://nktkas.gitbook.io/hyperliquid/error-handling#catch-all-errors)
sun-brightdesktopmoon
Copy
import { WebSocketRequestError } from "@nktkas/hyperliquid";
try {
await client.allMids();
} catch (error) {
if (error instanceof WebSocketRequestError) {
console.error(error.message); // for example, "WebSocket connection closed"
}
}
Copy
import { ApiRequestError } from "@nktkas/hyperliquid";
try {
await client.order({ orders: [/* ... */], grouping: "na" });
} catch (error) {
if (error instanceof ApiRequestError) {
console.error(error.message); // for example, "Insufficient margin to place order"
console.error(error.response); // full API response
}
}
Copy
import { AbstractWalletError } from "@nktkas/hyperliquid";
try {
await client.order({ orders: [/* ... */], grouping: "na" });
} catch (error) {
if (error instanceof AbstractWalletError) {
console.error(error.message); // for example, "Failed to sign typed data with viem wallet"
console.error(error.cause); // original wallet error
}
}
Copy
import { ValidationError } from "@nktkas/hyperliquid";
try {
await client.order({ orders: [/* ... */], grouping: "na" });
} catch (error) {
if (error instanceof ValidationError) {
console.error(error.message); // human-readable validation message
console.error(error.cause.issues); // detailed list of validation issues
}
}
Copy
import { TransportError } from "@nktkas/hyperliquid";
// ^^^^^^^^^^^^^^
// universal transport error superclass for both HTTP and WebSocket transports
try {
await client.allMids();
} catch (error) {
if (error instanceof TransportError && error.cause instanceof DOMException) {
if (error.cause.name === "TimeoutError") {
// Transport timeout (default 10 s)
}
if (error.cause.name === "AbortError") {
// Cancelled via AbortSignal
}
}
}
Copy
import {
AbstractWalletError,
ApiRequestError,
HttpRequestError,
HyperliquidError,
TransportError,
ValidationError,
WebSocketRequestError,
} from "@nktkas/hyperliquid";
try {
await client.order({ orders: [/* ... */], grouping: "na" });
} catch (error) {
if (error instanceof HyperliquidError) {
if (error instanceof ValidationError) {
// Invalid parameters - check error.message, error.cause
} else if (error instanceof ApiRequestError) {
// API rejected the action - check error.message
} else if (error instanceof AbstractWalletError) {
// Wallet failed - check error.cause
} else if (error instanceof TransportError) {
if (error instanceof HttpRequestError) {
// HTTP failure - check error.response, error.cause
} else if (error instanceof WebSocketRequestError) {
// WebSocket failure - check error.message
}
} else {
// Unexpected HyperliquidError subclass - check error.message
}
}
throw error; // re-throw unexpected errors
}
sun-brightdesktopmoon
---
# Agent wallets and vaults | Hyperliquid
Hyperliquid supports delegated trading through [agent walletsarrow-up-right](https://hyperliquid.gitbook.io/hyperliquid-docs/for-developers/api/nonces-and-api-wallets#api-wallets)
, and isolated capital through [vaults and sub-accountsarrow-up-right](https://hyperliquid.gitbook.io/hyperliquid-docs/for-developers/api/exchange-endpoint#subaccounts-and-vaults)
.
[hashtag](https://nktkas.gitbook.io/hyperliquid/guides/agent-wallets-and-vaults#agent-wallets)
Agent wallets
-----------------------------------------------------------------------------------------------------------------
An agent wallet signs trades on behalf of your master account. Approve it once, then use the agent's private key for all subsequent requests:
Copy
import { ExchangeClient, HttpTransport } from "@nktkas/hyperliquid";
import { privateKeyToAccount } from "viem/accounts";
const client = new ExchangeClient({
transport: new HttpTransport(),
wallet: privateKeyToAccount("0x..."), // agent's private key
});
// All trades are executed as the master account
await client.order({
orders: [{\
a: 0,\
b: true,\
p: "50000",\
s: "0.01",\
r: false,\
t: { limit: { tif: "Gtc" } },\
}],
grouping: "na",
});
###
[hashtag](https://nktkas.gitbook.io/hyperliquid/guides/agent-wallets-and-vaults#create-an-agent)
Create an agent
Approve an agent via `approveAgent` or through the [Hyperliquid UIarrow-up-right](https://app.hyperliquid.xyz/API)
:
Agents expire after 90 days by default. To set a custom expiration (up to 180 days), append `valid_until ` to the name:
[hashtag](https://nktkas.gitbook.io/hyperliquid/guides/agent-wallets-and-vaults#vaults)
Vaults
---------------------------------------------------------------------------------------------------
A vault is an isolated trading account that other users can deposit into. Trade on behalf of a vault by setting `vaultAddress`:
###
[hashtag](https://nktkas.gitbook.io/hyperliquid/guides/agent-wallets-and-vaults#manage-vaults)
Manage vaults
[hashtag](https://nktkas.gitbook.io/hyperliquid/guides/agent-wallets-and-vaults#sub-accounts)
Sub-accounts
---------------------------------------------------------------------------------------------------------------
Sub-accounts work like vaults but belong to a single user. They share the same `vaultAddress` mechanism for trading:
[PreviousMarket orderschevron-left](https://nktkas.gitbook.io/hyperliquid/guides/market-orders)
[NextBrowser walletschevron-right](https://nktkas.gitbook.io/hyperliquid/guides/browser-wallets)
Last updated 5 days ago
* [Agent wallets](https://nktkas.gitbook.io/hyperliquid/guides/agent-wallets-and-vaults#agent-wallets)
* [Create an agent](https://nktkas.gitbook.io/hyperliquid/guides/agent-wallets-and-vaults#create-an-agent)
* [Vaults](https://nktkas.gitbook.io/hyperliquid/guides/agent-wallets-and-vaults#vaults)
* [Manage vaults](https://nktkas.gitbook.io/hyperliquid/guides/agent-wallets-and-vaults#manage-vaults)
* [Sub-accounts](https://nktkas.gitbook.io/hyperliquid/guides/agent-wallets-and-vaults#sub-accounts)
sun-brightdesktopmoon
Copy
import { ExchangeClient, HttpTransport } from "@nktkas/hyperliquid";
import { privateKeyToAccount } from "viem/accounts";
const client = new ExchangeClient({
transport: new HttpTransport(),
wallet: privateKeyToAccount("0x..."), // master account
});
await client.approveAgent({
agentAddress: "0x...", // address of the agent wallet
agentName: "my-bot",
});
Copy
const timestamp = Date.now() + 180 * 24 * 60 * 60 * 1000; // 180 days from now
await client.approveAgent({
agentAddress: "0x...",
agentName: `my-bot valid_until ${timestamp}`,
});
Copy
const client = new ExchangeClient({
transport,
wallet,
defaultVaultAddress: "0x...",
});
Copy
await client.order({ orders: [/* ... */], grouping: "na" }, {
vaultAddress: "0x...",
});
Copy
// Create
const result = await client.createVault({
name: "My Vault",
description: "Automated trading strategy",
initialUsd: 100e6, // 100 USD in microunits
nonce: Date.now(),
});
// Deposit
await client.vaultTransfer({
vaultAddress: "0x...",
isDeposit: true,
usd: 50e6, // 50 USD in microunits
});
// Withdraw
await client.vaultTransfer({
vaultAddress: "0x...",
isDeposit: false,
usd: 25e6, // 25 USD in microunits
});
Copy
// Create
const result = await client.createSubAccount({ name: "trading-bot" });
const subAccountAddress = result.response.data;
// Transfer funds
await client.subAccountTransfer({
subAccountUser: subAccountAddress,
isDeposit: true,
usd: 10e6, // 10 USD in microunits
});
// Transfer spot tokens
await client.subAccountSpotTransfer({
subAccountUser: subAccountAddress,
isDeposit: true,
token: "USDC:0xeb62eee3685fc4c43992febcd9e75443",
amount: "100", // 100 USDC
});
// Trade on behalf of sub-account
await client.order({ orders: [/* ... */], grouping: "na" }, {
vaultAddress: subAccountAddress,
});
sun-brightdesktopmoon
---
# Tree-shaking | Hyperliquid
The SDK is organized into modular entry points so bundlers can eliminate unused code.
[hashtag](https://nktkas.gitbook.io/hyperliquid/guides/tree-shaking#entry-points)
Entry points
---------------------------------------------------------------------------------------------------
The following table lists the available entry points:
Entry point
Contains
`@nktkas/hyperliquid`
Transports, clients, error classes
`@nktkas/hyperliquid/signing`
Signing functions, wallet utilities
`@nktkas/hyperliquid/utils`
`formatPrice`, `formatSize`, `SymbolConverter`
`@nktkas/hyperliquid/api/info`
Info methods, individually importable
`@nktkas/hyperliquid/api/exchange`
Exchange methods, individually importable
`@nktkas/hyperliquid/api/subscription`
Subscription methods, individually importable
Each entry point has independent dependencies. Importing `@nktkas/hyperliquid/utils` doesn't pull in signing or validation code.
[hashtag](https://nktkas.gitbook.io/hyperliquid/guides/tree-shaking#direct-method-imports)
Direct method imports
---------------------------------------------------------------------------------------------------------------------
Instead of creating a [client](https://nktkas.gitbook.io/hyperliquid/clients)
(which bundles all methods), import individual methods directly. Each method accepts the same config as its client as the first argument.
Info methods use [`InfoClient`](https://nktkas.gitbook.io/hyperliquid/clients#read-data)
config:
Copy
import { HttpTransport } from "@nktkas/hyperliquid";
import { allMids } from "@nktkas/hyperliquid/api/info";
const transport = new HttpTransport();
const result = await allMids({ transport });
This bundles only the `allMids` method, its validation schema, and the transport logic — not the full `InfoClient` with all methods.
Exchange methods use [`ExchangeClient`](https://nktkas.gitbook.io/hyperliquid/clients#trading)
config:
Subscription methods use [`SubscriptionClient`](https://nktkas.gitbook.io/hyperliquid/clients#real-time-updates)
config:
[PreviousBrowser walletschevron-left](https://nktkas.gitbook.io/hyperliquid/guides/browser-wallets)
[NextInfo Methodschevron-right](https://nktkas.gitbook.io/hyperliquid/api-reference/info-methods)
Last updated 5 days ago
* [Entry points](https://nktkas.gitbook.io/hyperliquid/guides/tree-shaking#entry-points)
* [Direct method imports](https://nktkas.gitbook.io/hyperliquid/guides/tree-shaking#direct-method-imports)
sun-brightdesktopmoon
Copy
import { HttpTransport } from "@nktkas/hyperliquid";
import { order } from "@nktkas/hyperliquid/api/exchange";
import { privateKeyToAccount } from "viem/accounts";
const transport = new HttpTransport();
const wallet = privateKeyToAccount("0x...");
await order(
{ transport, wallet },
{
orders: [{\
a: 0,\
b: true,\
p: "50000",\
s: "0.01",\
r: false,\
t: { limit: { tif: "Gtc" } },\
}],
grouping: "na",
},
);
Copy
import { WebSocketTransport } from "@nktkas/hyperliquid";
import { allMids } from "@nktkas/hyperliquid/api/subscription";
const transport = new WebSocketTransport();
const subscription = await allMids({ transport }, (data) => {
console.log(data.mids);
});
sun-brightdesktopmoon
---
# Clients | Hyperliquid
A client uses a [transport](https://nktkas.gitbook.io/hyperliquid/transports)
to call a specific part of the Hyperliquid API:
* **Info:** market data, account state, blockchain explorer
* **Exchange:** trading, fund management, account configuration
* **Subscription:** real-time updates via WebSocket
[hashtag](https://nktkas.gitbook.io/hyperliquid/clients#read-data)
Read data
---------------------------------------------------------------------------------
`InfoClient` gives read-only access to the [Info endpointarrow-up-right](https://hyperliquid.gitbook.io/hyperliquid-docs/for-developers/api/info-endpoint)
. Works with any transport.
Copy
import { HttpTransport, InfoClient } from "@nktkas/hyperliquid";
const transport = new HttpTransport();
const client = new InfoClient({ transport });
const mids = await client.allMids();
const book = await client.l2Book({ coin: "ETH" });
[hashtag](https://nktkas.gitbook.io/hyperliquid/clients#trading)
Trading
-----------------------------------------------------------------------------
`ExchangeClient` executes actions on the [Exchange endpointarrow-up-right](https://hyperliquid.gitbook.io/hyperliquid-docs/for-developers/api/exchange-endpoint)
: trading, fund management, and account configuration. Requires a wallet for [signing](https://nktkas.gitbook.io/hyperliquid/signing#wallet-compatibility)
and works with any transport.
viem
ethers
Browser (viem)
Browser (ethers)
Custom
Copy
import { ExchangeClient, HttpTransport } from "@nktkas/hyperliquid";
import { privateKeyToAccount } from "viem/accounts";
const transport = new HttpTransport();
const client = new ExchangeClient({
transport,
wallet: privateKeyToAccount("0x..."),
});
Copy
import { ExchangeClient, HttpTransport } from "@nktkas/hyperliquid";
import { Wallet } from "ethers";
const transport = new HttpTransport();
const client = new ExchangeClient({
transport,
wallet: new Wallet("0x..."),
});
Use a [JSON-RPC Accountarrow-up-right](https://viem.sh/docs/clients/wallet#json-rpc-accounts)
to connect browser extensions like MetaMask:
Copy
import { ExchangeClient, HttpTransport } from "@nktkas/hyperliquid";
import { createWalletClient, custom } from "viem";
import { arbitrum } from "viem/chains";
const wallet = createWalletClient({
chain: arbitrum,
transport: custom(window.ethereum!),
});
const transport = new HttpTransport();
const client = new ExchangeClient({ transport, wallet });
Use a [BrowserProviderarrow-up-right](https://docs.ethers.org/v6/api/providers/#BrowserProvider)
to connect browser extensions like MetaMask:
Any object matching one of the [supported wallet interfaces](https://nktkas.gitbook.io/hyperliquid/signing#wallet-compatibility)
works. The minimum requirement is [`signTypedData`arrow-up-right](https://eips.ethereum.org/EIPS/eip-712)
and an address:
Place an order:
###
[hashtag](https://nktkas.gitbook.io/hyperliquid/clients#multi-sig)
Multi-sig
[Multi-signature accountsarrow-up-right](https://hyperliquid.gitbook.io/hyperliquid-docs/hypercore/multi-sig)
require multiple authorized signers to approve every action. The **leader** (first signer in the array) collects all signatures and submits the final transaction — only the leader's nonce is validated by the server.
###
[hashtag](https://nktkas.gitbook.io/hyperliquid/clients#vault-and-sub-account-trading)
Vault and sub-account trading
To trade on behalf of a [vault or sub-accountarrow-up-right](https://hyperliquid.gitbook.io/hyperliquid-docs/for-developers/api/exchange-endpoint#subaccounts-and-vaults)
, set a default or pass `vaultAddress` per-request:
###
[hashtag](https://nktkas.gitbook.io/hyperliquid/clients#expiration)
Expiration
A server-side guard. The API rejects the action after this timestamp (milliseconds). See [Expires Afterarrow-up-right](https://hyperliquid.gitbook.io/hyperliquid-docs/for-developers/api/exchange-endpoint#expires-after)
.
###
[hashtag](https://nktkas.gitbook.io/hyperliquid/clients#signature-chain-id)
Signature chain ID
Sets the EIP-712 domain `chainId` for [user-signed actions](https://nktkas.gitbook.io/hyperliquid/signing#user-signed-action-protocol)
. Defaults to the wallet's provider chain ID. Local wallets without a provider (e.g., [`privateKeyToAccount`arrow-up-right](https://viem.sh/docs/accounts/local/privateKeyToAccount)
, [`new Wallet()`arrow-up-right](https://docs.ethers.org/v6/api/wallet/#Wallet)
) fall back to `0x1` (Ethereum mainnet). Override to set the correct chain:
###
[hashtag](https://nktkas.gitbook.io/hyperliquid/clients#nonce-manager)
Nonce manager
The SDK generates [noncesarrow-up-right](https://hyperliquid.gitbook.io/hyperliquid-docs/for-developers/api/nonces-and-api-wallets#hyperliquid-nonces)
automatically using timestamps with auto-increment. Replace it if you need custom logic:
[hashtag](https://nktkas.gitbook.io/hyperliquid/clients#real-time-updates)
Real-time updates
-------------------------------------------------------------------------------------------------
`SubscriptionClient` streams live data via [WebSocket subscriptionsarrow-up-right](https://hyperliquid.gitbook.io/hyperliquid-docs/for-developers/api/websocket/subscriptions)
. Requires [`WebSocketTransport`](https://nktkas.gitbook.io/hyperliquid/transports#websocket)
.
###
[hashtag](https://nktkas.gitbook.io/hyperliquid/clients#unsubscribe)
Unsubscribe
A single connection supports up to [1000 active subscriptions and 10 unique usersarrow-up-right](https://hyperliquid.gitbook.io/hyperliquid-docs/for-developers/api/rate-limits-and-user-limits)
. Call `unsubscribe()` to remove a listener and free these slots:
Subscribing to the same channel multiple times reuses one underlying subscription. Each `unsubscribe()` removes only its listener — the channel stays open until the last one is removed:
###
[hashtag](https://nktkas.gitbook.io/hyperliquid/clients#handle-failures)
Handle failures
When the WebSocket [reconnects](https://nktkas.gitbook.io/hyperliquid/transports#reconnection)
, the SDK automatically resubscribes to all active channels. If resubscription fails for a channel, its `failureSignal` aborts with the error:
[hashtag](https://nktkas.gitbook.io/hyperliquid/clients#common-options)
Common options
-------------------------------------------------------------------------------------------
###
[hashtag](https://nktkas.gitbook.io/hyperliquid/clients#cancellation)
Cancellation
`InfoClient` methods accept an optional [`AbortSignal`arrow-up-right](https://developer.mozilla.org/en-US/docs/Web/API/AbortSignal)
as the last argument:
`ExchangeClient` methods accept it inside the options object (also last argument). Unlike [Expiration](https://nktkas.gitbook.io/hyperliquid/clients#expiration)
, which is a server-side guard, cancellation aborts the request on the client side before or during delivery:
[PreviousConnect to Hyperliquidchevron-left](https://nktkas.gitbook.io/hyperliquid/transports)
[NextError handlingchevron-right](https://nktkas.gitbook.io/hyperliquid/error-handling)
Last updated 5 days ago
* [Read data](https://nktkas.gitbook.io/hyperliquid/clients#read-data)
* [Trading](https://nktkas.gitbook.io/hyperliquid/clients#trading)
* [Multi-sig](https://nktkas.gitbook.io/hyperliquid/clients#multi-sig)
* [Vault and sub-account trading](https://nktkas.gitbook.io/hyperliquid/clients#vault-and-sub-account-trading)
* [Expiration](https://nktkas.gitbook.io/hyperliquid/clients#expiration)
* [Signature chain ID](https://nktkas.gitbook.io/hyperliquid/clients#signature-chain-id)
* [Nonce manager](https://nktkas.gitbook.io/hyperliquid/clients#nonce-manager)
* [Real-time updates](https://nktkas.gitbook.io/hyperliquid/clients#real-time-updates)
* [Unsubscribe](https://nktkas.gitbook.io/hyperliquid/clients#unsubscribe)
* [Handle failures](https://nktkas.gitbook.io/hyperliquid/clients#handle-failures)
* [Common options](https://nktkas.gitbook.io/hyperliquid/clients#common-options)
* [Cancellation](https://nktkas.gitbook.io/hyperliquid/clients#cancellation)
sun-brightdesktopmoon
Copy
import { ExchangeClient, HttpTransport } from "@nktkas/hyperliquid";
import { BrowserProvider } from "ethers";
const provider = new BrowserProvider(window.ethereum!);
const wallet = await provider.getSigner();
const transport = new HttpTransport();
const client = new ExchangeClient({ transport, wallet });
Copy
import { ExchangeClient, HttpTransport } from "@nktkas/hyperliquid";
import type { AbstractViemLocalAccount } from "@nktkas/hyperliquid/signing";
const wallet: AbstractViemLocalAccount = {
address: "0x...",
async signTypedData({ domain, types, primaryType, message }) {
// Your EIP-712 signing logic (HSM, MPC, remote signer, etc.)
return "0x...";
},
};
const transport = new HttpTransport();
const client = new ExchangeClient({ transport, wallet });
Copy
await client.order({
orders: [{\
a: 0, // asset index\
b: true, // buy\
p: "50000", // price\
s: "0.01", // size\
r: false, // not reduce-only\
t: { limit: { tif: "Gtc" } }, // Good 'til Cancelled\
}],
grouping: "na",
});
Copy
import { ExchangeClient, HttpTransport } from "@nktkas/hyperliquid";
import { privateKeyToAccount } from "viem/accounts";
const transport = new HttpTransport();
const client = new ExchangeClient({
transport,
signers: [\
privateKeyToAccount("0x..."), // leader — submits the transaction\
privateKeyToAccount("0x..."),\
],
multiSigUser: "0x...", // the multi-sig account address
});
Copy
const client = new ExchangeClient({
transport,
wallet,
defaultVaultAddress: "0x...",
});
Copy
await client.order({ orders: [/* ... */], grouping: "na" }, {
vaultAddress: "0x...",
});
Copy
const client = new ExchangeClient({
transport,
wallet,
defaultExpiresAfter: () => Date.now() + 60_000, // function - recomputed per request
});
Copy
const client = new ExchangeClient({
transport,
wallet,
defaultExpiresAfter: Date.now() + 60_000, // static - fixed at construction time
});
Copy
await client.order({ orders: [/* ... */], grouping: "na" }, {
expiresAfter: Date.now() + 60_000, // per-request override
});
Copy
const client = new ExchangeClient({
transport,
wallet,
signatureChainId: "0xa4b1", // static - fixed chain ID
});
Copy
const client = new ExchangeClient({
transport,
wallet,
signatureChainId: () => "0xa4b1", // function - recomputed per request
});
Copy
const client = new ExchangeClient({
transport,
wallet,
nonceManager: (address) => Date.now(), // function - recomputed per request
});
Copy
import { SubscriptionClient, WebSocketTransport } from "@nktkas/hyperliquid";
const transport = new WebSocketTransport();
const client = new SubscriptionClient({ transport });
const subscription = await client.allMids((data) => {
console.log(data.mids);
});
Copy
const subscription = await client.allMids((data) => {
console.log(data.mids);
});
// Later
await subscription.unsubscribe();
Copy
const sub1 = await client.allMids((data) => console.log("A:", data.mids));
const sub2 = await client.allMids((data) => console.log("B:", data.mids));
await sub1.unsubscribe(); // removes listener A, subscription stays active
await sub2.unsubscribe(); // removes listener B, channel closed
Copy
const subscription = await client.allMids((data) => {
console.log(data.mids);
});
subscription.failureSignal.addEventListener("abort", () => {
console.error("Resubscription failed:", subscription.failureSignal.reason);
// Create a new subscription or explore the error...
});
Copy
const controller = new AbortController();
const mids = await client.allMids(controller.signal);
Copy
const controller = new AbortController();
await client.order({ orders: [/* ... */], grouping: "na" }, {
signal: controller.signal,
});
sun-brightdesktopmoon
---
# Signing | Hyperliquid
Every exchange action on Hyperliquid requires an [EIP-712arrow-up-right](https://eips.ethereum.org/EIPS/eip-712)
signature. [`ExchangeClient`](https://nktkas.gitbook.io/hyperliquid/clients#trading)
handles this automatically. The following functions are for custom integrations or actions not yet supported by `ExchangeClient`.
[hashtag](https://nktkas.gitbook.io/hyperliquid/signing#how-signing-works)
How signing works
-------------------------------------------------------------------------------------------------
Hyperliquid has two signing flows depending on the action type:
L1 actions
User-signed actions
**Examples**
Trading and position management
Fund movements and account security
**EIP-712 domain**
`Exchange`, chain ID `1337`
`HyperliquidSignTransaction`, user's chain ID
**What gets signed**
Action hash as `connectionId`
Action fields directly
###
[hashtag](https://nktkas.gitbook.io/hyperliquid/signing#l1-action)
L1 action
The action is never signed directly. Instead, a **phantom agent** is constructed:
1. [Msgpackarrow-up-right](https://msgpack.org/)
\-encode the action object (field order matters — the expected order varies by action type)
2. Append the [noncearrow-up-right](https://hyperliquid.gitbook.io/hyperliquid-docs/for-developers/api/nonces-and-api-wallets)
as uint64 big-endian (8 bytes)
3. Append a [vaultarrow-up-right](https://hyperliquid.gitbook.io/hyperliquid-docs/hypercore/vaults)
marker: `0x01` + 20-byte vault address, or `0x00` if none
4. If [`expiresAfter`arrow-up-right](https://hyperliquid.gitbook.io/hyperliquid-docs/for-developers/api/exchange-endpoint#expires-after)
is set, append `0x00` + the timestamp as uint64 big-endian
5. [Keccak-256arrow-up-right](https://en.wikipedia.org/wiki/SHA-3#Instances)
hash the concatenated bytes. This is the `connectionId`
6. Sign an [EIP-712arrow-up-right](https://eips.ethereum.org/EIPS/eip-712)
message with:
* Domain: `{ name: "Exchange", version: "1", chainId: 1337, verifyingContract: 0x0...0 }`
* Type: `Agent { source: string, connectionId: bytes32 }`
* Message: `{ source: "a" (mainnet) or "b" (testnet), connectionId }` where `connectionId` is the hash from step 5
7. Send `{ action, signature: { r, s, v }, nonce }` to the [exchange endpointarrow-up-right](https://hyperliquid.gitbook.io/hyperliquid-docs/for-developers/api/exchange-endpoint)
Chain ID `1337` is hardcoded and doesn't depend on the wallet's network. The phantom agent construct means the validator recovers the signer from the `Agent` message, then verifies that the `connectionId` matches the action hash.
###
[hashtag](https://nktkas.gitbook.io/hyperliquid/signing#user-signed-action)
User-signed action
The action fields are placed directly into the EIP-712 message, with no hashing or phantom agent:
1. Each action type defines its own [typed dataarrow-up-right](https://eips.ethereum.org/EIPS/eip-712#definition-of-typed-structured-data-%F0%9D%95%8A)
structure (for example, `HyperliquidTransaction:ApproveAgent`)
2. Sign an EIP-712 message with:
* Domain: `{ name: "HyperliquidSignTransaction", version: "1", chainId: , verifyingContract: 0x0...0 }`
* Type and message: defined per action
3. Send `{ action, signature: { r, s, v }, nonce }` to the exchange endpoint
The `signatureChainId` field in the action (hex, such as `"0x66eee"`) sets the EIP-712 domain chain ID.
###
[hashtag](https://nktkas.gitbook.io/hyperliquid/signing#common-rules)
Common rules
Both flows share:
* **Nonce:** current timestamp in milliseconds. Hyperliquid stores the 100 highest nonces per signer and rejects duplicates. See [Noncesarrow-up-right](https://hyperliquid.gitbook.io/hyperliquid-docs/for-developers/api/nonces-and-api-wallets)
.
* **Signature:** ECDSA `{ r, s, v }` where `v` is `27` or `28`
* **Hex strings:** lowercase all hex values before signing
The following functions implement these flows. Each accepts any [compatible wallet](https://nktkas.gitbook.io/hyperliquid/signing#wallet-compatibility)
.
[hashtag](https://nktkas.gitbook.io/hyperliquid/signing#l1-actions)
L1 actions
-----------------------------------------------------------------------------------
`signL1Action` signs an [L1 action](https://nktkas.gitbook.io/hyperliquid/signing#l1-action)
and returns an ECDSA signature.
Use `isTestnet: true` when signing for the testnet — this changes the EIP-712 source from `"a"` to `"b"`.
viem
ethers
Browser (viem)
Browser (ethers)
Custom
[hashtag](https://nktkas.gitbook.io/hyperliquid/signing#user-signed-actions)
User-signed actions
-----------------------------------------------------------------------------------------------------
`signUserSignedAction` signs a [user-signed action](https://nktkas.gitbook.io/hyperliquid/signing#user-signed-action)
and returns an ECDSA signature.
Each action type has its own EIP-712 types, exported from `@nktkas/hyperliquid/api/exchange` using the convention `PascalCase(actionType) + "Types"` (for example, `Withdraw3Types` for `withdraw3`, `ApproveAgentTypes` for `approveAgent`).
viem
ethers
Browser (viem)
Browser (ethers)
Custom
[hashtag](https://nktkas.gitbook.io/hyperliquid/signing#action-hashing)
Action hashing
-------------------------------------------------------------------------------------------
`createL1ActionHash` produces the keccak256 hash used as `connectionId` in L1 signing. Use it to verify that your action serialization matches what the SDK produces:
circle-exclamation
The hash depends on key order in the action object. The expected order varies by action type.
Optional parameters `vaultAddress` and `expiresAfter` are included in the hash when present.
[hashtag](https://nktkas.gitbook.io/hyperliquid/signing#multi-sig-actions)
Multi-sig actions
-------------------------------------------------------------------------------------------------
`signMultiSigAction` signs the [multi-sigarrow-up-right](https://hyperliquid.gitbook.io/hyperliquid-docs/hypercore/multi-sig)
wrapper after all signers have signed the inner action. The inner signing differs for L1 and user-signed actions. Use `isTestnet: true` when signing for the testnet, as with `signL1Action`.
###
[hashtag](https://nktkas.gitbook.io/hyperliquid/signing#l1-actions-1)
L1 actions
Each signer signs the `[multiSigUser, outerSigner, action]` tuple via `signL1Action`. The leader (first signer) then signs the wrapper via `signMultiSigAction`:
###
[hashtag](https://nktkas.gitbook.io/hyperliquid/signing#user-signed)
User-signed
Each signer signs the action with embedded `payloadMultiSigUser` and `outerSigner` fields via `signUserSignedAction`. The leader then signs the wrapper via `signMultiSigAction`:
[hashtag](https://nktkas.gitbook.io/hyperliquid/signing#wallet-compatibility)
Wallet compatibility
-------------------------------------------------------------------------------------------------------
All signing functions accept `AbstractWallet` — a union of supported wallet interfaces:
`signTypedData`
Address
Chain ID
[viem Local Accountarrow-up-right](https://viem.sh/docs/accounts/local)
1 param (object)
`address` property
fallback `0x1`
[viem JSON-RPC Accountarrow-up-right](https://viem.sh/docs/clients/wallet#json-rpc-accounts)
1 param (object)
`getAddresses()`
`getChainId()`
[ethers Signerarrow-up-right](https://docs.ethers.org/v6/api/providers/#Signer)
3 params
`getAddress()`
`provider.getNetwork()`
Any object matching one of these interfaces works. See the [Custom tab](https://nktkas.gitbook.io/hyperliquid/signing#l1-actions)
in signing examples.
###
[hashtag](https://nktkas.gitbook.io/hyperliquid/signing#helpers)
Helpers
These functions work with any supported wallet type:
* `getWalletAddress` — returns the wallet address, always lowercase
* `getWalletChainId` — returns the wallet chain ID as hex, falls back to `"0x1"` for local wallets without a provider
[PreviousUtilitieschevron-left](https://nktkas.gitbook.io/hyperliquid/utilities)
[NextMarket orderschevron-right](https://nktkas.gitbook.io/hyperliquid/guides/market-orders)
Last updated 5 days ago
* [How signing works](https://nktkas.gitbook.io/hyperliquid/signing#how-signing-works)
* [L1 action](https://nktkas.gitbook.io/hyperliquid/signing#l1-action)
* [User-signed action](https://nktkas.gitbook.io/hyperliquid/signing#user-signed-action)
* [Common rules](https://nktkas.gitbook.io/hyperliquid/signing#common-rules)
* [L1 actions](https://nktkas.gitbook.io/hyperliquid/signing#l1-actions)
* [User-signed actions](https://nktkas.gitbook.io/hyperliquid/signing#user-signed-actions)
* [Action hashing](https://nktkas.gitbook.io/hyperliquid/signing#action-hashing)
* [Multi-sig actions](https://nktkas.gitbook.io/hyperliquid/signing#multi-sig-actions)
* [L1 actions](https://nktkas.gitbook.io/hyperliquid/signing#l1-actions-1)
* [User-signed](https://nktkas.gitbook.io/hyperliquid/signing#user-signed)
* [Wallet compatibility](https://nktkas.gitbook.io/hyperliquid/signing#wallet-compatibility)
* [Helpers](https://nktkas.gitbook.io/hyperliquid/signing#helpers)
sun-brightdesktopmoon
Copy
import { signL1Action } from "@nktkas/hyperliquid/signing";
import { privateKeyToAccount } from "viem/accounts";
const wallet = privateKeyToAccount("0x...");
const action = { type: "cancel", cancels: [{ a: 0, o: 12345 }] };
const nonce = Date.now();
const signature = await signL1Action({ wallet, action, nonce });
await fetch("https://api.hyperliquid.xyz/exchange", {
method: "POST",
headers: { "Content-Type": "application/json" },
body: JSON.stringify({ action, signature, nonce }),
});
Copy
import { signL1Action } from "@nktkas/hyperliquid/signing";
import { Wallet } from "ethers";
const wallet = new Wallet("0x...");
const action = { type: "cancel", cancels: [{ a: 0, o: 12345 }] };
const nonce = Date.now();
const signature = await signL1Action({ wallet, action, nonce });
await fetch("https://api.hyperliquid.xyz/exchange", {
method: "POST",
headers: { "Content-Type": "application/json" },
body: JSON.stringify({ action, signature, nonce }),
});
Copy
import { signL1Action } from "@nktkas/hyperliquid/signing";
import { createWalletClient, custom } from "viem";
import { arbitrum } from "viem/chains";
const wallet = createWalletClient({
chain: arbitrum,
transport: custom(window.ethereum!),
});
const action = { type: "cancel", cancels: [{ a: 0, o: 12345 }] };
const nonce = Date.now();
const signature = await signL1Action({ wallet, action, nonce });
await fetch("https://api.hyperliquid.xyz/exchange", {
method: "POST",
headers: { "Content-Type": "application/json" },
body: JSON.stringify({ action, signature, nonce }),
});
Copy
import { signL1Action } from "@nktkas/hyperliquid/signing";
import { BrowserProvider } from "ethers";
const provider = new BrowserProvider(window.ethereum!);
const wallet = await provider.getSigner();
const action = { type: "cancel", cancels: [{ a: 0, o: 12345 }] };
const nonce = Date.now();
const signature = await signL1Action({ wallet, action, nonce });
await fetch("https://api.hyperliquid.xyz/exchange", {
method: "POST",
headers: { "Content-Type": "application/json" },
body: JSON.stringify({ action, signature, nonce }),
});
Copy
import { signL1Action } from "@nktkas/hyperliquid/signing";
import type { AbstractViemLocalAccount } from "@nktkas/hyperliquid/signing";
const wallet: AbstractViemLocalAccount = {
address: "0x...",
async signTypedData({ domain, types, primaryType, message }) {
// Your EIP-712 signing logic (HSM, MPC, remote signer, etc.)
return "0x...";
},
};
const action = { type: "cancel", cancels: [{ a: 0, o: 12345 }] };
const nonce = Date.now();
const signature = await signL1Action({ wallet, action, nonce });
await fetch("https://api.hyperliquid.xyz/exchange", {
method: "POST",
headers: { "Content-Type": "application/json" },
body: JSON.stringify({ action, signature, nonce }),
});
Copy
import { signUserSignedAction } from "@nktkas/hyperliquid/signing";
import { ApproveAgentTypes } from "@nktkas/hyperliquid/api/exchange";
import { privateKeyToAccount } from "viem/accounts";
const wallet = privateKeyToAccount("0x...");
const action = {
type: "approveAgent",
signatureChainId: "0x66eee",
hyperliquidChain: "Mainnet",
agentAddress: "0x...",
agentName: "Agent",
nonce: Date.now(),
};
const signature = await signUserSignedAction({ wallet, action, types: ApproveAgentTypes });
await fetch("https://api.hyperliquid.xyz/exchange", {
method: "POST",
headers: { "Content-Type": "application/json" },
body: JSON.stringify({ action, signature, nonce: action.nonce }),
});
Copy
import { signUserSignedAction } from "@nktkas/hyperliquid/signing";
import { ApproveAgentTypes } from "@nktkas/hyperliquid/api/exchange";
import { Wallet } from "ethers";
const wallet = new Wallet("0x...");
const action = {
type: "approveAgent",
signatureChainId: "0x66eee",
hyperliquidChain: "Mainnet",
agentAddress: "0x...",
agentName: "Agent",
nonce: Date.now(),
};
const signature = await signUserSignedAction({ wallet, action, types: ApproveAgentTypes });
await fetch("https://api.hyperliquid.xyz/exchange", {
method: "POST",
headers: { "Content-Type": "application/json" },
body: JSON.stringify({ action, signature, nonce: action.nonce }),
});
Copy
import { signUserSignedAction } from "@nktkas/hyperliquid/signing";
import { ApproveAgentTypes } from "@nktkas/hyperliquid/api/exchange";
import { createWalletClient, custom } from "viem";
import { arbitrum } from "viem/chains";
const wallet = createWalletClient({
chain: arbitrum,
transport: custom(window.ethereum!),
});
const action = {
type: "approveAgent",
signatureChainId: "0x66eee",
hyperliquidChain: "Mainnet",
agentAddress: "0x...",
agentName: "Agent",
nonce: Date.now(),
};
const signature = await signUserSignedAction({ wallet, action, types: ApproveAgentTypes });
await fetch("https://api.hyperliquid.xyz/exchange", {
method: "POST",
headers: { "Content-Type": "application/json" },
body: JSON.stringify({ action, signature, nonce: action.nonce }),
});
Copy
import { signUserSignedAction } from "@nktkas/hyperliquid/signing";
import { ApproveAgentTypes } from "@nktkas/hyperliquid/api/exchange";
import { BrowserProvider } from "ethers";
const provider = new BrowserProvider(window.ethereum!);
const wallet = await provider.getSigner();
const action = {
type: "approveAgent",
signatureChainId: "0x66eee",
hyperliquidChain: "Mainnet",
agentAddress: "0x...",
agentName: "Agent",
nonce: Date.now(),
};
const signature = await signUserSignedAction({ wallet, action, types: ApproveAgentTypes });
await fetch("https://api.hyperliquid.xyz/exchange", {
method: "POST",
headers: { "Content-Type": "application/json" },
body: JSON.stringify({ action, signature, nonce: action.nonce }),
});
Copy
import { signUserSignedAction } from "@nktkas/hyperliquid/signing";
import { ApproveAgentTypes } from "@nktkas/hyperliquid/api/exchange";
import type { AbstractViemLocalAccount } from "@nktkas/hyperliquid/signing";
const wallet: AbstractViemLocalAccount = {
address: "0x...",
async signTypedData({ domain, types, primaryType, message }) {
// Your EIP-712 signing logic (HSM, MPC, remote signer, etc.)
return "0x...";
},
};
const action = {
type: "approveAgent",
signatureChainId: "0x66eee",
hyperliquidChain: "Mainnet",
agentAddress: "0x...",
agentName: "Agent",
nonce: Date.now(),
};
const signature = await signUserSignedAction({ wallet, action, types: ApproveAgentTypes });
await fetch("https://api.hyperliquid.xyz/exchange", {
method: "POST",
headers: { "Content-Type": "application/json" },
body: JSON.stringify({ action, signature, nonce: action.nonce }),
});
Copy
import { createL1ActionHash } from "@nktkas/hyperliquid/signing";
const hash = createL1ActionHash({
action: { type: "cancel", cancels: [{ a: 0, o: 12345 }] },
nonce: Date.now(),
});
Copy
import { signL1Action, signMultiSigAction } from "@nktkas/hyperliquid/signing";
import { privateKeyToAccount } from "viem/accounts";
const signers = [\
privateKeyToAccount("0x..."), // leader — signs the wrapper\
privateKeyToAccount("0x..."),\
];
const multiSigUser = "0x..."; // the multi-sig account address
const action = { type: "scheduleCancel", time: Date.now() + 10_000 };
const nonce = Date.now();
// 1. All signers sign the [user, leader, action] tuple
const signatures = await Promise.all(signers.map(async (signer) => {
return await signL1Action({
wallet: signer,
action: [multiSigUser.toLowerCase(), signers[0].address.toLowerCase(), action],
nonce,
// isTestnet: true,
});
}));
// 2. Wrap and sign with leader
const multiSigAction = {
type: "multiSig" as const,
signatureChainId: "0x66eee" as const,
signatures,
payload: {
multiSigUser: multiSigUser.toLowerCase(),
outerSigner: signers[0].address.toLowerCase(),
action,
},
};
const signature = await signMultiSigAction({
wallet: signers[0],
action: multiSigAction,
nonce,
// isTestnet: true,
});
await fetch("https://api.hyperliquid.xyz/exchange", {
method: "POST",
headers: { "Content-Type": "application/json" },
body: JSON.stringify({ action: multiSigAction, signature, nonce }),
});
Copy
import { signMultiSigAction, signUserSignedAction } from "@nktkas/hyperliquid/signing";
import { UsdSendTypes } from "@nktkas/hyperliquid/api/exchange";
import { privateKeyToAccount } from "viem/accounts";
const signers = [\
privateKeyToAccount("0x..."), // leader — signs the wrapper\
privateKeyToAccount("0x..."),\
];
const multiSigUser = "0x..."; // the multi-sig account address
const action = {
type: "usdSend",
signatureChainId: "0x66eee" as const,
hyperliquidChain: "Mainnet", // "Testnet" for testnet
destination: "0x...",
amount: "100",
time: Date.now(),
};
// 1. All signers sign the action with multi-sig fields
const signatures = await Promise.all(signers.map(async (signer) => {
return await signUserSignedAction({
wallet: signer,
action: {
payloadMultiSigUser: multiSigUser.toLowerCase() as `0x${string}`,
outerSigner: signers[0].address.toLowerCase() as `0x${string}`,
...action,
},
types: UsdSendTypes,
});
}));
// 2. Wrap and sign with leader
const multiSigAction = {
type: "multiSig",
signatureChainId: "0x66eee" as const,
signatures,
payload: {
multiSigUser: multiSigUser.toLowerCase(),
outerSigner: signers[0].address.toLowerCase(),
action,
},
};
const signature = await signMultiSigAction({
wallet: signers[0],
action: multiSigAction,
nonce: action.time,
// isTestnet: true,
});
await fetch("https://api.hyperliquid.xyz/exchange", {
method: "POST",
headers: { "Content-Type": "application/json" },
body: JSON.stringify({ action: multiSigAction, signature, nonce: action.time }),
});
Copy
import { getWalletAddress, getWalletChainId } from "@nktkas/hyperliquid/signing";
import { privateKeyToAccount } from "viem/accounts";
const wallet = privateKeyToAccount("0x...");
const address = await getWalletAddress(wallet); // "0x..."
const chainId = await getWalletChainId(wallet); // "0xa4b1"
sun-brightdesktopmoon
---
# Browser wallets | Hyperliquid
The SDK works with browser extension wallets like MetaMask.
[hashtag](https://nktkas.gitbook.io/hyperliquid/guides/browser-wallets#setup)
Setup
----------------------------------------------------------------------------------------
viem
ethers
Connect via a [JSON-RPC Accountarrow-up-right](https://viem.sh/docs/clients/wallet#json-rpc-accounts)
:
Copy
import { ExchangeClient, HttpTransport } from "@nktkas/hyperliquid";
import { createWalletClient, custom } from "viem";
import { arbitrum } from "viem/chains";
const wallet = createWalletClient({
chain: arbitrum,
transport: custom(window.ethereum!),
});
const transport = new HttpTransport();
const client = new ExchangeClient({ transport, wallet });
Connect via a [BrowserProviderarrow-up-right](https://docs.ethers.org/v6/api/providers/#BrowserProvider)
:
Copy
import { ExchangeClient, HttpTransport } from "@nktkas/hyperliquid";
import { BrowserProvider } from "ethers";
const provider = new BrowserProvider(window.ethereum!);
const wallet = await provider.getSigner();
const transport = new HttpTransport();
const client = new ExchangeClient({ transport, wallet });
[hashtag](https://nktkas.gitbook.io/hyperliquid/guides/browser-wallets#signature-prompts)
Signature prompts
----------------------------------------------------------------------------------------------------------------
Every exchange action triggers a wallet popup that the user must approve. [L1 actions](https://nktkas.gitbook.io/hyperliquid/signing#l1-action)
(trading and position management) show a [phantom agent](https://nktkas.gitbook.io/hyperliquid/signing#l1-action)
hash instead of human-readable details — this is by design, because the action is never signed directly.
To avoid repeated popups and hide unreadable L1 signatures from users, approve an [agent wallet](https://nktkas.gitbook.io/hyperliquid/guides/agent-wallets-and-vaults#agent-wallets)
once with the browser wallet, then use the agent's private key for all subsequent trades:
[PreviousAgent wallets and vaultschevron-left](https://nktkas.gitbook.io/hyperliquid/guides/agent-wallets-and-vaults)
[NextTree-shakingchevron-right](https://nktkas.gitbook.io/hyperliquid/guides/tree-shaking)
Last updated 5 days ago
* [Setup](https://nktkas.gitbook.io/hyperliquid/guides/browser-wallets#setup)
* [Signature prompts](https://nktkas.gitbook.io/hyperliquid/guides/browser-wallets#signature-prompts)
sun-brightdesktopmoon
Copy
// 1. Approve agent once (triggers wallet popup)
await client.approveAgent({
agentAddress: "0x...",
agentName: "browser-agent",
});
// 2. Trade with agent (no popups)
import { privateKeyToAccount } from "viem/accounts";
const agentClient = new ExchangeClient({
transport,
wallet: privateKeyToAccount("0x..."), // agent's private key
});
await agentClient.order({ orders: [/* ... */], grouping: "na" });
sun-brightdesktopmoon
---
# activeAssetData | Hyperliquid
###
[hashtag](https://nktkas.gitbook.io/hyperliquid/api-reference/subscription-methods/activeassetdata#post)
Subscribe to activeAssetData
post
wss://api.hyperliquid.xyz/wsMainnet WebSocketchevron-down
wss://api.hyperliquid.xyz/wswss://api.hyperliquid-testnet.xyz/ws
/copy
Subscription to active asset data events for a specific user and coin.
Body
application/jsonchevron-down
application/json
Subscription to active asset data events for a specific user and coin.
typeundefined · enumRequired
Type of subscription.
Possible values: `activeAssetData`
coinstringRequired
Asset symbol (e.g., BTC).
userstring · min: 42 · max: 42Required
User address.
Pattern: `^0[xX][0-9a-fA-F]+$`
Responses
chevron-right
200
Event of user active asset data.
application/json
anyOptional
Event of user active asset data.
post
/
TypeScript
200
Event of user active asset data.
No content
[PreviousactiveAssetCtxchevron-left](https://nktkas.gitbook.io/hyperliquid/api-reference/subscription-methods/activeassetctx)
[NextactiveSpotAssetCtxchevron-right](https://nktkas.gitbook.io/hyperliquid/api-reference/subscription-methods/activespotassetctx)
Last updated 5 days ago
sun-brightdesktopmoon
Copy
import * as hl from "@nktkas/hyperliquid";
const transport = new hl.WebSocketTransport();
const client = new hl.SubscriptionClient({ transport });
const sub = await client.activeAssetData({ coin: "ETH", user: "0x..." }, (data) => {
console.log(data);
});
sun-brightdesktopmoon
---
# activeAssetCtx | Hyperliquid
###
[hashtag](https://nktkas.gitbook.io/hyperliquid/api-reference/subscription-methods/activeassetctx#post)
Subscribe to activeAssetCtx
post
wss://api.hyperliquid.xyz/wsMainnet WebSocketchevron-down
wss://api.hyperliquid.xyz/wswss://api.hyperliquid-testnet.xyz/ws
/copy
Subscription to context events for a specific perpetual asset.
Body
application/jsonchevron-down
application/json
Subscription to context events for a specific perpetual asset.
typeundefined · enumRequired
Type of subscription.
Possible values: `activeAssetCtx`
coinstringRequired
Asset symbol (e.g., BTC).
Responses
chevron-right
200
Event of active perpetual asset context.
application/json
Event of active perpetual asset context.
coinstringRequired
Asset symbol (e.g., BTC).
post
/
TypeScript
200
Event of active perpetual asset context.
[PreviousSubscription Methodschevron-left](https://nktkas.gitbook.io/hyperliquid/api-reference/subscription-methods)
[NextactiveAssetDatachevron-right](https://nktkas.gitbook.io/hyperliquid/api-reference/subscription-methods/activeassetdata)
Last updated 5 days ago
sun-brightdesktopmoon
Copy
import * as hl from "@nktkas/hyperliquid";
const transport = new hl.WebSocketTransport();
const client = new hl.SubscriptionClient({ transport });
const sub = await client.activeAssetCtx({ coin: "ETH" }, (data) => {
console.log(data);
});
Copy
{
"coin": "text",
"ctx": null
}
sun-brightdesktopmoon
---
# activeSpotAssetCtx | Hyperliquid
###
[hashtag](https://nktkas.gitbook.io/hyperliquid/api-reference/subscription-methods/activespotassetctx#post)
Subscribe to activeSpotAssetCtx
post
wss://api.hyperliquid.xyz/wsMainnet WebSocketchevron-down
wss://api.hyperliquid.xyz/wswss://api.hyperliquid-testnet.xyz/ws
/copy
Subscription to context events for a specific spot asset.
Body
application/jsonchevron-down
application/json
Subscription to context events for a specific spot asset.
typeundefined · enumRequired
Type of subscription.
Possible values: `activeAssetCtx`
coinstringRequired
Asset ID (e.g., @1).
Responses
chevron-right
200
Event of active spot asset context.
application/json
Event of active spot asset context.
coinstringRequired
Asset ID (e.g.,
post
/
TypeScript
200
Event of active spot asset context.
[PreviousactiveAssetDatachevron-left](https://nktkas.gitbook.io/hyperliquid/api-reference/subscription-methods/activeassetdata)
[NextallDexsAssetCtxschevron-right](https://nktkas.gitbook.io/hyperliquid/api-reference/subscription-methods/alldexsassetctxs)
Last updated 5 days ago
sun-brightdesktopmoon
Copy
import * as hl from "@nktkas/hyperliquid";
const transport = new hl.WebSocketTransport();
const client = new hl.SubscriptionClient({ transport });
const sub = await client.activeSpotAssetCtx({ coin: "@1" }, (data) => {
console.log(data);
});
Copy
{
"coin": "text",
"ctx": null
}
sun-brightdesktopmoon
---
# allMids | Hyperliquid
###
[hashtag](https://nktkas.gitbook.io/hyperliquid/api-reference/subscription-methods/allmids#post)
Subscribe to allMids
post
wss://api.hyperliquid.xyz/wsMainnet WebSocketchevron-down
wss://api.hyperliquid.xyz/wswss://api.hyperliquid-testnet.xyz/ws
/copy
Subscription to mid price events for all coins.
Body
application/jsonchevron-down
application/json
Subscription to mid price events for all coins.
typeundefined · enumRequired
Type of subscription.
Possible values: `allMids`
dexstringOptional
DEX name (empty string for main dex).
Responses
chevron-right
200
Event of mid prices for all assets.
application/json
Event of mid prices for all assets.
dexstringOptional
DEX name (empty string for main dex).
post
/
TypeScript
200
Event of mid prices for all assets.
[PreviousallDexsClearinghouseStatechevron-left](https://nktkas.gitbook.io/hyperliquid/api-reference/subscription-methods/alldexsclearinghousestate)
[NextassetCtxschevron-right](https://nktkas.gitbook.io/hyperliquid/api-reference/subscription-methods/assetctxs)
Last updated 5 days ago
sun-brightdesktopmoon
Copy
import * as hl from "@nktkas/hyperliquid";
const transport = new hl.WebSocketTransport();
const client = new hl.SubscriptionClient({ transport });
const sub = await client.allMids((data) => {
console.log(data);
});
Copy
{
"mids": null,
"dex": "text"
}
sun-brightdesktopmoon
---
# explorerTxs | Hyperliquid
###
[hashtag](https://nktkas.gitbook.io/hyperliquid/api-reference/subscription-methods/explorertxs#post)
Subscribe to explorerTxs
post
wss://api.hyperliquid.xyz/wsMainnet WebSocketchevron-down
wss://api.hyperliquid.xyz/wswss://api.hyperliquid-testnet.xyz/ws
/copy
Subscription to explorer transaction events.
Body
application/jsonchevron-down
application/json
Subscription to explorer transaction events.
typeundefined · enumRequired
Type of subscription.
Possible values: `explorerTxs`
Responses
chevron-right
200
Event of array of transaction details.
application/json
ExplorerTransactionSchema\[\]Optional
Event of array of transaction details.
post
/
TypeScript
200
Event of array of transaction details.
[PreviousexplorerBlockchevron-left](https://nktkas.gitbook.io/hyperliquid/api-reference/subscription-methods/explorerblock)
[Nextl2Bookchevron-right](https://nktkas.gitbook.io/hyperliquid/api-reference/subscription-methods/l2book)
Last updated 5 days ago
sun-brightdesktopmoon
Copy
import * as hl from "@nktkas/hyperliquid";
const transport = new hl.WebSocketTransport({ url: "wss://rpc.hyperliquid.xyz/ws" }); // RPC endpoint
const client = new hl.SubscriptionClient({ transport });
const sub = await client.explorerTxs((data) => {
console.log(data);
});
Copy
[]
sun-brightdesktopmoon
---
# bbo | Hyperliquid
###
[hashtag](https://nktkas.gitbook.io/hyperliquid/api-reference/subscription-methods/bbo#post)
Subscribe to bbo
post
wss://api.hyperliquid.xyz/wsMainnet WebSocketchevron-down
wss://api.hyperliquid.xyz/wswss://api.hyperliquid-testnet.xyz/ws
/copy
Subscription to best bid and offer events for a specific asset.
Body
application/jsonchevron-down
application/json
Subscription to best bid and offer events for a specific asset.
typeundefined · enumRequired
Type of subscription.
Possible values: `bbo`
coinstringRequired
Asset symbol (e.g., BTC).
Responses
chevron-right
200
Event of best bid and offer.
application/json
Event of best bid and offer.
coinstringRequired
Asset symbol (e.g., BTC).
timenumberRequired
Time of the BBO update (in ms since epoch).
bboany\[\] · min: 2 · max: 2Required
Best bid and offer tuple \[bid, offer\], either can be undefined if unavailable.
Show propertiesplus
post
/
TypeScript
200
Event of best bid and offer.
[PreviousassetCtxschevron-left](https://nktkas.gitbook.io/hyperliquid/api-reference/subscription-methods/assetctxs)
[Nextcandlechevron-right](https://nktkas.gitbook.io/hyperliquid/api-reference/subscription-methods/candle)
Last updated 5 days ago
sun-brightdesktopmoon
Copy
import * as hl from "@nktkas/hyperliquid";
const transport = new hl.WebSocketTransport();
const client = new hl.SubscriptionClient({ transport });
const sub = await client.bbo({ coin: "ETH" }, (data) => {
console.log(data);
});
Copy
{
"coin": "text",
"time": 1,
"bbo": []
}
sun-brightdesktopmoon
---
# assetCtxs | Hyperliquid
###
[hashtag](https://nktkas.gitbook.io/hyperliquid/api-reference/subscription-methods/assetctxs#post)
Subscribe to assetCtxs
post
wss://api.hyperliquid.xyz/wsMainnet WebSocketchevron-down
wss://api.hyperliquid.xyz/wswss://api.hyperliquid-testnet.xyz/ws
/copy
Subscription to context events for all perpetual assets.
Body
application/jsonchevron-down
application/json
Subscription to context events for all perpetual assets.
typeundefined · enumRequired
Type of subscription.
Possible values: `assetCtxs`
dexstringOptional
DEX name (empty string for main dex).
Responses
chevron-right
200
Event of asset contexts for all perpetual assets on a specified DEX.
application/json
Event of asset contexts for all perpetual assets on a specified DEX.
dexstringRequired
DEX name (empty string for main dex).
ctxsPerpAssetCtxSchema\[\]Required
Array of context information for each perpetual asset.
post
/
TypeScript
200
Event of asset contexts for all perpetual assets on a specified DEX.
[PreviousallMidschevron-left](https://nktkas.gitbook.io/hyperliquid/api-reference/subscription-methods/allmids)
[Nextbbochevron-right](https://nktkas.gitbook.io/hyperliquid/api-reference/subscription-methods/bbo)
Last updated 5 days ago
sun-brightdesktopmoon
Copy
import * as hl from "@nktkas/hyperliquid";
const transport = new hl.WebSocketTransport();
const client = new hl.SubscriptionClient({ transport });
const sub = await client.assetCtxs((data) => {
console.log(data);
});
Copy
{
"dex": "text",
"ctxs": []
}
sun-brightdesktopmoon
---
# explorerBlock | Hyperliquid
###
[hashtag](https://nktkas.gitbook.io/hyperliquid/api-reference/subscription-methods/explorerblock#post)
Subscribe to explorerBlock
post
wss://api.hyperliquid.xyz/wsMainnet WebSocketchevron-down
wss://api.hyperliquid.xyz/wswss://api.hyperliquid-testnet.xyz/ws
/copy
Subscription to explorer block events.
Body
application/jsonchevron-down
application/json
Subscription to explorer block events.
typeundefined · enumRequired
Type of subscription.
Possible values: `explorerBlock`
Responses
chevron-right
200
Event of array of block details.
application/json
Event of array of block details.
blockTimenumberRequired
Block creation timestamp.
hashstringRequired
Block hash.
Pattern: `^0x[a-fA-F0-9]{64}$`
heightnumberRequired
Block height in chain.
numTxsnumberRequired
Total transactions in block.
proposerstringRequired
Block proposer address.
Pattern: `^0x[a-fA-F0-9]{40}$`
post
/
TypeScript
200
Event of array of block details.
[PreviousclearinghouseStatechevron-left](https://nktkas.gitbook.io/hyperliquid/api-reference/subscription-methods/clearinghousestate)
[NextexplorerTxschevron-right](https://nktkas.gitbook.io/hyperliquid/api-reference/subscription-methods/explorertxs)
Last updated 5 days ago
sun-brightdesktopmoon
Copy
import * as hl from "@nktkas/hyperliquid";
const transport = new hl.WebSocketTransport({ url: "wss://rpc.hyperliquid.xyz/ws" }); // RPC endpoint
const client = new hl.SubscriptionClient({ transport });
const sub = await client.explorerBlock((data) => {
console.log(data);
});
Copy
[\
{\
"blockTime": 1,\
"hash": "text",\
"height": 1,\
"numTxs": 1,\
"proposer": "text"\
}\
]
sun-brightdesktopmoon
---
# allDexsClearinghouseState | Hyperliquid
###
[hashtag](https://nktkas.gitbook.io/hyperliquid/api-reference/subscription-methods/alldexsclearinghousestate#post)
Subscribe to allDexsClearinghouseState
post
wss://api.hyperliquid.xyz/wsMainnet WebSocketchevron-down
wss://api.hyperliquid.xyz/wswss://api.hyperliquid-testnet.xyz/ws
/copy
Subscription to clearinghouse state events for all DEXs for a specific user.
Body
application/jsonchevron-down
application/json
Subscription to clearinghouse state events for all DEXs for a specific user.
typeundefined · enumRequired
Type of subscription.
Possible values: `allDexsClearinghouseState`
userstring · min: 42 · max: 42Required
User address.
Pattern: `^0[xX][0-9a-fA-F]+$`
Responses
chevron-right
200
Event of clearinghouse states for all DEXs for a specific user.
application/json
Event of clearinghouse states for all DEXs for a specific user.
userstringRequired
User address.
Pattern: `^0x[a-fA-F0-9]{40}$`
clearinghouseStatesany\[\]\[\]Required
Array of tuples of dex names and clearinghouse states.
Show propertiesplus
post
/
TypeScript
200
Event of clearinghouse states for all DEXs for a specific user.
[PreviousallDexsAssetCtxschevron-left](https://nktkas.gitbook.io/hyperliquid/api-reference/subscription-methods/alldexsassetctxs)
[NextallMidschevron-right](https://nktkas.gitbook.io/hyperliquid/api-reference/subscription-methods/allmids)
Last updated 5 days ago
sun-brightdesktopmoon
Copy
import * as hl from "@nktkas/hyperliquid";
const transport = new hl.WebSocketTransport();
const client = new hl.SubscriptionClient({ transport });
const sub = await client.allDexsClearinghouseState({ user: "0x..." }, (data) => {
console.log(data);
});
Copy
{
"user": "text",
"clearinghouseStates": [\
[]\
]
}
sun-brightdesktopmoon
---
# l2Book | Hyperliquid
###
[hashtag](https://nktkas.gitbook.io/hyperliquid/api-reference/subscription-methods/l2book#post)
Subscribe to l2Book
post
wss://api.hyperliquid.xyz/wsMainnet WebSocketchevron-down
wss://api.hyperliquid.xyz/wswss://api.hyperliquid-testnet.xyz/ws
/copy
Subscription to L2 order book events for a specific asset.
Body
application/jsonchevron-down
application/json
Subscription to L2 order book events for a specific asset.
typeundefined · enumRequired
Type of subscription.
Possible values: `l2Book`
coinstringRequired
Asset symbol (e.g., BTC).
nSigFigsany ofOptional
Number of significant figures.
undefined · enum · nullableOptional
Number of significant figures.
Possible values: `2``3``4``5`
mantissaany ofOptional
Mantissa for aggregation (if `nSigFigs` is 5).
undefined · enum · nullableOptional
Mantissa for aggregation (if `nSigFigs` is 5).
Possible values: `2``5`
Responses
chevron-right
200
Event of L2 order book snapshot.
application/json
Event of L2 order book snapshot.
coinstringRequired
Asset symbol.
timenumberRequired
Timestamp of the snapshot (in ms since epoch).
levelsany\[\] · min: 2 · max: 2Required
Bid and ask levels (index 0 = bids, index 1 = asks).
Show propertiesplus
spreadstringOptional
Spread (only present when `nSigFigs` is non-null).
Pattern: `^[0-9]+(\.[0-9]+)?$`
post
/
TypeScript
200
Event of L2 order book snapshot.
[PreviousexplorerTxschevron-left](https://nktkas.gitbook.io/hyperliquid/api-reference/subscription-methods/explorertxs)
[Nextnotificationchevron-right](https://nktkas.gitbook.io/hyperliquid/api-reference/subscription-methods/notification)
Last updated 5 days ago
sun-brightdesktopmoon
Copy
import * as hl from "@nktkas/hyperliquid";
const transport = new hl.WebSocketTransport();
const client = new hl.SubscriptionClient({ transport });
const sub = await client.l2Book({ coin: "ETH" }, (data) => {
console.log(data);
});
Copy
{
"coin": "text",
"time": 1,
"levels": [],
"spread": "text"
}
sun-brightdesktopmoon
---
# clearinghouseState | Hyperliquid
###
[hashtag](https://nktkas.gitbook.io/hyperliquid/api-reference/subscription-methods/clearinghousestate#post)
Subscribe to clearinghouseState
post
wss://api.hyperliquid.xyz/wsMainnet WebSocketchevron-down
wss://api.hyperliquid.xyz/wswss://api.hyperliquid-testnet.xyz/ws
/copy
Subscription to clearinghouse state events for a specific user.
Body
application/jsonchevron-down
application/json
Subscription to clearinghouse state events for a specific user.
typeundefined · enumRequired
Type of subscription.
Possible values: `clearinghouseState`
userstring · min: 42 · max: 42Required
User address.
Pattern: `^0[xX][0-9a-fA-F]+$`
dexstringOptional
DEX name (empty string for main dex).
Responses
chevron-right
200
Event of clearinghouse state for a specific user.
application/json
Event of clearinghouse state for a specific user.
dexstringRequired
DEX name (empty string for main dex).
userstringRequired
User address.
Pattern: `^0x[a-fA-F0-9]{40}$`
post
/
TypeScript
200
Event of clearinghouse state for a specific user.
[Previouscandlechevron-left](https://nktkas.gitbook.io/hyperliquid/api-reference/subscription-methods/candle)
[NextexplorerBlockchevron-right](https://nktkas.gitbook.io/hyperliquid/api-reference/subscription-methods/explorerblock)
Last updated 5 days ago
sun-brightdesktopmoon
Copy
import * as hl from "@nktkas/hyperliquid";
const transport = new hl.WebSocketTransport();
const client = new hl.SubscriptionClient({ transport });
const sub = await client.clearinghouseState({ user: "0x..." }, (data) => {
console.log(data);
});
Copy
{
"dex": "text",
"user": "text",
"clearinghouseState": null
}
sun-brightdesktopmoon
---
# notification | Hyperliquid
###
[hashtag](https://nktkas.gitbook.io/hyperliquid/api-reference/subscription-methods/notification#post)
Subscribe to notification
post
wss://api.hyperliquid.xyz/wsMainnet WebSocketchevron-down
wss://api.hyperliquid.xyz/wswss://api.hyperliquid-testnet.xyz/ws
/copy
Subscription to notification events for a specific user.
Body
application/jsonchevron-down
application/json
Subscription to notification events for a specific user.
typeundefined · enumRequired
Type of subscription.
Possible values: `notification`
userstring · min: 42 · max: 42Required
User address.
Pattern: `^0[xX][0-9a-fA-F]+$`
Responses
chevron-right
200
Event of user notification.
application/json
Event of user notification.
notificationstringRequired
Notification content.
post
/
TypeScript
200
Event of user notification.
[Previousl2Bookchevron-left](https://nktkas.gitbook.io/hyperliquid/api-reference/subscription-methods/l2book)
[NextopenOrderschevron-right](https://nktkas.gitbook.io/hyperliquid/api-reference/subscription-methods/openorders)
Last updated 5 days ago
sun-brightdesktopmoon
Copy
import * as hl from "@nktkas/hyperliquid";
const transport = new hl.WebSocketTransport();
const client = new hl.SubscriptionClient({ transport });
const sub = await client.notification({ user: "0x..." }, (data) => {
console.log(data);
});
Copy
{
"notification": "text"
}
sun-brightdesktopmoon
---
# openOrders | Hyperliquid
###
[hashtag](https://nktkas.gitbook.io/hyperliquid/api-reference/subscription-methods/openorders#post)
Subscribe to openOrders
post
wss://api.hyperliquid.xyz/wsMainnet WebSocketchevron-down
wss://api.hyperliquid.xyz/wswss://api.hyperliquid-testnet.xyz/ws
/copy
Subscription to open order events for a specific user.
Body
application/jsonchevron-down
application/json
Subscription to open order events for a specific user.
typeundefined · enumRequired
Type of subscription.
Possible values: `openOrders`
userstring · min: 42 · max: 42Required
User address.
Pattern: `^0[xX][0-9a-fA-F]+$`
dexstringOptional
DEX name (empty string for main dex).
Responses
chevron-right
200
Event of open orders for a specific user.
application/json
Event of open orders for a specific user.
dexstringRequired
DEX name (empty string for main dex).
userstringRequired
User address.
Pattern: `^0x[a-fA-F0-9]{40}$`
post
/
TypeScript
200
Event of open orders for a specific user.
[Previousnotificationchevron-left](https://nktkas.gitbook.io/hyperliquid/api-reference/subscription-methods/notification)
[NextorderUpdateschevron-right](https://nktkas.gitbook.io/hyperliquid/api-reference/subscription-methods/orderupdates)
Last updated 5 days ago
sun-brightdesktopmoon
Copy
import * as hl from "@nktkas/hyperliquid";
const transport = new hl.WebSocketTransport();
const client = new hl.SubscriptionClient({ transport });
const sub = await client.openOrders({ user: "0x..." }, (data) => {
console.log(data);
});
Copy
{
"dex": "text",
"user": "text",
"orders": null
}
sun-brightdesktopmoon
---
# spotState | Hyperliquid
###
[hashtag](https://nktkas.gitbook.io/hyperliquid/api-reference/subscription-methods/spotstate#post)
Subscribe to spotState
post
wss://api.hyperliquid.xyz/wsMainnet WebSocketchevron-down
wss://api.hyperliquid.xyz/wswss://api.hyperliquid-testnet.xyz/ws
/copy
Subscription to spot state events for a specific user.
Body
application/jsonchevron-down
application/json
Subscription to spot state events for a specific user.
typeundefined · enumRequired
Type of subscription.
Possible values: `spotState`
userstring · min: 42 · max: 42Required
User address.
Pattern: `^0[xX][0-9a-fA-F]+$`
ignorePortfolioMarginbooleanOptional
Whether to ignore portfolio margin calculations.
Responses
chevron-right
200
Event of user spot state.
application/json
Event of user spot state.
userstringRequired
User address.
Pattern: `^0x[a-fA-F0-9]{40}$`
post
/
TypeScript
200
Event of user spot state.
[PreviousspotAssetCtxschevron-left](https://nktkas.gitbook.io/hyperliquid/api-reference/subscription-methods/spotassetctxs)
[Nexttradeschevron-right](https://nktkas.gitbook.io/hyperliquid/api-reference/subscription-methods/trades)
Last updated 5 days ago
sun-brightdesktopmoon
Copy
import * as hl from "@nktkas/hyperliquid";
const transport = new hl.WebSocketTransport();
const client = new hl.SubscriptionClient({ transport });
const sub = await client.spotState({ user: "0x..." }, (data) => {
console.log(data);
});
Copy
{
"user": "text",
"spotState": null
}
sun-brightdesktopmoon
---
# spotAssetCtxs | Hyperliquid
###
[hashtag](https://nktkas.gitbook.io/hyperliquid/api-reference/subscription-methods/spotassetctxs#post)
Subscribe to spotAssetCtxs
post
wss://api.hyperliquid.xyz/wsMainnet WebSocketchevron-down
wss://api.hyperliquid.xyz/wswss://api.hyperliquid-testnet.xyz/ws
/copy
Subscription to context events for all spot assets.
Body
application/jsonchevron-down
application/json
Subscription to context events for all spot assets.
typeundefined · enumRequired
Type of subscription.
Possible values: `spotAssetCtxs`
Responses
chevron-right
200
Event of spot asset contexts.
application/json
SpotAssetCtxSchema\[\]Optional
Event of spot asset contexts.
post
/
TypeScript
200
Event of spot asset contexts.
[PreviousorderUpdateschevron-left](https://nktkas.gitbook.io/hyperliquid/api-reference/subscription-methods/orderupdates)
[NextspotStatechevron-right](https://nktkas.gitbook.io/hyperliquid/api-reference/subscription-methods/spotstate)
Last updated 5 days ago
sun-brightdesktopmoon
Copy
import * as hl from "@nktkas/hyperliquid";
const transport = new hl.WebSocketTransport();
const client = new hl.SubscriptionClient({ transport });
const sub = await client.spotAssetCtxs((data) => {
console.log(data);
});
Copy
[]
sun-brightdesktopmoon
---
# trades | Hyperliquid
###
[hashtag](https://nktkas.gitbook.io/hyperliquid/api-reference/subscription-methods/trades#post)
Subscribe to trades
post
wss://api.hyperliquid.xyz/wsMainnet WebSocketchevron-down
wss://api.hyperliquid.xyz/wswss://api.hyperliquid-testnet.xyz/ws
/copy
Subscription to trade events for a specific asset.
Body
application/jsonchevron-down
application/json
Subscription to trade events for a specific asset.
typeundefined · enumRequired
Type of subscription.
Possible values: `trades`
coinstringRequired
Asset symbol (e.g., BTC).
Responses
chevron-right
200
Event of array of trades for a specific asset.
application/json
anyOptional
Event of array of trades for a specific asset.
post
/
TypeScript
200
Event of array of trades for a specific asset.
No content
[PreviousspotStatechevron-left](https://nktkas.gitbook.io/hyperliquid/api-reference/subscription-methods/spotstate)
[NexttwapStateschevron-right](https://nktkas.gitbook.io/hyperliquid/api-reference/subscription-methods/twapstates)
Last updated 5 days ago
sun-brightdesktopmoon
Copy
import * as hl from "@nktkas/hyperliquid";
const transport = new hl.WebSocketTransport();
const client = new hl.SubscriptionClient({ transport });
const sub = await client.trades({ coin: "ETH" }, (data) => {
console.log(data);
});
sun-brightdesktopmoon
---
# userTwapHistory | Hyperliquid
###
[hashtag](https://nktkas.gitbook.io/hyperliquid/api-reference/subscription-methods/usertwaphistory#post)
Subscribe to userTwapHistory
post
wss://api.hyperliquid.xyz/wsMainnet WebSocketchevron-down
wss://api.hyperliquid.xyz/wswss://api.hyperliquid-testnet.xyz/ws
/copy
Subscription to user TWAP history events for a specific user.
Body
application/jsonchevron-down
application/json
Subscription to user TWAP history events for a specific user.
typeundefined · enumRequired
Type of subscription.
Possible values: `userTwapHistory`
userstring · min: 42 · max: 42Required
User address.
Pattern: `^0[xX][0-9a-fA-F]+$`
Responses
chevron-right
200
Event of user TWAP history.
application/json
Event of user TWAP history.
userstringRequired
User address.
Pattern: `^0x[a-fA-F0-9]{40}$`
isSnapshotboolean · enumOptional
Whether this is an initial snapshot.
Possible values: `true`
post
/
TypeScript
200
Event of user TWAP history.
[PrevioususerNonFundingLedgerUpdateschevron-left](https://nktkas.gitbook.io/hyperliquid/api-reference/subscription-methods/usernonfundingledgerupdates)
[NextuserTwapSliceFillschevron-right](https://nktkas.gitbook.io/hyperliquid/api-reference/subscription-methods/usertwapslicefills)
Last updated 5 days ago
sun-brightdesktopmoon
Copy
import * as hl from "@nktkas/hyperliquid";
const transport = new hl.WebSocketTransport();
const client = new hl.SubscriptionClient({ transport });
const sub = await client.userTwapHistory({ user: "0x..." }, (data) => {
console.log(data);
});
Copy
{
"user": "text",
"history": null,
"isSnapshot": true
}
sun-brightdesktopmoon
---
# candle | Hyperliquid
###
[hashtag](https://nktkas.gitbook.io/hyperliquid/api-reference/subscription-methods/candle#post)
Subscribe to candle
post
wss://api.hyperliquid.xyz/wsMainnet WebSocketchevron-down
wss://api.hyperliquid.xyz/wswss://api.hyperliquid-testnet.xyz/ws
/copy
Subscription to candlestick events for a specific asset and time interval.
Body
application/jsonchevron-down
application/json
Subscription to candlestick events for a specific asset and time interval.
typeundefined · enumRequired
Type of subscription.
Possible values: `candle`
coinstringRequired
Asset symbol (e.g., BTC).
intervalundefined · enumRequired
Time interval.
Possible values: `1m``3m``5m``15m``30m``1h``2h``4h``8h``12h``1d``3d``1w``1M`
Responses
chevron-right
200
Event of candlestick data point.
application/json
Event of candlestick data point.
tnumberRequired
Opening timestamp (ms since epoch).
TnumberRequired
Closing timestamp (ms since epoch).
sstringRequired
Asset symbol.
istring · enumRequired
Time interval.
Possible values: `1m``3m``5m``15m``30m``1h``2h``4h``8h``12h``1d``3d``1w``1M`
ostringRequired
Opening price.
Pattern: `^[0-9]+(\.[0-9]+)?$`
cstringRequired
Closing price.
Pattern: `^[0-9]+(\.[0-9]+)?$`
hstringRequired
Highest price.
Pattern: `^[0-9]+(\.[0-9]+)?$`
lstringRequired
Lowest price.
Pattern: `^[0-9]+(\.[0-9]+)?$`
vstringRequired
Total volume traded in base currency.
Pattern: `^[0-9]+(\.[0-9]+)?$`
nnumberRequired
Number of trades executed.
post
/
TypeScript
200
Event of candlestick data point.
[Previousbbochevron-left](https://nktkas.gitbook.io/hyperliquid/api-reference/subscription-methods/bbo)
[NextclearinghouseStatechevron-right](https://nktkas.gitbook.io/hyperliquid/api-reference/subscription-methods/clearinghousestate)
Last updated 5 days ago
sun-brightdesktopmoon
Copy
import * as hl from "@nktkas/hyperliquid";
const transport = new hl.WebSocketTransport();
const client = new hl.SubscriptionClient({ transport });
const sub = await client.candle({ coin: "ETH", interval: "1h" }, (data) => {
console.log(data);
});
Copy
{
"t": 1,
"T": 1,
"s": "text",
"i": "1m",
"o": "text",
"c": "text",
"h": "text",
"l": "text",
"v": "text",
"n": 1
}
sun-brightdesktopmoon
---
# userFills | Hyperliquid
###
[hashtag](https://nktkas.gitbook.io/hyperliquid/api-reference/subscription-methods/userfills#post)
Subscribe to userFills
post
wss://api.hyperliquid.xyz/wsMainnet WebSocketchevron-down
wss://api.hyperliquid.xyz/wswss://api.hyperliquid-testnet.xyz/ws
/copy
Subscription to user fill events for a specific user.
Body
application/jsonchevron-down
application/json
Subscription to user fill events for a specific user.
typeundefined · enumRequired
Type of subscription.
Possible values: `userFills`
userstring · min: 42 · max: 42Required
User address.
Pattern: `^0[xX][0-9a-fA-F]+$`
aggregateByTimebooleanOptional
If true, partial fills are aggregated when a crossing order fills multiple resting orders.
Responses
chevron-right
200
Event of user trade fill.
application/json
Event of user trade fill.
userstringRequired
User address.
Pattern: `^0x[a-fA-F0-9]{40}$`
isSnapshotboolean · enumOptional
Whether this is an initial snapshot.
Possible values: `true`
post
/
TypeScript
200
Event of user trade fill.
[PrevioususerEventschevron-left](https://nktkas.gitbook.io/hyperliquid/api-reference/subscription-methods/userevents)
[NextuserFundingschevron-right](https://nktkas.gitbook.io/hyperliquid/api-reference/subscription-methods/userfundings)
Last updated 5 days ago
sun-brightdesktopmoon
Copy
import * as hl from "@nktkas/hyperliquid";
const transport = new hl.WebSocketTransport();
const client = new hl.SubscriptionClient({ transport });
const sub = await client.userFills({ user: "0x..." }, (data) => {
console.log(data);
});
Copy
{
"user": "text",
"fills": null,
"isSnapshot": true
}
sun-brightdesktopmoon
---
# allDexsAssetCtxs | Hyperliquid
###
[hashtag](https://nktkas.gitbook.io/hyperliquid/api-reference/subscription-methods/alldexsassetctxs#post)
Subscribe to allDexsAssetCtxs
post
wss://api.hyperliquid.xyz/wsMainnet WebSocketchevron-down
wss://api.hyperliquid.xyz/wswss://api.hyperliquid-testnet.xyz/ws
/copy
Subscription to asset context events for all DEXs.
Body
application/jsonchevron-down
application/json
Subscription to asset context events for all DEXs.
typeundefined · enumRequired
Type of subscription.
Possible values: `allDexsAssetCtxs`
Responses
chevron-right
200
Event of asset contexts for all DEXs.
application/json
Event of asset contexts for all DEXs.
ctxsany\[\]\[\]Required
Array of tuples of dex names and contexts for each perpetual asset.
Show propertiesplus
post
/
TypeScript
200
Event of asset contexts for all DEXs.
[PreviousactiveSpotAssetCtxchevron-left](https://nktkas.gitbook.io/hyperliquid/api-reference/subscription-methods/activespotassetctx)
[NextallDexsClearinghouseStatechevron-right](https://nktkas.gitbook.io/hyperliquid/api-reference/subscription-methods/alldexsclearinghousestate)
Last updated 5 days ago
sun-brightdesktopmoon
Copy
import * as hl from "@nktkas/hyperliquid";
const transport = new hl.WebSocketTransport();
const client = new hl.SubscriptionClient({ transport });
const sub = await client.allDexsAssetCtxs((data) => {
console.log(data);
});
Copy
{
"ctxs": [\
[]\
]
}
sun-brightdesktopmoon
---
# webData3 | Hyperliquid
###
[hashtag](https://nktkas.gitbook.io/hyperliquid/api-reference/subscription-methods/webdata3#post)
Subscribe to webData3
post
wss://api.hyperliquid.xyz/wsMainnet WebSocketchevron-down
wss://api.hyperliquid.xyz/wswss://api.hyperliquid-testnet.xyz/ws
/copy
Subscription to comprehensive user and market data events.
Body
application/jsonchevron-down
application/json
Subscription to comprehensive user and market data events.
typeundefined · enumRequired
Type of subscription.
Possible values: `webData3`
userstring · min: 42 · max: 42Required
User address.
Pattern: `^0[xX][0-9a-fA-F]+$`
Responses
chevron-right
200
Event of comprehensive user and market data.
application/json
Event of comprehensive user and market data.
userStateobjectRequired
User state information.
Show propertiesplus
perpDexStatesobject\[\]Required
Array of perpetual DEX states.
Show propertiesplus
post
/
TypeScript
200
Event of comprehensive user and market data.
[PreviouswebData2chevron-left](https://nktkas.gitbook.io/hyperliquid/api-reference/subscription-methods/webdata2)
Last updated 5 days ago
sun-brightdesktopmoon
Copy
import * as hl from "@nktkas/hyperliquid";
const transport = new hl.WebSocketTransport();
const client = new hl.SubscriptionClient({ transport });
const sub = await client.webData3({ user: "0x..." }, (data) => {
console.log(data);
});
Copy
{
"userState": {
"agentAddress": "text",
"agentValidUntil": 1,
"cumLedger": "text",
"serverTime": 1,
"isVault": true,
"user": "text",
"optOutOfSpotDusting": true,
"dexAbstractionEnabled": true,
"abstraction": "dexAbstraction"
},
"perpDexStates": [\
{\
"totalVaultEquity": "text",\
"perpsAtOpenInterestCap": null,\
"leadingVaults": null\
}\
]
}
sun-brightdesktopmoon
---
# twapStates | Hyperliquid
###
[hashtag](https://nktkas.gitbook.io/hyperliquid/api-reference/subscription-methods/twapstates#post)
Subscribe to twapStates
post
wss://api.hyperliquid.xyz/wsMainnet WebSocketchevron-down
wss://api.hyperliquid.xyz/wswss://api.hyperliquid-testnet.xyz/ws
/copy
Subscription to TWAP states updates for a specific user.
Body
application/jsonchevron-down
application/json
Subscription to TWAP states updates for a specific user.
typeundefined · enumRequired
Type of subscription.
Possible values: `twapStates`
userstring · min: 42 · max: 42Required
User address.
Pattern: `^0[xX][0-9a-fA-F]+$`
dexstringOptional
DEX name (empty string for main dex).
Responses
chevron-right
200
Event of user TWAP states.
application/json
Event of user TWAP states.
dexstringRequired
DEX name (empty string for main dex).
userstringRequired
User address.
Pattern: `^0x[a-fA-F0-9]{40}$`
statesany\[\]\[\]Required
Array of tuples of TWAP ID and TWAP state.
Show propertiesplus
post
/
TypeScript
200
Event of user TWAP states.
[Previoustradeschevron-left](https://nktkas.gitbook.io/hyperliquid/api-reference/subscription-methods/trades)
[NextuserEventschevron-right](https://nktkas.gitbook.io/hyperliquid/api-reference/subscription-methods/userevents)
Last updated 5 days ago
sun-brightdesktopmoon
Copy
import * as hl from "@nktkas/hyperliquid";
const transport = new hl.WebSocketTransport();
const client = new hl.SubscriptionClient({ transport });
const sub = await client.twapStates({ user: "0x..." }, (data) => {
console.log(data);
});
Copy
{
"dex": "text",
"user": "text",
"states": [\
[]\
]
}
sun-brightdesktopmoon
---
# Subscription Methods | Hyperliquid
[activeAssetCtxchevron-right](https://nktkas.gitbook.io/hyperliquid/api-reference/subscription-methods/activeassetctx)
[activeAssetDatachevron-right](https://nktkas.gitbook.io/hyperliquid/api-reference/subscription-methods/activeassetdata)
[activeSpotAssetCtxchevron-right](https://nktkas.gitbook.io/hyperliquid/api-reference/subscription-methods/activespotassetctx)
[allDexsAssetCtxschevron-right](https://nktkas.gitbook.io/hyperliquid/api-reference/subscription-methods/alldexsassetctxs)
[allDexsClearinghouseStatechevron-right](https://nktkas.gitbook.io/hyperliquid/api-reference/subscription-methods/alldexsclearinghousestate)
[allMidschevron-right](https://nktkas.gitbook.io/hyperliquid/api-reference/subscription-methods/allmids)
[assetCtxschevron-right](https://nktkas.gitbook.io/hyperliquid/api-reference/subscription-methods/assetctxs)
[bbochevron-right](https://nktkas.gitbook.io/hyperliquid/api-reference/subscription-methods/bbo)
[candlechevron-right](https://nktkas.gitbook.io/hyperliquid/api-reference/subscription-methods/candle)
[clearinghouseStatechevron-right](https://nktkas.gitbook.io/hyperliquid/api-reference/subscription-methods/clearinghousestate)
[explorerBlockchevron-right](https://nktkas.gitbook.io/hyperliquid/api-reference/subscription-methods/explorerblock)
[explorerTxschevron-right](https://nktkas.gitbook.io/hyperliquid/api-reference/subscription-methods/explorertxs)
[l2Bookchevron-right](https://nktkas.gitbook.io/hyperliquid/api-reference/subscription-methods/l2book)
[notificationchevron-right](https://nktkas.gitbook.io/hyperliquid/api-reference/subscription-methods/notification)
[openOrderschevron-right](https://nktkas.gitbook.io/hyperliquid/api-reference/subscription-methods/openorders)
[orderUpdateschevron-right](https://nktkas.gitbook.io/hyperliquid/api-reference/subscription-methods/orderupdates)
[spotAssetCtxschevron-right](https://nktkas.gitbook.io/hyperliquid/api-reference/subscription-methods/spotassetctxs)
[spotStatechevron-right](https://nktkas.gitbook.io/hyperliquid/api-reference/subscription-methods/spotstate)
[tradeschevron-right](https://nktkas.gitbook.io/hyperliquid/api-reference/subscription-methods/trades)
[twapStateschevron-right](https://nktkas.gitbook.io/hyperliquid/api-reference/subscription-methods/twapstates)
[userEventschevron-right](https://nktkas.gitbook.io/hyperliquid/api-reference/subscription-methods/userevents)
[userFillschevron-right](https://nktkas.gitbook.io/hyperliquid/api-reference/subscription-methods/userfills)
[userFundingschevron-right](https://nktkas.gitbook.io/hyperliquid/api-reference/subscription-methods/userfundings)
[userHistoricalOrderschevron-right](https://nktkas.gitbook.io/hyperliquid/api-reference/subscription-methods/userhistoricalorders)
[userNonFundingLedgerUpdateschevron-right](https://nktkas.gitbook.io/hyperliquid/api-reference/subscription-methods/usernonfundingledgerupdates)
[userTwapHistorychevron-right](https://nktkas.gitbook.io/hyperliquid/api-reference/subscription-methods/usertwaphistory)
[userTwapSliceFillschevron-right](https://nktkas.gitbook.io/hyperliquid/api-reference/subscription-methods/usertwapslicefills)
[webData2chevron-right](https://nktkas.gitbook.io/hyperliquid/api-reference/subscription-methods/webdata2)
[webData3chevron-right](https://nktkas.gitbook.io/hyperliquid/api-reference/subscription-methods/webdata3)
[Previouswithdraw3chevron-left](https://nktkas.gitbook.io/hyperliquid/api-reference/exchange-methods/withdraw3)
[NextactiveAssetCtxchevron-right](https://nktkas.gitbook.io/hyperliquid/api-reference/subscription-methods/activeassetctx)
Last updated 5 days ago
sun-brightdesktopmoon
sun-brightdesktopmoon
---
# userHistoricalOrders | Hyperliquid
###
[hashtag](https://nktkas.gitbook.io/hyperliquid/api-reference/subscription-methods/userhistoricalorders#post)
Subscribe to userHistoricalOrders
post
wss://api.hyperliquid.xyz/wsMainnet WebSocketchevron-down
wss://api.hyperliquid.xyz/wswss://api.hyperliquid-testnet.xyz/ws
/copy
Subscription to user historical orders for a specific user.
Body
application/jsonchevron-down
application/json
Subscription to user historical orders for a specific user.
typeundefined · enumRequired
Type of subscription.
Possible values: `userHistoricalOrders`
userstring · min: 42 · max: 42Required
User address.
Pattern: `^0[xX][0-9a-fA-F]+$`
Responses
chevron-right
200
Event of user historical orders.
application/json
Event of user historical orders.
userstringRequired
User address.
Pattern: `^0x[a-fA-F0-9]{40}$`
isSnapshotboolean · enumOptional
Whether this is an initial snapshot.
Possible values: `true`
post
/
TypeScript
200
Event of user historical orders.
[PrevioususerFundingschevron-left](https://nktkas.gitbook.io/hyperliquid/api-reference/subscription-methods/userfundings)
[NextuserNonFundingLedgerUpdateschevron-right](https://nktkas.gitbook.io/hyperliquid/api-reference/subscription-methods/usernonfundingledgerupdates)
Last updated 5 days ago
sun-brightdesktopmoon
Copy
import * as hl from "@nktkas/hyperliquid";
const transport = new hl.WebSocketTransport();
const client = new hl.SubscriptionClient({ transport });
const sub = await client.userHistoricalOrders({ user: "0x..." }, (data) => {
console.log(data);
});
Copy
{
"user": "text",
"orderHistory": null,
"isSnapshot": true
}
sun-brightdesktopmoon
---
# userFundings | Hyperliquid
###
[hashtag](https://nktkas.gitbook.io/hyperliquid/api-reference/subscription-methods/userfundings#post)
Subscribe to userFundings
post
wss://api.hyperliquid.xyz/wsMainnet WebSocketchevron-down
wss://api.hyperliquid.xyz/wswss://api.hyperliquid-testnet.xyz/ws
/copy
Subscription to user funding events for a specific user.
Body
application/jsonchevron-down
application/json
Subscription to user funding events for a specific user.
typeundefined · enumRequired
Type of subscription.
Possible values: `userFundings`
userstring · min: 42 · max: 42Required
User address.
Pattern: `^0[xX][0-9a-fA-F]+$`
Responses
chevron-right
200
Event of user fundings.
application/json
Event of user fundings.
userstringRequired
User address.
Pattern: `^0x[a-fA-F0-9]{40}$`
fundingsobject\[\]Required
Array of user funding ledger updates.
Show propertiesplus
isSnapshotboolean · enumOptional
Whether this is an initial snapshot.
Possible values: `true`
post
/
TypeScript
200
Event of user fundings.
[PrevioususerFillschevron-left](https://nktkas.gitbook.io/hyperliquid/api-reference/subscription-methods/userfills)
[NextuserHistoricalOrderschevron-right](https://nktkas.gitbook.io/hyperliquid/api-reference/subscription-methods/userhistoricalorders)
Last updated 5 days ago
sun-brightdesktopmoon
Copy
import * as hl from "@nktkas/hyperliquid";
const transport = new hl.WebSocketTransport();
const client = new hl.SubscriptionClient({ transport });
const sub = await client.userFundings({ user: "0x..." }, (data) => {
console.log(data);
});
Copy
{
"user": "text",
"fundings": [\
{\
"time": 1,\
"coin": "text",\
"usdc": "text",\
"szi": "text",\
"fundingRate": "text",\
"nSamples": 1\
}\
],
"isSnapshot": true
}
sun-brightdesktopmoon
---
# userNonFundingLedgerUpdates | Hyperliquid
###
[hashtag](https://nktkas.gitbook.io/hyperliquid/api-reference/subscription-methods/usernonfundingledgerupdates#post)
Subscribe to userNonFundingLedgerUpdates
post
wss://api.hyperliquid.xyz/wsMainnet WebSocketchevron-down
wss://api.hyperliquid.xyz/wswss://api.hyperliquid-testnet.xyz/ws
/copy
Subscription to user non-funding ledger updates for a specific user.
Body
application/jsonchevron-down
application/json
Subscription to user non-funding ledger updates for a specific user.
typeundefined · enumRequired
Type of subscription.
Possible values: `userNonFundingLedgerUpdates`
userstring · min: 42 · max: 42Required
User address.
Pattern: `^0[xX][0-9a-fA-F]+$`
Responses
chevron-right
200
Event of user non-funding ledger updates.
application/json
Event of user non-funding ledger updates.
userstringRequired
User address.
Pattern: `^0x[a-fA-F0-9]{40}$`
isSnapshotboolean · enumOptional
Whether this is an initial snapshot.
Possible values: `true`
post
/
TypeScript
200
Event of user non-funding ledger updates.
[PrevioususerHistoricalOrderschevron-left](https://nktkas.gitbook.io/hyperliquid/api-reference/subscription-methods/userhistoricalorders)
[NextuserTwapHistorychevron-right](https://nktkas.gitbook.io/hyperliquid/api-reference/subscription-methods/usertwaphistory)
Last updated 5 days ago
sun-brightdesktopmoon
Copy
import * as hl from "@nktkas/hyperliquid";
const transport = new hl.WebSocketTransport();
const client = new hl.SubscriptionClient({ transport });
const sub = await client.userNonFundingLedgerUpdates({ user: "0x..." }, (data) => {
console.log(data);
});
Copy
{
"user": "text",
"nonFundingLedgerUpdates": null,
"isSnapshot": true
}
sun-brightdesktopmoon
---
# orderUpdates | Hyperliquid
###
[hashtag](https://nktkas.gitbook.io/hyperliquid/api-reference/subscription-methods/orderupdates#post)
Subscribe to orderUpdates
post
wss://api.hyperliquid.xyz/wsMainnet WebSocketchevron-down
wss://api.hyperliquid.xyz/wswss://api.hyperliquid-testnet.xyz/ws
/copy
Subscription to order updates for a specific user.
Body
application/jsonchevron-down
application/json
Subscription to order updates for a specific user.
typeundefined · enumRequired
Type of subscription.
Possible values: `orderUpdates`
userstring · min: 42 · max: 42Required
User address.
Pattern: `^0[xX][0-9a-fA-F]+$`
Responses
chevron-right
200
Event of array of orders with their current processing status.
application/json
Event of array of orders with their current processing status.
statusTimestampnumberRequired
Timestamp when the status was last updated (in ms since epoch).
post
/
TypeScript
200
Event of array of orders with their current processing status.
[PreviousopenOrderschevron-left](https://nktkas.gitbook.io/hyperliquid/api-reference/subscription-methods/openorders)
[NextspotAssetCtxschevron-right](https://nktkas.gitbook.io/hyperliquid/api-reference/subscription-methods/spotassetctxs)
Last updated 5 days ago
sun-brightdesktopmoon
Copy
import * as hl from "@nktkas/hyperliquid";
const transport = new hl.WebSocketTransport();
const client = new hl.SubscriptionClient({ transport });
const sub = await client.orderUpdates({ user: "0x..." }, (data) => {
console.log(data);
});
Copy
[\
{\
"order": null,\
"status": null,\
"statusTimestamp": 1\
}\
]
sun-brightdesktopmoon
---
# webData2 | Hyperliquid
###
[hashtag](https://nktkas.gitbook.io/hyperliquid/api-reference/subscription-methods/webdata2#post)
Subscribe to webData2
post
wss://api.hyperliquid.xyz/wsMainnet WebSocketchevron-down
wss://api.hyperliquid.xyz/wswss://api.hyperliquid-testnet.xyz/ws
/copy
Subscription to comprehensive user and market data events.
Body
application/jsonchevron-down
application/json
Subscription to comprehensive user and market data events.
typeundefined · enumRequired
Type of subscription.
Possible values: `webData2`
userstring · min: 42 · max: 42Required
User address.
Pattern: `^0[xX][0-9a-fA-F]+$`
Responses
chevron-right
200
Event of comprehensive user and market data.
application/json
anyOptional
Event of comprehensive user and market data.
post
/
TypeScript
200
Event of comprehensive user and market data.
No content
[PrevioususerTwapSliceFillschevron-left](https://nktkas.gitbook.io/hyperliquid/api-reference/subscription-methods/usertwapslicefills)
[NextwebData3chevron-right](https://nktkas.gitbook.io/hyperliquid/api-reference/subscription-methods/webdata3)
Last updated 5 days ago
sun-brightdesktopmoon
Copy
import * as hl from "@nktkas/hyperliquid";
const transport = new hl.WebSocketTransport();
const client = new hl.SubscriptionClient({ transport });
const sub = await client.webData2({ user: "0x..." }, (data) => {
console.log(data);
});
sun-brightdesktopmoon
---
# userEvents | Hyperliquid
###
[hashtag](https://nktkas.gitbook.io/hyperliquid/api-reference/subscription-methods/userevents#post)
Subscribe to userEvents
post
wss://api.hyperliquid.xyz/wsMainnet WebSocketchevron-down
wss://api.hyperliquid.xyz/wswss://api.hyperliquid-testnet.xyz/ws
/copy
Subscription to user events for a specific user.
Body
application/jsonchevron-down
application/json
Subscription to user events for a specific user.
typeundefined · enumRequired
Type of subscription.
Possible values: `userEvents`
userstring · min: 42 · max: 42Required
User address.
Pattern: `^0[xX][0-9a-fA-F]+$`
Responses
chevron-right
200
Event of one of possible user events.
application/json
Event of one of possible user events.
objectOptional
or
objectOptional
Show propertiesplus
or
objectOptional
Show propertiesplus
or
objectOptional
Show propertiesplus
or
objectOptional
or
objectOptional
post
/
TypeScript
200
Event of one of possible user events.
[PrevioustwapStateschevron-left](https://nktkas.gitbook.io/hyperliquid/api-reference/subscription-methods/twapstates)
[NextuserFillschevron-right](https://nktkas.gitbook.io/hyperliquid/api-reference/subscription-methods/userfills)
Last updated 5 days ago
sun-brightdesktopmoon
Copy
import * as hl from "@nktkas/hyperliquid";
const transport = new hl.WebSocketTransport();
const client = new hl.SubscriptionClient({ transport });
const sub = await client.userEvents({ user: "0x..." }, (data) => {
console.log(data);
});
Copy
{
"fills": null
}
sun-brightdesktopmoon
---
# userTwapSliceFills | Hyperliquid
###
[hashtag](https://nktkas.gitbook.io/hyperliquid/api-reference/subscription-methods/usertwapslicefills#post)
Subscribe to userTwapSliceFills
post
wss://api.hyperliquid.xyz/wsMainnet WebSocketchevron-down
wss://api.hyperliquid.xyz/wswss://api.hyperliquid-testnet.xyz/ws
/copy
Subscription to user TWAP slice fill events for a specific user.
Body
application/jsonchevron-down
application/json
Subscription to user TWAP slice fill events for a specific user.
typeundefined · enumRequired
Type of subscription.
Possible values: `userTwapSliceFills`
userstring · min: 42 · max: 42Required
User address.
Pattern: `^0[xX][0-9a-fA-F]+$`
Responses
chevron-right
200
Event of user TWAP slice fill.
application/json
Event of user TWAP slice fill.
userstringRequired
User address.
Pattern: `^0x[a-fA-F0-9]{40}$`
isSnapshotboolean · enumOptional
Whether this is an initial snapshot.
Possible values: `true`
post
/
TypeScript
200
Event of user TWAP slice fill.
[PrevioususerTwapHistorychevron-left](https://nktkas.gitbook.io/hyperliquid/api-reference/subscription-methods/usertwaphistory)
[NextwebData2chevron-right](https://nktkas.gitbook.io/hyperliquid/api-reference/subscription-methods/webdata2)
Last updated 5 days ago
sun-brightdesktopmoon
Copy
import * as hl from "@nktkas/hyperliquid";
const transport = new hl.WebSocketTransport();
const client = new hl.SubscriptionClient({ transport });
const sub = await client.userTwapSliceFills({ user: "0x..." }, (data) => {
console.log(data);
});
Copy
{
"user": "text",
"twapSliceFills": null,
"isSnapshot": true
}
sun-brightdesktopmoon
---
# activeAssetData | Hyperliquid
post
https://api.hyperliquid.xyzMainnetchevron-down
https://api.hyperliquid.xyzhttps://api.hyperliquid-testnet.xyz
/infocopy
Request user active asset data.
Body
application/jsonchevron-down
application/json
Request user active asset data.
typeundefined · enumRequired
Type of request.
Possible values: `activeAssetData`
coinstringRequired
Asset symbol (e.g., BTC).
userstring · min: 42 · max: 42Required
User address.
Pattern: `^0[xX][0-9a-fA-F]+$`
Responses
chevron-right
200
User active asset data.
application/json
User active asset data.
userstringRequired
User address.
Pattern: `^0x[a-fA-F0-9]{40}$`
coinstringRequired
Asset symbol (e.g., BTC).
leverageany ofRequired
Leverage configuration.
objectOptional
Show propertiesplus
or
objectOptional
Show propertiesplus
maxTradeSzsany\[\] · min: 2 · max: 2Required
Maximum trade size range \[min, max\].
Show propertiesplus
availableToTradeany\[\] · min: 2 · max: 2Required
Available to trade range \[min, max\].
Show propertiesplus
markPxstringRequired
Mark price.
Pattern: `^[0-9]+(\.[0-9]+)?$`
chevron-right
422
Failed to deserialize the JSON body into the target type
text/plain
chevron-right
500
Internal Server Error
application/json
post
/info
TypeScript
Test it
200
User active asset data.
chevron-down
[PreviousInfo Methodschevron-left](https://nktkas.gitbook.io/hyperliquid/api-reference/info-methods)
[NextalignedQuoteTokenInfochevron-right](https://nktkas.gitbook.io/hyperliquid/api-reference/info-methods/alignedquotetokeninfo)
Last updated 9 days ago
sun-brightdesktopmoon
Copy
import * as hl from "@nktkas/hyperliquid";
const transport = new hl.HttpTransport(); // or `WebSocketTransport`
const client = new hl.InfoClient({ transport });
const data = await client.activeAssetData({ user: "0x...", coin: "ETH" });
Copy
{
"user": "text",
"coin": "text",
"leverage": {
"type": "isolated",
"value": 1,
"rawUsd": "text"
},
"maxTradeSzs": [],
"availableToTrade": [],
"markPx": "text"
}
sun-brightdesktopmoon
---
# approveAgent | Hyperliquid
post
https://api.hyperliquid.xyzMainnetchevron-down
https://api.hyperliquid.xyzhttps://api.hyperliquid-testnet.xyz
/exchangecopy
Approve an agent to sign on behalf of the master account.
Body
application/jsonchevron-down
application/json
Approve an agent to sign on behalf of the master account.
actionobjectRequired
Action to perform.
Show propertiesplus
noncenumberRequired
Nonce (timestamp in ms) used to prevent replay attacks.
signatureobjectRequired
ECDSA signature components.
Show propertiesplus
Responses
chevron-right
200
Successful response without specific data or error response.
application/json
anyOptional
Successful response without specific data or error response.
chevron-right
422
Failed to deserialize the JSON body into the target type
text/plain
post
/exchange
TypeScriptchevron-down
TypeScriptTypeScript
Test it
200
Successful response without specific data or error response.
chevron-down
No content
[PreviousagentSetAbstractionchevron-left](https://nktkas.gitbook.io/hyperliquid/api-reference/exchange-methods/agentsetabstraction)
[NextapproveBuilderFeechevron-right](https://nktkas.gitbook.io/hyperliquid/api-reference/exchange-methods/approvebuilderfee)
Last updated 9 days ago
sun-brightdesktopmoon
Copy
import * as hl from "@nktkas/hyperliquid";
import { privateKeyToAccount } from "npm:viem/accounts";
const wallet = privateKeyToAccount("0x..."); // viem or ethers
const transport = new hl.HttpTransport(); // or `WebSocketTransport`
const client = new hl.ExchangeClient({ transport, wallet });
await client.approveAgent({ agentAddress: "0x...", agentName: "myAgent" });
sun-brightdesktopmoon
---
# Exchange Methods | Hyperliquid
[agentEnableDexAbstractionchevron-right](https://nktkas.gitbook.io/hyperliquid/api-reference/exchange-methods/agentenabledexabstraction)
[agentSetAbstractionchevron-right](https://nktkas.gitbook.io/hyperliquid/api-reference/exchange-methods/agentsetabstraction)
[approveAgentchevron-right](https://nktkas.gitbook.io/hyperliquid/api-reference/exchange-methods/approveagent)
[approveBuilderFeechevron-right](https://nktkas.gitbook.io/hyperliquid/api-reference/exchange-methods/approvebuilderfee)
[batchModifychevron-right](https://nktkas.gitbook.io/hyperliquid/api-reference/exchange-methods/batchmodify)
[borrowLendchevron-right](https://nktkas.gitbook.io/hyperliquid/api-reference/exchange-methods/borrowlend)
[cDepositchevron-right](https://nktkas.gitbook.io/hyperliquid/api-reference/exchange-methods/cdeposit)
[cSignerActionchevron-right](https://nktkas.gitbook.io/hyperliquid/api-reference/exchange-methods/csigneraction)
[cValidatorActionchevron-right](https://nktkas.gitbook.io/hyperliquid/api-reference/exchange-methods/cvalidatoraction)
[cWithdrawchevron-right](https://nktkas.gitbook.io/hyperliquid/api-reference/exchange-methods/cwithdraw)
[cancelchevron-right](https://nktkas.gitbook.io/hyperliquid/api-reference/exchange-methods/cancel)
[cancelByCloidchevron-right](https://nktkas.gitbook.io/hyperliquid/api-reference/exchange-methods/cancelbycloid)
[claimRewardschevron-right](https://nktkas.gitbook.io/hyperliquid/api-reference/exchange-methods/claimrewards)
[convertToMultiSigUserchevron-right](https://nktkas.gitbook.io/hyperliquid/api-reference/exchange-methods/converttomultisiguser)
[createSubAccountchevron-right](https://nktkas.gitbook.io/hyperliquid/api-reference/exchange-methods/createsubaccount)
[createVaultchevron-right](https://nktkas.gitbook.io/hyperliquid/api-reference/exchange-methods/createvault)
[evmUserModifychevron-right](https://nktkas.gitbook.io/hyperliquid/api-reference/exchange-methods/evmusermodify)
[linkStakingUserchevron-right](https://nktkas.gitbook.io/hyperliquid/api-reference/exchange-methods/linkstakinguser)
[modifychevron-right](https://nktkas.gitbook.io/hyperliquid/api-reference/exchange-methods/modify)
[noopchevron-right](https://nktkas.gitbook.io/hyperliquid/api-reference/exchange-methods/noop)
[orderchevron-right](https://nktkas.gitbook.io/hyperliquid/api-reference/exchange-methods/order)
[perpDeploychevron-right](https://nktkas.gitbook.io/hyperliquid/api-reference/exchange-methods/perpdeploy)
[registerReferrerchevron-right](https://nktkas.gitbook.io/hyperliquid/api-reference/exchange-methods/registerreferrer)
[reserveRequestWeightchevron-right](https://nktkas.gitbook.io/hyperliquid/api-reference/exchange-methods/reserverequestweight)
[scheduleCancelchevron-right](https://nktkas.gitbook.io/hyperliquid/api-reference/exchange-methods/schedulecancel)
[sendAssetchevron-right](https://nktkas.gitbook.io/hyperliquid/api-reference/exchange-methods/sendasset)
[sendToEvmWithDatachevron-right](https://nktkas.gitbook.io/hyperliquid/api-reference/exchange-methods/sendtoevmwithdata)
[setDisplayNamechevron-right](https://nktkas.gitbook.io/hyperliquid/api-reference/exchange-methods/setdisplayname)
[setReferrerchevron-right](https://nktkas.gitbook.io/hyperliquid/api-reference/exchange-methods/setreferrer)
[spotDeploychevron-right](https://nktkas.gitbook.io/hyperliquid/api-reference/exchange-methods/spotdeploy)
[spotSendchevron-right](https://nktkas.gitbook.io/hyperliquid/api-reference/exchange-methods/spotsend)
[spotUserchevron-right](https://nktkas.gitbook.io/hyperliquid/api-reference/exchange-methods/spotuser)
[subAccountModifychevron-right](https://nktkas.gitbook.io/hyperliquid/api-reference/exchange-methods/subaccountmodify)
[subAccountSpotTransferchevron-right](https://nktkas.gitbook.io/hyperliquid/api-reference/exchange-methods/subaccountspottransfer)
[subAccountTransferchevron-right](https://nktkas.gitbook.io/hyperliquid/api-reference/exchange-methods/subaccounttransfer)
[tokenDelegatechevron-right](https://nktkas.gitbook.io/hyperliquid/api-reference/exchange-methods/tokendelegate)
[topUpIsolatedOnlyMarginchevron-right](https://nktkas.gitbook.io/hyperliquid/api-reference/exchange-methods/topupisolatedonlymargin)
[twapCancelchevron-right](https://nktkas.gitbook.io/hyperliquid/api-reference/exchange-methods/twapcancel)
[twapOrderchevron-right](https://nktkas.gitbook.io/hyperliquid/api-reference/exchange-methods/twaporder)
[updateIsolatedMarginchevron-right](https://nktkas.gitbook.io/hyperliquid/api-reference/exchange-methods/updateisolatedmargin)
[updateLeveragechevron-right](https://nktkas.gitbook.io/hyperliquid/api-reference/exchange-methods/updateleverage)
[usdClassTransferchevron-right](https://nktkas.gitbook.io/hyperliquid/api-reference/exchange-methods/usdclasstransfer)
[usdSendchevron-right](https://nktkas.gitbook.io/hyperliquid/api-reference/exchange-methods/usdsend)
[userDexAbstractionchevron-right](https://nktkas.gitbook.io/hyperliquid/api-reference/exchange-methods/userdexabstraction)
[userPortfolioMarginchevron-right](https://nktkas.gitbook.io/hyperliquid/api-reference/exchange-methods/userportfoliomargin)
[userSetAbstractionchevron-right](https://nktkas.gitbook.io/hyperliquid/api-reference/exchange-methods/usersetabstraction)
[validatorL1Streamchevron-right](https://nktkas.gitbook.io/hyperliquid/api-reference/exchange-methods/validatorl1stream)
[vaultDistributechevron-right](https://nktkas.gitbook.io/hyperliquid/api-reference/exchange-methods/vaultdistribute)
[vaultModifychevron-right](https://nktkas.gitbook.io/hyperliquid/api-reference/exchange-methods/vaultmodify)
[vaultTransferchevron-right](https://nktkas.gitbook.io/hyperliquid/api-reference/exchange-methods/vaulttransfer)
[withdraw3chevron-right](https://nktkas.gitbook.io/hyperliquid/api-reference/exchange-methods/withdraw3)
[PreviouswebData2chevron-left](https://nktkas.gitbook.io/hyperliquid/api-reference/info-methods/webdata2)
[NextagentEnableDexAbstractionchevron-right](https://nktkas.gitbook.io/hyperliquid/api-reference/exchange-methods/agentenabledexabstraction)
Last updated 5 days ago
sun-brightdesktopmoon
sun-brightdesktopmoon
---
# agentSetAbstraction | Hyperliquid
post
https://api.hyperliquid.xyzMainnetchevron-down
https://api.hyperliquid.xyzhttps://api.hyperliquid-testnet.xyz
/exchangecopy
Set User abstraction mode (method for agent wallet).
Body
application/jsonchevron-down
application/json
Set User abstraction mode (method for agent wallet).
actionobjectRequired
Action to perform.
Show propertiesplus
noncenumberRequired
Nonce (timestamp in ms) used to prevent replay attacks.
signatureobjectRequired
ECDSA signature components.
Show propertiesplus
expiresAfternumberOptional
Expiration time of the action.
Responses
chevron-right
200
Successful response without specific data or error response.
application/json
anyOptional
Successful response without specific data or error response.
chevron-right
422
Failed to deserialize the JSON body into the target type
text/plain
post
/exchange
TypeScript
Test it
200
Successful response without specific data or error response.
chevron-down
No content
[PreviousagentEnableDexAbstractionchevron-left](https://nktkas.gitbook.io/hyperliquid/api-reference/exchange-methods/agentenabledexabstraction)
[NextapproveAgentchevron-right](https://nktkas.gitbook.io/hyperliquid/api-reference/exchange-methods/approveagent)
Last updated 9 days ago
sun-brightdesktopmoon
Copy
import * as hl from "@nktkas/hyperliquid";
import { privateKeyToAccount } from "npm:viem/accounts";
const wallet = privateKeyToAccount("0x..."); // viem or ethers
const transport = new hl.HttpTransport(); // or `WebSocketTransport`
const client = new hl.ExchangeClient({ transport, wallet });
await client.agentSetAbstraction({ abstraction: "u" });
sun-brightdesktopmoon
---
# agentEnableDexAbstraction | Hyperliquid
post
https://api.hyperliquid.xyzMainnetchevron-down
https://api.hyperliquid.xyzhttps://api.hyperliquid-testnet.xyz
/exchangecopy
Enable HIP-3 DEX abstraction.
Body
application/jsonchevron-down
application/json
Enable HIP-3 DEX abstraction.
actionobjectRequired
Action to perform.
Show propertiesplus
noncenumberRequired
Nonce (timestamp in ms) used to prevent replay attacks.
signatureobjectRequired
ECDSA signature components.
Show propertiesplus
expiresAfternumberOptional
Expiration time of the action.
Responses
chevron-right
200
Successful response without specific data or error response.
application/json
anyOptional
Successful response without specific data or error response.
chevron-right
422
Failed to deserialize the JSON body into the target type
text/plain
post
/exchange
TypeScript
Test it
200
Successful response without specific data or error response.
chevron-down
No content
[PreviousExchange Methodschevron-left](https://nktkas.gitbook.io/hyperliquid/api-reference/exchange-methods)
[NextagentSetAbstractionchevron-right](https://nktkas.gitbook.io/hyperliquid/api-reference/exchange-methods/agentsetabstraction)
Last updated 9 days ago
sun-brightdesktopmoon
Copy
import * as hl from "@nktkas/hyperliquid";
import { privateKeyToAccount } from "npm:viem/accounts";
const wallet = privateKeyToAccount("0x..."); // viem or ethers
const transport = new hl.HttpTransport(); // or `WebSocketTransport`
const client = new hl.ExchangeClient({ transport, wallet });
await client.agentEnableDexAbstraction();
sun-brightdesktopmoon
---
# approveBuilderFee | Hyperliquid
post
https://api.hyperliquid.xyzMainnetchevron-down
https://api.hyperliquid.xyzhttps://api.hyperliquid-testnet.xyz
/exchangecopy
Approve a maximum fee rate for a builder.
Body
application/jsonchevron-down
application/json
Approve a maximum fee rate for a builder.
actionobjectRequired
Action to perform.
Show propertiesplus
noncenumberRequired
Nonce (timestamp in ms) used to prevent replay attacks.
signatureobjectRequired
ECDSA signature components.
Show propertiesplus
Responses
chevron-right
200
Successful response without specific data or error response.
application/json
anyOptional
Successful response without specific data or error response.
chevron-right
422
Failed to deserialize the JSON body into the target type
text/plain
post
/exchange
TypeScript
Test it
200
Successful response without specific data or error response.
chevron-down
No content
[PreviousapproveAgentchevron-left](https://nktkas.gitbook.io/hyperliquid/api-reference/exchange-methods/approveagent)
[NextbatchModifychevron-right](https://nktkas.gitbook.io/hyperliquid/api-reference/exchange-methods/batchmodify)
Last updated 9 days ago
sun-brightdesktopmoon
Copy
import * as hl from "@nktkas/hyperliquid";
import { privateKeyToAccount } from "npm:viem/accounts";
const wallet = privateKeyToAccount("0x..."); // viem or ethers
const transport = new hl.HttpTransport(); // or `WebSocketTransport`
const client = new hl.ExchangeClient({ transport, wallet });
await client.approveBuilderFee({ maxFeeRate: "0.01%", builder: "0x..." });
sun-brightdesktopmoon
---
# cDeposit | Hyperliquid
post
https://api.hyperliquid.xyzMainnetchevron-down
https://api.hyperliquid.xyzhttps://api.hyperliquid-testnet.xyz
/exchangecopy
Transfer native token from the user spot account into staking for delegating to validators.
Body
application/jsonchevron-down
application/json
Transfer native token from the user spot account into staking for delegating to validators.
actionobjectRequired
Action to perform.
Show propertiesplus
noncenumberRequired
Nonce (timestamp in ms) used to prevent replay attacks.
signatureobjectRequired
ECDSA signature components.
Show propertiesplus
Responses
chevron-right
200
Successful response without specific data or error response.
application/json
anyOptional
Successful response without specific data or error response.
chevron-right
422
Failed to deserialize the JSON body into the target type
text/plain
post
/exchange
TypeScript
Test it
200
Successful response without specific data or error response.
chevron-down
No content
[PreviousborrowLendchevron-left](https://nktkas.gitbook.io/hyperliquid/api-reference/exchange-methods/borrowlend)
[NextcSignerActionchevron-right](https://nktkas.gitbook.io/hyperliquid/api-reference/exchange-methods/csigneraction)
Last updated 9 days ago
sun-brightdesktopmoon
Copy
import * as hl from "@nktkas/hyperliquid";
import { privateKeyToAccount } from "npm:viem/accounts";
const wallet = privateKeyToAccount("0x..."); // viem or ethers
const transport = new hl.HttpTransport(); // or `WebSocketTransport`
const client = new hl.ExchangeClient({ transport, wallet });
await client.cDeposit({ wei: 1 * 1e8 });
sun-brightdesktopmoon
---
# cancel | Hyperliquid
post
https://api.hyperliquid.xyzMainnetchevron-down
https://api.hyperliquid.xyzhttps://api.hyperliquid-testnet.xyz
/exchangecopy
Cancel order(s).
Body
application/jsonchevron-down
application/json
Cancel order(s).
actionobjectRequired
Action to perform.
Show propertiesplus
noncenumberRequired
Nonce (timestamp in ms) used to prevent replay attacks.
signatureobjectRequired
ECDSA signature components.
Show propertiesplus
vaultAddressstring · min: 42 · max: 42Optional
Vault address (for vault trading).
Pattern: `^0[xX][0-9a-fA-F]+$`
expiresAfternumberOptional
Expiration time of the action.
Responses
chevron-right
200
Response for order cancellation.
application/json
Response for order cancellation.
statusstring · enumRequired
Successful status.
Possible values: `ok`
responseobjectRequired
Response details.
Show propertiesplus
chevron-right
422
Failed to deserialize the JSON body into the target type
text/plain
post
/exchange
TypeScript
Test it
200
Response for order cancellation.
chevron-down
[PreviouscWithdrawchevron-left](https://nktkas.gitbook.io/hyperliquid/api-reference/exchange-methods/cwithdraw)
[NextcancelByCloidchevron-right](https://nktkas.gitbook.io/hyperliquid/api-reference/exchange-methods/cancelbycloid)
Last updated 9 days ago
sun-brightdesktopmoon
Copy
import * as hl from "@nktkas/hyperliquid";
import { privateKeyToAccount } from "npm:viem/accounts";
const wallet = privateKeyToAccount("0x..."); // viem or ethers
const transport = new hl.HttpTransport(); // or `WebSocketTransport`
const client = new hl.ExchangeClient({ transport, wallet });
await client.cancel({ cancels: [{ a: 0, o: 123 }] });
Copy
{
"status": "ok",
"response": {
"type": "cancel",
"data": {
"statuses": [\
"success"\
]
}
}
}
sun-brightdesktopmoon
---
# linkStakingUser | Hyperliquid
post
https://api.hyperliquid.xyzMainnetchevron-down
https://api.hyperliquid.xyzhttps://api.hyperliquid-testnet.xyz
/exchangecopy
Link staking and trading accounts for fee discount attribution.
Body
application/jsonchevron-down
application/json
Link staking and trading accounts for fee discount attribution.
actionobjectRequired
Action to perform.
Show propertiesplus
noncenumberRequired
Nonce (timestamp in ms) used to prevent replay attacks.
signatureobjectRequired
ECDSA signature components.
Show propertiesplus
Responses
chevron-right
200
Successful response without specific data or error response.
application/json
anyOptional
Successful response without specific data or error response.
chevron-right
422
Failed to deserialize the JSON body into the target type
text/plain
post
/exchange
TypeScript
Test it
200
Successful response without specific data or error response.
chevron-down
No content
[PreviousevmUserModifychevron-left](https://nktkas.gitbook.io/hyperliquid/api-reference/exchange-methods/evmusermodify)
[Nextmodifychevron-right](https://nktkas.gitbook.io/hyperliquid/api-reference/exchange-methods/modify)
Last updated 9 days ago
sun-brightdesktopmoon
Copy
import * as hl from "@nktkas/hyperliquid";
import { privateKeyToAccount } from "npm:viem/accounts";
const wallet = privateKeyToAccount("0x..."); // viem or ethers
const transport = new hl.HttpTransport(); // or `WebSocketTransport`
const client = new hl.ExchangeClient({ transport, wallet });
await client.linkStakingUser({ user: "0x...", isFinalize: false });
sun-brightdesktopmoon
---
# noop | Hyperliquid
post
https://api.hyperliquid.xyzMainnetchevron-down
https://api.hyperliquid.xyzhttps://api.hyperliquid-testnet.xyz
/exchangecopy
This action does not do anything (no operation), but causes the nonce to be marked as used.
Body
application/jsonchevron-down
application/json
This action does not do anything (no operation), but causes the nonce to be marked as used.
actionobjectRequired
Action to perform.
Show propertiesplus
noncenumberRequired
Nonce (timestamp in ms) used to prevent replay attacks.
signatureobjectRequired
ECDSA signature components.
Show propertiesplus
expiresAfternumberOptional
Expiration time of the action.
Responses
chevron-right
200
Successful response without specific data or error response.
application/json
anyOptional
Successful response without specific data or error response.
chevron-right
422
Failed to deserialize the JSON body into the target type
text/plain
post
/exchange
TypeScript
Test it
200
Successful response without specific data or error response.
chevron-down
No content
[Previousmodifychevron-left](https://nktkas.gitbook.io/hyperliquid/api-reference/exchange-methods/modify)
[Nextorderchevron-right](https://nktkas.gitbook.io/hyperliquid/api-reference/exchange-methods/order)
Last updated 9 days ago
sun-brightdesktopmoon
Copy
import * as hl from "@nktkas/hyperliquid";
import { privateKeyToAccount } from "npm:viem/accounts";
const wallet = privateKeyToAccount("0x..."); // viem or ethers
const transport = new hl.HttpTransport(); // or `WebSocketTransport`
const client = new hl.ExchangeClient({ transport, wallet });
await client.noop();
sun-brightdesktopmoon
---
# claimRewards | Hyperliquid
post
https://api.hyperliquid.xyzMainnetchevron-down
https://api.hyperliquid.xyzhttps://api.hyperliquid-testnet.xyz
/exchangecopy
Claim rewards from referral program.
Body
application/jsonchevron-down
application/json
Claim rewards from referral program.
actionobjectRequired
Action to perform.
Show propertiesplus
noncenumberRequired
Nonce (timestamp in ms) used to prevent replay attacks.
signatureobjectRequired
ECDSA signature components.
Show propertiesplus
expiresAfternumberOptional
Expiration time of the action.
Responses
chevron-right
200
Successful response without specific data or error response.
application/json
anyOptional
Successful response without specific data or error response.
chevron-right
422
Failed to deserialize the JSON body into the target type
text/plain
post
/exchange
TypeScript
Test it
200
Successful response without specific data or error response.
chevron-down
No content
[PreviouscancelByCloidchevron-left](https://nktkas.gitbook.io/hyperliquid/api-reference/exchange-methods/cancelbycloid)
[NextconvertToMultiSigUserchevron-right](https://nktkas.gitbook.io/hyperliquid/api-reference/exchange-methods/converttomultisiguser)
Last updated 9 days ago
sun-brightdesktopmoon
Copy
import * as hl from "@nktkas/hyperliquid";
import { privateKeyToAccount } from "npm:viem/accounts";
const wallet = privateKeyToAccount("0x..."); // viem or ethers
const transport = new hl.HttpTransport(); // or `WebSocketTransport`
const client = new hl.ExchangeClient({ transport, wallet });
await client.claimRewards();
sun-brightdesktopmoon
---
# cValidatorAction | Hyperliquid
post
https://api.hyperliquid.xyzMainnetchevron-down
https://api.hyperliquid.xyzhttps://api.hyperliquid-testnet.xyz
/exchangecopy
Action related to validator management.
Body
application/jsonchevron-down
application/json
Action related to validator management.
actionone ofRequired
Validator management action.
objectOptional
Validator management action.
Show propertiesplus
or
objectOptional
Validator management action.
Show propertiesplus
or
objectOptional
Validator management action.
Show propertiesplus
noncenumberRequired
Nonce (timestamp in ms) used to prevent replay attacks.
signatureobjectRequired
ECDSA signature components.
Show propertiesplus
expiresAfternumberOptional
Expiration time of the action.
Responses
chevron-right
200
Successful response without specific data or error response.
application/json
anyOptional
Successful response without specific data or error response.
chevron-right
422
Failed to deserialize the JSON body into the target type
text/plain
post
/exchange
TypeScript
Test it
200
Successful response without specific data or error response.
chevron-down
No content
[PreviouscSignerActionchevron-left](https://nktkas.gitbook.io/hyperliquid/api-reference/exchange-methods/csigneraction)
[NextcWithdrawchevron-right](https://nktkas.gitbook.io/hyperliquid/api-reference/exchange-methods/cwithdraw)
Last updated 9 days ago
sun-brightdesktopmoon
Copy
import * as hl from "@nktkas/hyperliquid";
import { privateKeyToAccount } from "npm:viem/accounts";
const wallet = privateKeyToAccount("0x..."); // viem or ethers
const transport = new hl.HttpTransport(); // or `WebSocketTransport`
const client = new hl.ExchangeClient({ transport, wallet });
await client.cValidatorAction({
changeProfile: {
node_ip: { Ip: "1.2.3.4" },
name: "...",
description: "...",
unjailed: true,
disable_delegations: false,
commission_bps: null,
signer: null,
},
});
sun-brightdesktopmoon
---
# evmUserModify | Hyperliquid
post
https://api.hyperliquid.xyzMainnetchevron-down
https://api.hyperliquid.xyzhttps://api.hyperliquid-testnet.xyz
/exchangecopy
Configure block type for EVM transactions.
Body
application/jsonchevron-down
application/json
Configure block type for EVM transactions.
actionobjectRequired
Action to perform.
Show propertiesplus
noncenumberRequired
Nonce (timestamp in ms) used to prevent replay attacks.
signatureobjectRequired
ECDSA signature components.
Show propertiesplus
expiresAfternumberOptional
Expiration time of the action.
Responses
chevron-right
200
Successful response without specific data or error response.
application/json
anyOptional
Successful response without specific data or error response.
chevron-right
422
Failed to deserialize the JSON body into the target type
text/plain
post
/exchange
TypeScript
Test it
200
Successful response without specific data or error response.
chevron-down
No content
[PreviouscreateVaultchevron-left](https://nktkas.gitbook.io/hyperliquid/api-reference/exchange-methods/createvault)
[NextlinkStakingUserchevron-right](https://nktkas.gitbook.io/hyperliquid/api-reference/exchange-methods/linkstakinguser)
Last updated 9 days ago
sun-brightdesktopmoon
Copy
import * as hl from "@nktkas/hyperliquid";
import { privateKeyToAccount } from "npm:viem/accounts";
const wallet = privateKeyToAccount("0x..."); // viem or ethers
const transport = new hl.HttpTransport(); // or `WebSocketTransport`
const client = new hl.ExchangeClient({ transport, wallet });
await client.evmUserModify({ usingBigBlocks: true });
sun-brightdesktopmoon
---
# borrowLend | Hyperliquid
post
https://api.hyperliquid.xyzMainnetchevron-down
https://api.hyperliquid.xyzhttps://api.hyperliquid-testnet.xyz
/exchangecopy
Borrow or lend assets.
Body
application/jsonchevron-down
application/json
Borrow or lend assets.
actionobjectRequired
Action to perform.
Show propertiesplus
noncenumberRequired
Nonce (timestamp in ms) used to prevent replay attacks.
signatureobjectRequired
ECDSA signature components.
Show propertiesplus
vaultAddressstring · min: 42 · max: 42Optional
Vault address (for vault trading).
Pattern: `^0[xX][0-9a-fA-F]+$`
expiresAfternumberOptional
Expiration time of the action.
Responses
chevron-right
200
Successful response without specific data or error response.
application/json
anyOptional
Successful response without specific data or error response.
chevron-right
422
Failed to deserialize the JSON body into the target type
text/plain
post
/exchange
TypeScript
Test it
200
Successful response without specific data or error response.
chevron-down
No content
[PreviousbatchModifychevron-left](https://nktkas.gitbook.io/hyperliquid/api-reference/exchange-methods/batchmodify)
[NextcDepositchevron-right](https://nktkas.gitbook.io/hyperliquid/api-reference/exchange-methods/cdeposit)
Last updated 9 days ago
sun-brightdesktopmoon
Copy
import * as hl from "@nktkas/hyperliquid";
import { privateKeyToAccount } from "npm:viem/accounts";
const wallet = privateKeyToAccount("0x..."); // viem or ethers
const transport = new hl.HttpTransport(); // or `WebSocketTransport`
const client = new hl.ExchangeClient({ transport, wallet });
await client.borrowLend({ operation: "supply", token: 0, amount: "20" });
sun-brightdesktopmoon
---
# registerReferrer | Hyperliquid
post
https://api.hyperliquid.xyzMainnetchevron-down
https://api.hyperliquid.xyzhttps://api.hyperliquid-testnet.xyz
/exchangecopy
Create a referral code.
Body
application/jsonchevron-down
application/json
Create a referral code.
actionobjectRequired
Action to perform.
Show propertiesplus
noncenumberRequired
Nonce (timestamp in ms) used to prevent replay attacks.
signatureobjectRequired
ECDSA signature components.
Show propertiesplus
expiresAfternumberOptional
Expiration time of the action.
Responses
chevron-right
200
Successful response without specific data or error response.
application/json
anyOptional
Successful response without specific data or error response.
chevron-right
422
Failed to deserialize the JSON body into the target type
text/plain
post
/exchange
TypeScript
Test it
200
Successful response without specific data or error response.
chevron-down
No content
[PreviousperpDeploychevron-left](https://nktkas.gitbook.io/hyperliquid/api-reference/exchange-methods/perpdeploy)
[NextreserveRequestWeightchevron-right](https://nktkas.gitbook.io/hyperliquid/api-reference/exchange-methods/reserverequestweight)
Last updated 9 days ago
sun-brightdesktopmoon
Copy
import * as hl from "@nktkas/hyperliquid";
import { privateKeyToAccount } from "npm:viem/accounts";
const wallet = privateKeyToAccount("0x..."); // viem or ethers
const transport = new hl.HttpTransport(); // or `WebSocketTransport`
const client = new hl.ExchangeClient({ transport, wallet });
await client.registerReferrer({ code: "..." });
sun-brightdesktopmoon
---
# createSubAccount | Hyperliquid
post
https://api.hyperliquid.xyzMainnetchevron-down
https://api.hyperliquid.xyzhttps://api.hyperliquid-testnet.xyz
/exchangecopy
Create a sub-account.
Body
application/jsonchevron-down
application/json
Create a sub-account.
actionobjectRequired
Action to perform.
Show propertiesplus
noncenumberRequired
Nonce (timestamp in ms) used to prevent replay attacks.
signatureobjectRequired
ECDSA signature components.
Show propertiesplus
expiresAfternumberOptional
Expiration time of the action.
Responses
chevron-right
200
Response for creating a sub-account.
application/json
Response for creating a sub-account.
objectOptional
Show propertiesplus
chevron-right
422
Failed to deserialize the JSON body into the target type
text/plain
post
/exchange
TypeScript
Test it
200
Response for creating a sub-account.
chevron-down
[PreviousconvertToMultiSigUserchevron-left](https://nktkas.gitbook.io/hyperliquid/api-reference/exchange-methods/converttomultisiguser)
[NextcreateVaultchevron-right](https://nktkas.gitbook.io/hyperliquid/api-reference/exchange-methods/createvault)
Last updated 9 days ago
sun-brightdesktopmoon
Copy
import * as hl from "@nktkas/hyperliquid";
import { privateKeyToAccount } from "npm:viem/accounts";
const wallet = privateKeyToAccount("0x..."); // viem or ethers
const transport = new hl.HttpTransport(); // or `WebSocketTransport`
const client = new hl.ExchangeClient({ transport, wallet });
const data = await client.createSubAccount({ name: "..." });
Copy
{
"status": "ok",
"response": {
"type": "createSubAccount",
"data": "text"
}
}
sun-brightdesktopmoon
---
# cWithdraw | Hyperliquid
post
https://api.hyperliquid.xyzMainnetchevron-down
https://api.hyperliquid.xyzhttps://api.hyperliquid-testnet.xyz
/exchangecopy
Transfer native token from staking into the user's spot account.
Body
application/jsonchevron-down
application/json
Transfer native token from staking into the user's spot account.
actionobjectRequired
Action to perform.
Show propertiesplus
noncenumberRequired
Nonce (timestamp in ms) used to prevent replay attacks.
signatureobjectRequired
ECDSA signature components.
Show propertiesplus
Responses
chevron-right
200
Successful response without specific data or error response.
application/json
anyOptional
Successful response without specific data or error response.
chevron-right
422
Failed to deserialize the JSON body into the target type
text/plain
post
/exchange
TypeScript
Test it
200
Successful response without specific data or error response.
chevron-down
No content
[PreviouscValidatorActionchevron-left](https://nktkas.gitbook.io/hyperliquid/api-reference/exchange-methods/cvalidatoraction)
[Nextcancelchevron-right](https://nktkas.gitbook.io/hyperliquid/api-reference/exchange-methods/cancel)
Last updated 9 days ago
sun-brightdesktopmoon
Copy
import * as hl from "@nktkas/hyperliquid";
import { privateKeyToAccount } from "npm:viem/accounts";
const wallet = privateKeyToAccount("0x..."); // viem or ethers
const transport = new hl.HttpTransport(); // or `WebSocketTransport`
const client = new hl.ExchangeClient({ transport, wallet });
await client.cWithdraw({ wei: 1 * 1e8 });
sun-brightdesktopmoon
---
# createVault | Hyperliquid
post
https://api.hyperliquid.xyzMainnetchevron-down
https://api.hyperliquid.xyzhttps://api.hyperliquid-testnet.xyz
/exchangecopy
Create a vault.
Body
application/jsonchevron-down
application/json
Create a vault.
actionobjectRequired
Action to perform.
Show propertiesplus
noncenumberRequired
Nonce (timestamp in ms) used to prevent replay attacks.
signatureobjectRequired
ECDSA signature components.
Show propertiesplus
expiresAfternumberOptional
Expiration time of the action.
Responses
chevron-right
200
Response for creating a vault.
application/json
Response for creating a vault.
objectOptional
Show propertiesplus
chevron-right
422
Failed to deserialize the JSON body into the target type
text/plain
post
/exchange
TypeScript
Test it
200
Response for creating a vault.
chevron-down
[PreviouscreateSubAccountchevron-left](https://nktkas.gitbook.io/hyperliquid/api-reference/exchange-methods/createsubaccount)
[NextevmUserModifychevron-right](https://nktkas.gitbook.io/hyperliquid/api-reference/exchange-methods/evmusermodify)
Last updated 9 days ago
sun-brightdesktopmoon
Copy
import * as hl from "@nktkas/hyperliquid";
import { privateKeyToAccount } from "npm:viem/accounts";
const wallet = privateKeyToAccount("0x..."); // viem or ethers
const transport = new hl.HttpTransport(); // or `WebSocketTransport`
const client = new hl.ExchangeClient({ transport, wallet });
const data = await client.createVault({
name: "...",
description: "...",
initialUsd: 100 * 1e6,
nonce: Date.now(),
});
Copy
{
"status": "ok",
"response": {
"type": "createVault",
"data": "text"
}
}
sun-brightdesktopmoon
---
# batchModify | Hyperliquid
post
https://api.hyperliquid.xyzMainnetchevron-down
https://api.hyperliquid.xyzhttps://api.hyperliquid-testnet.xyz
/exchangecopy
Modify multiple orders.
Body
application/jsonchevron-down
application/json
Modify multiple orders.
actionobjectRequired
Action to perform.
Show propertiesplus
noncenumberRequired
Nonce (timestamp in ms) used to prevent replay attacks.
signatureobjectRequired
ECDSA signature components.
Show propertiesplus
vaultAddressstring · min: 42 · max: 42Optional
Vault address (for vault trading).
Pattern: `^0[xX][0-9a-fA-F]+$`
expiresAfternumberOptional
Expiration time of the action.
Responses
chevron-right
200
Response for order batch modifications.
application/json
anyOptional
Response for order batch modifications.
chevron-right
422
Failed to deserialize the JSON body into the target type
text/plain
post
/exchange
TypeScript
Test it
200
Response for order batch modifications.
chevron-down
No content
[PreviousapproveBuilderFeechevron-left](https://nktkas.gitbook.io/hyperliquid/api-reference/exchange-methods/approvebuilderfee)
[NextborrowLendchevron-right](https://nktkas.gitbook.io/hyperliquid/api-reference/exchange-methods/borrowlend)
Last updated 9 days ago
sun-brightdesktopmoon
Copy
import * as hl from "@nktkas/hyperliquid";
import { privateKeyToAccount } from "npm:viem/accounts";
const wallet = privateKeyToAccount("0x..."); // viem or ethers
const transport = new hl.HttpTransport(); // or `WebSocketTransport`
const client = new hl.ExchangeClient({ transport, wallet });
const data = await client.batchModify({
modifies: [\
{\
oid: 123,\
order: {\
a: 0,\
b: true,\
p: "31000",\
s: "0.2",\
r: false,\
t: { limit: { tif: "Gtc" } },\
},\
},\
],
});
sun-brightdesktopmoon
---
# setReferrer | Hyperliquid
post
https://api.hyperliquid.xyzMainnetchevron-down
https://api.hyperliquid.xyzhttps://api.hyperliquid-testnet.xyz
/exchangecopy
Set a referral code.
Body
application/jsonchevron-down
application/json
Set a referral code.
actionobjectRequired
Action to perform.
Show propertiesplus
noncenumberRequired
Nonce (timestamp in ms) used to prevent replay attacks.
signatureobjectRequired
ECDSA signature components.
Show propertiesplus
expiresAfternumberOptional
Expiration time of the action.
Responses
chevron-right
200
Successful response without specific data or error response.
application/json
anyOptional
Successful response without specific data or error response.
chevron-right
422
Failed to deserialize the JSON body into the target type
text/plain
post
/exchange
TypeScript
Test it
200
Successful response without specific data or error response.
chevron-down
No content
[PrevioussetDisplayNamechevron-left](https://nktkas.gitbook.io/hyperliquid/api-reference/exchange-methods/setdisplayname)
[NextspotDeploychevron-right](https://nktkas.gitbook.io/hyperliquid/api-reference/exchange-methods/spotdeploy)
Last updated 9 days ago
sun-brightdesktopmoon
Copy
import * as hl from "@nktkas/hyperliquid";
import { privateKeyToAccount } from "npm:viem/accounts";
const wallet = privateKeyToAccount("0x..."); // viem or ethers
const transport = new hl.HttpTransport(); // or `WebSocketTransport`
const client = new hl.ExchangeClient({ transport, wallet });
await client.setReferrer({ code: "..." });
sun-brightdesktopmoon
---
# modify | Hyperliquid
post
https://api.hyperliquid.xyzMainnetchevron-down
https://api.hyperliquid.xyzhttps://api.hyperliquid-testnet.xyz
/exchangecopy
Modify an order.
Body
application/jsonchevron-down
application/json
Modify an order.
actionobjectRequired
Action to perform.
Show propertiesplus
noncenumberRequired
Nonce (timestamp in ms) used to prevent replay attacks.
signatureobjectRequired
ECDSA signature components.
Show propertiesplus
vaultAddressstring · min: 42 · max: 42Optional
Vault address (for vault trading).
Pattern: `^0[xX][0-9a-fA-F]+$`
expiresAfternumberOptional
Expiration time of the action.
Responses
chevron-right
200
Successful response without specific data or error response.
application/json
anyOptional
Successful response without specific data or error response.
chevron-right
422
Failed to deserialize the JSON body into the target type
text/plain
post
/exchange
TypeScript
Test it
200
Successful response without specific data or error response.
chevron-down
No content
[PreviouslinkStakingUserchevron-left](https://nktkas.gitbook.io/hyperliquid/api-reference/exchange-methods/linkstakinguser)
[Nextnoopchevron-right](https://nktkas.gitbook.io/hyperliquid/api-reference/exchange-methods/noop)
Last updated 9 days ago
sun-brightdesktopmoon
Copy
import * as hl from "@nktkas/hyperliquid";
import { privateKeyToAccount } from "npm:viem/accounts";
const wallet = privateKeyToAccount("0x..."); // viem or ethers
const transport = new hl.HttpTransport(); // or `WebSocketTransport`
const client = new hl.ExchangeClient({ transport, wallet });
await client.modify({
oid: 123,
order: {
a: 0,
b: true,
p: "31000",
s: "0.2",
r: false,
t: { limit: { tif: "Gtc" } },
},
});
sun-brightdesktopmoon
---
# spotSend | Hyperliquid
post
https://api.hyperliquid.xyzMainnetchevron-down
https://api.hyperliquid.xyzhttps://api.hyperliquid-testnet.xyz
/exchangecopy
Send spot assets to another address.
Body
application/jsonchevron-down
application/json
Send spot assets to another address.
actionobjectRequired
Action to perform.
Show propertiesplus
noncenumberRequired
Nonce (timestamp in ms) used to prevent replay attacks.
signatureobjectRequired
ECDSA signature components.
Show propertiesplus
Responses
chevron-right
200
Successful response without specific data or error response.
application/json
anyOptional
Successful response without specific data or error response.
chevron-right
422
Failed to deserialize the JSON body into the target type
text/plain
post
/exchange
TypeScript
Test it
200
Successful response without specific data or error response.
chevron-down
No content
[PreviousspotDeploychevron-left](https://nktkas.gitbook.io/hyperliquid/api-reference/exchange-methods/spotdeploy)
[NextspotUserchevron-right](https://nktkas.gitbook.io/hyperliquid/api-reference/exchange-methods/spotuser)
Last updated 9 days ago
sun-brightdesktopmoon
Copy
import * as hl from "@nktkas/hyperliquid";
import { privateKeyToAccount } from "npm:viem/accounts";
const wallet = privateKeyToAccount("0x..."); // viem or ethers
const transport = new hl.HttpTransport(); // or `WebSocketTransport`
const client = new hl.ExchangeClient({ transport, wallet });
await client.spotSend({
destination: "0x...",
token: "USDC:0xeb62eee3685fc4c43992febcd9e75443",
amount: "1",
});
sun-brightdesktopmoon
---
# reserveRequestWeight | Hyperliquid
post
https://api.hyperliquid.xyzMainnetchevron-down
https://api.hyperliquid.xyzhttps://api.hyperliquid-testnet.xyz
/exchangecopy
Reserve additional rate-limited actions for a fee.
Body
application/jsonchevron-down
application/json
Reserve additional rate-limited actions for a fee.
actionobjectRequired
Action to perform.
Show propertiesplus
noncenumberRequired
Nonce (timestamp in ms) used to prevent replay attacks.
signatureobjectRequired
ECDSA signature components.
Show propertiesplus
expiresAfternumberOptional
Expiration time of the action.
Responses
chevron-right
200
Successful response without specific data or error response.
application/json
anyOptional
Successful response without specific data or error response.
chevron-right
422
Failed to deserialize the JSON body into the target type
text/plain
post
/exchange
TypeScript
Test it
200
Successful response without specific data or error response.
chevron-down
No content
[PreviousregisterReferrerchevron-left](https://nktkas.gitbook.io/hyperliquid/api-reference/exchange-methods/registerreferrer)
[NextscheduleCancelchevron-right](https://nktkas.gitbook.io/hyperliquid/api-reference/exchange-methods/schedulecancel)
Last updated 9 days ago
sun-brightdesktopmoon
Copy
import * as hl from "@nktkas/hyperliquid";
import { privateKeyToAccount } from "npm:viem/accounts";
const wallet = privateKeyToAccount("0x..."); // viem or ethers
const transport = new hl.HttpTransport(); // or `WebSocketTransport`
const client = new hl.ExchangeClient({ transport, wallet });
await client.reserveRequestWeight({ weight: 10 });
sun-brightdesktopmoon
---
# withdraw3 | Hyperliquid
post
https://api.hyperliquid.xyzMainnetchevron-down
https://api.hyperliquid.xyzhttps://api.hyperliquid-testnet.xyz
/exchangecopy
Initiate a withdrawal request.
Body
application/jsonchevron-down
application/json
Initiate a withdrawal request.
actionobjectRequired
Action to perform.
Show propertiesplus
noncenumberRequired
Nonce (timestamp in ms) used to prevent replay attacks.
signatureobjectRequired
ECDSA signature components.
Show propertiesplus
Responses
chevron-right
200
Successful response without specific data or error response.
application/json
anyOptional
Successful response without specific data or error response.
chevron-right
422
Failed to deserialize the JSON body into the target type
text/plain
post
/exchange
TypeScript
Test it
200
Successful response without specific data or error response.
chevron-down
No content
[PreviousvaultTransferchevron-left](https://nktkas.gitbook.io/hyperliquid/api-reference/exchange-methods/vaulttransfer)
[NextSubscription Methodschevron-right](https://nktkas.gitbook.io/hyperliquid/api-reference/subscription-methods)
Last updated 9 days ago
sun-brightdesktopmoon
Copy
import * as hl from "@nktkas/hyperliquid";
import { privateKeyToAccount } from "npm:viem/accounts";
const wallet = privateKeyToAccount("0x..."); // viem or ethers
const transport = new hl.HttpTransport(); // or `WebSocketTransport`
const client = new hl.ExchangeClient({ transport, wallet });
await client.withdraw3({ destination: "0x...", amount: "1" });
sun-brightdesktopmoon
---
# convertToMultiSigUser | Hyperliquid
post
https://api.hyperliquid.xyzMainnetchevron-down
https://api.hyperliquid.xyzhttps://api.hyperliquid-testnet.xyz
/exchangecopy
Convert a single-signature account to a multi-signature account or vice versa.
Body
application/jsonchevron-down
application/json
Convert a single-signature account to a multi-signature account or vice versa.
actionobjectRequired
Action to perform.
Show propertiesplus
noncenumberRequired
Nonce (timestamp in ms) used to prevent replay attacks.
signatureobjectRequired
ECDSA signature components.
Show propertiesplus
Responses
chevron-right
200
Successful response without specific data or error response.
application/json
anyOptional
Successful response without specific data or error response.
chevron-right
422
Failed to deserialize the JSON body into the target type
text/plain
post
/exchange
TypeScriptchevron-down
TypeScriptTypeScript
Test it
200
Successful response without specific data or error response.
chevron-down
No content
[PreviousclaimRewardschevron-left](https://nktkas.gitbook.io/hyperliquid/api-reference/exchange-methods/claimrewards)
[NextcreateSubAccountchevron-right](https://nktkas.gitbook.io/hyperliquid/api-reference/exchange-methods/createsubaccount)
Last updated 9 days ago
sun-brightdesktopmoon
Copy
import * as hl from "@nktkas/hyperliquid";
import { privateKeyToAccount } from "npm:viem/accounts";
const wallet = privateKeyToAccount("0x..."); // viem or ethers
const transport = new hl.HttpTransport(); // or `WebSocketTransport`
const client = new hl.ExchangeClient({ transport, wallet });
await client.convertToMultiSigUser({
signers: {
authorizedUsers: ["0x...", "0x...", "0x..."],
threshold: 2,
},
});
sun-brightdesktopmoon
---
# scheduleCancel | Hyperliquid
post
https://api.hyperliquid.xyzMainnetchevron-down
https://api.hyperliquid.xyzhttps://api.hyperliquid-testnet.xyz
/exchangecopy
Schedule a cancel-all operation at a future time.
Body
application/jsonchevron-down
application/json
Schedule a cancel-all operation at a future time.
actionobjectRequired
Action to perform.
Show propertiesplus
noncenumberRequired
Nonce (timestamp in ms) used to prevent replay attacks.
signatureobjectRequired
ECDSA signature components.
Show propertiesplus
vaultAddressstring · min: 42 · max: 42Optional
Vault address (for vault trading).
Pattern: `^0[xX][0-9a-fA-F]+$`
expiresAfternumberOptional
Expiration time of the action.
Responses
chevron-right
200
Successful response without specific data or error response.
application/json
anyOptional
Successful response without specific data or error response.
chevron-right
422
Failed to deserialize the JSON body into the target type
text/plain
post
/exchange
TypeScript
Test it
200
Successful response without specific data or error response.
chevron-down
No content
[PreviousreserveRequestWeightchevron-left](https://nktkas.gitbook.io/hyperliquid/api-reference/exchange-methods/reserverequestweight)
[NextsendAssetchevron-right](https://nktkas.gitbook.io/hyperliquid/api-reference/exchange-methods/sendasset)
Last updated 9 days ago
sun-brightdesktopmoon
Copy
import * as hl from "@nktkas/hyperliquid";
import { privateKeyToAccount } from "npm:viem/accounts";
const wallet = privateKeyToAccount("0x..."); // viem or ethers
const transport = new hl.HttpTransport(); // or `WebSocketTransport`
const client = new hl.ExchangeClient({ transport, wallet });
await client.scheduleCancel({ time: Date.now() + 10_000 });
sun-brightdesktopmoon
---
# order | Hyperliquid
post
https://api.hyperliquid.xyzMainnetchevron-down
https://api.hyperliquid.xyzhttps://api.hyperliquid-testnet.xyz
/exchangecopy
Place an order(s).
Body
application/jsonchevron-down
application/json
Place an order(s).
actionobjectRequired
Action to perform.
Show propertiesplus
noncenumberRequired
Nonce (timestamp in ms) used to prevent replay attacks.
signatureobjectRequired
ECDSA signature components.
Show propertiesplus
vaultAddressstring · min: 42 · max: 42Optional
Vault address (for vault trading).
Pattern: `^0[xX][0-9a-fA-F]+$`
expiresAfternumberOptional
Expiration time of the action.
Responses
chevron-right
200
Response for order placement.
application/json
Response for order placement.
statusstring · enumRequired
Successful status.
Possible values: `ok`
responseobjectRequired
Response details.
Show propertiesplus
chevron-right
422
Failed to deserialize the JSON body into the target type
text/plain
post
/exchange
TypeScript
Test it
200
Response for order placement.
chevron-down
[Previousnoopchevron-left](https://nktkas.gitbook.io/hyperliquid/api-reference/exchange-methods/noop)
[NextperpDeploychevron-right](https://nktkas.gitbook.io/hyperliquid/api-reference/exchange-methods/perpdeploy)
Last updated 9 days ago
sun-brightdesktopmoon
Copy
import * as hl from "@nktkas/hyperliquid";
import { privateKeyToAccount } from "npm:viem/accounts";
const wallet = privateKeyToAccount("0x..."); // viem or ethers
const transport = new hl.HttpTransport(); // or `WebSocketTransport`
const client = new hl.ExchangeClient({ transport, wallet });
const data = await client.order({
orders: [\
{\
a: 0,\
b: true,\
p: "30000",\
s: "0.1",\
r: false,\
t: { limit: { tif: "Gtc" } },\
},\
],
grouping: "na",
});
Copy
{
"status": "ok",
"response": {
"type": "order",
"data": {
"statuses": [\
{\
"resting": {\
"oid": 1,\
"cloid": "text"\
}\
}\
]
}
}
}
sun-brightdesktopmoon
---
# setDisplayName | Hyperliquid
post
https://api.hyperliquid.xyzMainnetchevron-down
https://api.hyperliquid.xyzhttps://api.hyperliquid-testnet.xyz
/exchangecopy
Set the display name in the leaderboard.
Body
application/jsonchevron-down
application/json
Set the display name in the leaderboard.
actionobjectRequired
Action to perform.
Show propertiesplus
noncenumberRequired
Nonce (timestamp in ms) used to prevent replay attacks.
signatureobjectRequired
ECDSA signature components.
Show propertiesplus
expiresAfternumberOptional
Expiration time of the action.
Responses
chevron-right
200
Successful response without specific data or error response.
application/json
anyOptional
Successful response without specific data or error response.
chevron-right
422
Failed to deserialize the JSON body into the target type
text/plain
post
/exchange
TypeScript
Test it
200
Successful response without specific data or error response.
chevron-down
No content
[PrevioussendToEvmWithDatachevron-left](https://nktkas.gitbook.io/hyperliquid/api-reference/exchange-methods/sendtoevmwithdata)
[NextsetReferrerchevron-right](https://nktkas.gitbook.io/hyperliquid/api-reference/exchange-methods/setreferrer)
Last updated 9 days ago
sun-brightdesktopmoon
Copy
import * as hl from "@nktkas/hyperliquid";
import { privateKeyToAccount } from "npm:viem/accounts";
const wallet = privateKeyToAccount("0x..."); // viem or ethers
const transport = new hl.HttpTransport(); // or `WebSocketTransport`
const client = new hl.ExchangeClient({ transport, wallet });
await client.setDisplayName({ displayName: "..." });
sun-brightdesktopmoon
---
# cancelByCloid | Hyperliquid
post
https://api.hyperliquid.xyzMainnetchevron-down
https://api.hyperliquid.xyzhttps://api.hyperliquid-testnet.xyz
/exchangecopy
Cancel order(s) by cloid.
Body
application/jsonchevron-down
application/json
Cancel order(s) by cloid.
actionobjectRequired
Action to perform.
Show propertiesplus
noncenumberRequired
Nonce (timestamp in ms) used to prevent replay attacks.
signatureobjectRequired
ECDSA signature components.
Show propertiesplus
vaultAddressstring · min: 42 · max: 42Optional
Vault address (for vault trading).
Pattern: `^0[xX][0-9a-fA-F]+$`
expiresAfternumberOptional
Expiration time of the action.
Responses
chevron-right
200
Response for order cancellation by cloid.
application/json
anyOptional
Response for order cancellation by cloid.
chevron-right
422
Failed to deserialize the JSON body into the target type
text/plain
post
/exchange
TypeScript
Test it
200
Response for order cancellation by cloid.
chevron-down
No content
[Previouscancelchevron-left](https://nktkas.gitbook.io/hyperliquid/api-reference/exchange-methods/cancel)
[NextclaimRewardschevron-right](https://nktkas.gitbook.io/hyperliquid/api-reference/exchange-methods/claimrewards)
Last updated 9 days ago
sun-brightdesktopmoon
Copy
import * as hl from "@nktkas/hyperliquid";
import { privateKeyToAccount } from "npm:viem/accounts";
const wallet = privateKeyToAccount("0x..."); // viem or ethers
const transport = new hl.HttpTransport(); // or `WebSocketTransport`
const client = new hl.ExchangeClient({ transport, wallet });
await client.cancelByCloid({
cancels: [\
{ asset: 0, cloid: "0x..." },\
],
});
sun-brightdesktopmoon
---
# userDexAbstraction | Hyperliquid
post
https://api.hyperliquid.xyzMainnetchevron-down
https://api.hyperliquid.xyzhttps://api.hyperliquid-testnet.xyz
/exchangecopy
Enable/disable HIP-3 DEX abstraction.
Body
application/jsonchevron-down
application/json
Enable/disable HIP-3 DEX abstraction.
actionobjectRequired
Action to perform.
Show propertiesplus
noncenumberRequired
Nonce (timestamp in ms) used to prevent replay attacks.
signatureobjectRequired
ECDSA signature components.
Show propertiesplus
Responses
chevron-right
200
Successful response without specific data or error response.
application/json
anyOptional
Successful response without specific data or error response.
chevron-right
422
Failed to deserialize the JSON body into the target type
text/plain
post
/exchange
TypeScript
Test it
200
Successful response without specific data or error response.
chevron-down
No content
[PrevioususdSendchevron-left](https://nktkas.gitbook.io/hyperliquid/api-reference/exchange-methods/usdsend)
[NextuserPortfolioMarginchevron-right](https://nktkas.gitbook.io/hyperliquid/api-reference/exchange-methods/userportfoliomargin)
Last updated 9 days ago
sun-brightdesktopmoon
Copy
import * as hl from "@nktkas/hyperliquid";
import { privateKeyToAccount } from "npm:viem/accounts";
const wallet = privateKeyToAccount("0x..."); // viem or ethers
const transport = new hl.HttpTransport(); // or `WebSocketTransport`
const client = new hl.ExchangeClient({ transport, wallet });
await client.userDexAbstraction({ user: "0x...", enabled: true });
sun-brightdesktopmoon
---
# vaultTransfer | Hyperliquid
post
https://api.hyperliquid.xyzMainnetchevron-down
https://api.hyperliquid.xyzhttps://api.hyperliquid-testnet.xyz
/exchangecopy
Deposit or withdraw from a vault.
Body
application/jsonchevron-down
application/json
Deposit or withdraw from a vault.
actionobjectRequired
Action to perform.
Show propertiesplus
noncenumberRequired
Nonce (timestamp in ms) used to prevent replay attacks.
signatureobjectRequired
ECDSA signature components.
Show propertiesplus
expiresAfternumberOptional
Expiration time of the action.
Responses
chevron-right
200
Successful response without specific data or error response.
application/json
anyOptional
Successful response without specific data or error response.
chevron-right
422
Failed to deserialize the JSON body into the target type
text/plain
post
/exchange
TypeScript
Test it
200
Successful response without specific data or error response.
chevron-down
No content
[PreviousvaultModifychevron-left](https://nktkas.gitbook.io/hyperliquid/api-reference/exchange-methods/vaultmodify)
[Nextwithdraw3chevron-right](https://nktkas.gitbook.io/hyperliquid/api-reference/exchange-methods/withdraw3)
Last updated 9 days ago
sun-brightdesktopmoon
Copy
import * as hl from "@nktkas/hyperliquid";
import { privateKeyToAccount } from "npm:viem/accounts";
const wallet = privateKeyToAccount("0x..."); // viem or ethers
const transport = new hl.HttpTransport(); // or `WebSocketTransport`
const client = new hl.ExchangeClient({ transport, wallet });
await client.vaultTransfer({
vaultAddress: "0x...",
isDeposit: true,
usd: 10 * 1e6,
});
sun-brightdesktopmoon
---
# cSignerAction | Hyperliquid
post
https://api.hyperliquid.xyzMainnetchevron-down
https://api.hyperliquid.xyzhttps://api.hyperliquid-testnet.xyz
/exchangecopy
Jail or unjail self as a validator signer.
Body
application/jsonchevron-down
application/json
Jail or unjail self as a validator signer.
actionone ofRequired
Action to jail or unjail the signer.
objectOptional
Action to jail or unjail the signer.
Show propertiesplus
or
objectOptional
Action to jail or unjail the signer.
Show propertiesplus
noncenumberRequired
Nonce (timestamp in ms) used to prevent replay attacks.
signatureobjectRequired
ECDSA signature components.
Show propertiesplus
expiresAfternumberOptional
Expiration time of the action.
Responses
chevron-right
200
Successful response without specific data or error response.
application/json
anyOptional
Successful response without specific data or error response.
chevron-right
422
Failed to deserialize the JSON body into the target type
text/plain
post
/exchange
TypeScriptchevron-down
TypeScriptTypeScript
Test it
200
Successful response without specific data or error response.
chevron-down
No content
[PreviouscDepositchevron-left](https://nktkas.gitbook.io/hyperliquid/api-reference/exchange-methods/cdeposit)
[NextcValidatorActionchevron-right](https://nktkas.gitbook.io/hyperliquid/api-reference/exchange-methods/cvalidatoraction)
Last updated 9 days ago
sun-brightdesktopmoon
Copy
import * as hl from "@nktkas/hyperliquid";
import { privateKeyToAccount } from "npm:viem/accounts";
const wallet = privateKeyToAccount("0x..."); // viem or ethers
const transport = new hl.HttpTransport(); // or `WebSocketTransport`
const client = new hl.ExchangeClient({ transport, wallet });
await client.cSignerAction({ jailSelf: null });
sun-brightdesktopmoon
---
# sendToEvmWithData | Hyperliquid
post
https://api.hyperliquid.xyzMainnetchevron-down
https://api.hyperliquid.xyzhttps://api.hyperliquid-testnet.xyz
/exchangecopy
Transfer tokens from Core to EVM with an additional data payload for `ICoreReceiveWithData` contracts.
Body
application/jsonchevron-down
application/json
Transfer tokens from Core to EVM with an additional data payload for `ICoreReceiveWithData` contracts.
actionobjectRequired
Action to perform.
Show propertiesplus
noncenumberRequired
Nonce (timestamp in ms) used to prevent replay attacks.
signatureobjectRequired
ECDSA signature components.
Show propertiesplus
Responses
chevron-right
200
Successful response without specific data or error response.
application/json
anyOptional
Successful response without specific data or error response.
chevron-right
422
Failed to deserialize the JSON body into the target type
text/plain
post
/exchange
TypeScript
Test it
200
Successful response without specific data or error response.
chevron-down
No content
[PrevioussendAssetchevron-left](https://nktkas.gitbook.io/hyperliquid/api-reference/exchange-methods/sendasset)
[NextsetDisplayNamechevron-right](https://nktkas.gitbook.io/hyperliquid/api-reference/exchange-methods/setdisplayname)
Last updated 4 days ago
sun-brightdesktopmoon
Copy
import * as hl from "@nktkas/hyperliquid";
import { privateKeyToAccount } from "npm:viem/accounts";
const wallet = privateKeyToAccount("0x..."); // viem or ethers
const transport = new hl.HttpTransport(); // or `WebSocketTransport`
const client = new hl.ExchangeClient({ transport, wallet });
await client.sendToEvmWithData({
token: "USDC",
amount: "1",
sourceDex: "spot",
destinationRecipient: "0x...",
addressEncoding: "hex",
destinationChainId: 42161,
gasLimit: 200000,
data: "0x",
});
sun-brightdesktopmoon
---
# sendAsset | Hyperliquid
post
https://api.hyperliquid.xyzMainnetchevron-down
https://api.hyperliquid.xyzhttps://api.hyperliquid-testnet.xyz
/exchangecopy
Transfer tokens between different perp DEXs, spot balance, users, and/or sub-accounts.
Body
application/jsonchevron-down
application/json
Transfer tokens between different perp DEXs, spot balance, users, and/or sub-accounts.
actionobjectRequired
Action to perform.
Show propertiesplus
noncenumberRequired
Nonce (timestamp in ms) used to prevent replay attacks.
signatureobjectRequired
ECDSA signature components.
Show propertiesplus
Responses
chevron-right
200
Successful response without specific data or error response.
application/json
anyOptional
Successful response without specific data or error response.
chevron-right
422
Failed to deserialize the JSON body into the target type
text/plain
post
/exchange
TypeScript
Test it
200
Successful response without specific data or error response.
chevron-down
No content
[PreviousscheduleCancelchevron-left](https://nktkas.gitbook.io/hyperliquid/api-reference/exchange-methods/schedulecancel)
[NextsendToEvmWithDatachevron-right](https://nktkas.gitbook.io/hyperliquid/api-reference/exchange-methods/sendtoevmwithdata)
Last updated 9 days ago
sun-brightdesktopmoon
Copy
import * as hl from "@nktkas/hyperliquid";
import { privateKeyToAccount } from "npm:viem/accounts";
const wallet = privateKeyToAccount("0x..."); // viem or ethers
const transport = new hl.HttpTransport(); // or `WebSocketTransport`
const client = new hl.ExchangeClient({ transport, wallet });
await client.sendAsset({
destination: "0x0000000000000000000000000000000000000001",
sourceDex: "",
destinationDex: "test",
token: "USDC:0xeb62eee3685fc4c43992febcd9e75443",
amount: "1",
});
sun-brightdesktopmoon
---
# updateIsolatedMargin | Hyperliquid
post
https://api.hyperliquid.xyzMainnetchevron-down
https://api.hyperliquid.xyzhttps://api.hyperliquid-testnet.xyz
/exchangecopy
Add or remove margin from isolated position.
Body
application/jsonchevron-down
application/json
Add or remove margin from isolated position.
actionobjectRequired
Action to perform.
Show propertiesplus
noncenumberRequired
Nonce (timestamp in ms) used to prevent replay attacks.
signatureobjectRequired
ECDSA signature components.
Show propertiesplus
vaultAddressstring · min: 42 · max: 42Optional
Vault address (for vault trading).
Pattern: `^0[xX][0-9a-fA-F]+$`
expiresAfternumberOptional
Expiration time of the action.
Responses
chevron-right
200
Successful response without specific data or error response.
application/json
anyOptional
Successful response without specific data or error response.
chevron-right
422
Failed to deserialize the JSON body into the target type
text/plain
post
/exchange
TypeScript
Test it
200
Successful response without specific data or error response.
chevron-down
No content
[PrevioustwapOrderchevron-left](https://nktkas.gitbook.io/hyperliquid/api-reference/exchange-methods/twaporder)
[NextupdateLeveragechevron-right](https://nktkas.gitbook.io/hyperliquid/api-reference/exchange-methods/updateleverage)
Last updated 9 days ago
sun-brightdesktopmoon
Copy
import * as hl from "@nktkas/hyperliquid";
import { privateKeyToAccount } from "npm:viem/accounts";
const wallet = privateKeyToAccount("0x..."); // viem or ethers
const transport = new hl.HttpTransport(); // or `WebSocketTransport`
const client = new hl.ExchangeClient({ transport, wallet });
await client.updateIsolatedMargin({ asset: 0, isBuy: true, ntli: 1 * 1e6 });
sun-brightdesktopmoon
---
# updateLeverage | Hyperliquid
post
https://api.hyperliquid.xyzMainnetchevron-down
https://api.hyperliquid.xyzhttps://api.hyperliquid-testnet.xyz
/exchangecopy
Update cross or isolated leverage on a coin.
Body
application/jsonchevron-down
application/json
Update cross or isolated leverage on a coin.
actionobjectRequired
Action to perform.
Show propertiesplus
noncenumberRequired
Nonce (timestamp in ms) used to prevent replay attacks.
signatureobjectRequired
ECDSA signature components.
Show propertiesplus
vaultAddressstring · min: 42 · max: 42Optional
Vault address (for vault trading).
Pattern: `^0[xX][0-9a-fA-F]+$`
expiresAfternumberOptional
Expiration time of the action.
Responses
chevron-right
200
Successful response without specific data or error response.
application/json
anyOptional
Successful response without specific data or error response.
chevron-right
422
Failed to deserialize the JSON body into the target type
text/plain
post
/exchange
TypeScript
Test it
200
Successful response without specific data or error response.
chevron-down
No content
[PreviousupdateIsolatedMarginchevron-left](https://nktkas.gitbook.io/hyperliquid/api-reference/exchange-methods/updateisolatedmargin)
[NextusdClassTransferchevron-right](https://nktkas.gitbook.io/hyperliquid/api-reference/exchange-methods/usdclasstransfer)
Last updated 9 days ago
sun-brightdesktopmoon
Copy
import * as hl from "@nktkas/hyperliquid";
import { privateKeyToAccount } from "npm:viem/accounts";
const wallet = privateKeyToAccount("0x..."); // viem or ethers
const transport = new hl.HttpTransport(); // or `WebSocketTransport`
const client = new hl.ExchangeClient({ transport, wallet });
await client.updateLeverage({ asset: 0, isCross: true, leverage: 5 });
sun-brightdesktopmoon
---
# tokenDelegate | Hyperliquid
post
https://api.hyperliquid.xyzMainnetchevron-down
https://api.hyperliquid.xyzhttps://api.hyperliquid-testnet.xyz
/exchangecopy
Delegate or undelegate native tokens to or from a validator.
Body
application/jsonchevron-down
application/json
Delegate or undelegate native tokens to or from a validator.
actionobjectRequired
Action to perform.
Show propertiesplus
noncenumberRequired
Nonce (timestamp in ms) used to prevent replay attacks.
signatureobjectRequired
ECDSA signature components.
Show propertiesplus
Responses
chevron-right
200
Successful response without specific data or error response.
application/json
anyOptional
Successful response without specific data or error response.
chevron-right
422
Failed to deserialize the JSON body into the target type
text/plain
post
/exchange
TypeScript
Test it
200
Successful response without specific data or error response.
chevron-down
No content
[PrevioussubAccountTransferchevron-left](https://nktkas.gitbook.io/hyperliquid/api-reference/exchange-methods/subaccounttransfer)
[NexttopUpIsolatedOnlyMarginchevron-right](https://nktkas.gitbook.io/hyperliquid/api-reference/exchange-methods/topupisolatedonlymargin)
Last updated 9 days ago
sun-brightdesktopmoon
Copy
import * as hl from "@nktkas/hyperliquid";
import { privateKeyToAccount } from "npm:viem/accounts";
const wallet = privateKeyToAccount("0x..."); // viem or ethers
const transport = new hl.HttpTransport(); // or `WebSocketTransport`
const client = new hl.ExchangeClient({ transport, wallet });
await client.tokenDelegate({
validator: "0x...",
isUndelegate: true,
wei: 1 * 1e8,
});
sun-brightdesktopmoon
---
# twapCancel | Hyperliquid
post
https://api.hyperliquid.xyzMainnetchevron-down
https://api.hyperliquid.xyzhttps://api.hyperliquid-testnet.xyz
/exchangecopy
Cancel a TWAP order.
Body
application/jsonchevron-down
application/json
Cancel a TWAP order.
actionobjectRequired
Action to perform.
Show propertiesplus
noncenumberRequired
Nonce (timestamp in ms) used to prevent replay attacks.
signatureobjectRequired
ECDSA signature components.
Show propertiesplus
vaultAddressstring · min: 42 · max: 42Optional
Vault address (for vault trading).
Pattern: `^0[xX][0-9a-fA-F]+$`
expiresAfternumberOptional
Expiration time of the action.
Responses
chevron-right
200
Response for canceling a TWAP order.
application/json
Response for canceling a TWAP order.
statusstring · enumRequired
Successful status.
Possible values: `ok`
responseobjectRequired
Response details.
Show propertiesplus
chevron-right
422
Failed to deserialize the JSON body into the target type
text/plain
post
/exchange
TypeScript
Test it
200
Response for canceling a TWAP order.
chevron-down
[PrevioustopUpIsolatedOnlyMarginchevron-left](https://nktkas.gitbook.io/hyperliquid/api-reference/exchange-methods/topupisolatedonlymargin)
[NexttwapOrderchevron-right](https://nktkas.gitbook.io/hyperliquid/api-reference/exchange-methods/twaporder)
Last updated 9 days ago
sun-brightdesktopmoon
Copy
import * as hl from "@nktkas/hyperliquid";
import { privateKeyToAccount } from "npm:viem/accounts";
const wallet = privateKeyToAccount("0x..."); // viem or ethers
const transport = new hl.HttpTransport(); // or `WebSocketTransport`
const client = new hl.ExchangeClient({ transport, wallet });
await client.twapCancel({ a: 0, t: 1 });
Copy
{
"status": "ok",
"response": {
"type": "twapCancel",
"data": {
"status": "success"
}
}
}
sun-brightdesktopmoon
---
# vaultDistribute | Hyperliquid
post
https://api.hyperliquid.xyzMainnetchevron-down
https://api.hyperliquid.xyzhttps://api.hyperliquid-testnet.xyz
/exchangecopy
Distribute funds from a vault between followers.
Body
application/jsonchevron-down
application/json
Distribute funds from a vault between followers.
actionobjectRequired
Action to perform.
Show propertiesplus
noncenumberRequired
Nonce (timestamp in ms) used to prevent replay attacks.
signatureobjectRequired
ECDSA signature components.
Show propertiesplus
expiresAfternumberOptional
Expiration time of the action.
Responses
chevron-right
200
Successful response without specific data or error response.
application/json
anyOptional
Successful response without specific data or error response.
chevron-right
422
Failed to deserialize the JSON body into the target type
text/plain
post
/exchange
TypeScript
Test it
200
Successful response without specific data or error response.
chevron-down
No content
[PreviousvalidatorL1Streamchevron-left](https://nktkas.gitbook.io/hyperliquid/api-reference/exchange-methods/validatorl1stream)
[NextvaultModifychevron-right](https://nktkas.gitbook.io/hyperliquid/api-reference/exchange-methods/vaultmodify)
Last updated 9 days ago
sun-brightdesktopmoon
Copy
import * as hl from "@nktkas/hyperliquid";
import { privateKeyToAccount } from "npm:viem/accounts";
const wallet = privateKeyToAccount("0x..."); // viem or ethers
const transport = new hl.HttpTransport(); // or `WebSocketTransport`
const client = new hl.ExchangeClient({ transport, wallet });
await client.vaultDistribute({ vaultAddress: "0x...", usd: 10 * 1e6 });
sun-brightdesktopmoon
---
# subAccountTransfer | Hyperliquid
post
https://api.hyperliquid.xyzMainnetchevron-down
https://api.hyperliquid.xyzhttps://api.hyperliquid-testnet.xyz
/exchangecopy
Transfer between sub-accounts (perpetual).
Body
application/jsonchevron-down
application/json
Transfer between sub-accounts (perpetual).
actionobjectRequired
Action to perform.
Show propertiesplus
noncenumberRequired
Nonce (timestamp in ms) used to prevent replay attacks.
signatureobjectRequired
ECDSA signature components.
Show propertiesplus
expiresAfternumberOptional
Expiration time of the action.
Responses
chevron-right
200
Successful response without specific data or error response.
application/json
anyOptional
Successful response without specific data or error response.
chevron-right
422
Failed to deserialize the JSON body into the target type
text/plain
post
/exchange
TypeScript
Test it
200
Successful response without specific data or error response.
chevron-down
No content
[PrevioussubAccountSpotTransferchevron-left](https://nktkas.gitbook.io/hyperliquid/api-reference/exchange-methods/subaccountspottransfer)
[NexttokenDelegatechevron-right](https://nktkas.gitbook.io/hyperliquid/api-reference/exchange-methods/tokendelegate)
Last updated 9 days ago
sun-brightdesktopmoon
Copy
import * as hl from "@nktkas/hyperliquid";
import { privateKeyToAccount } from "npm:viem/accounts";
const wallet = privateKeyToAccount("0x..."); // viem or ethers
const transport = new hl.HttpTransport(); // or `WebSocketTransport`
const client = new hl.ExchangeClient({ transport, wallet });
await client.subAccountTransfer({
subAccountUser: "0x...",
isDeposit: true,
usd: 1 * 1e6,
});
sun-brightdesktopmoon
---
# spotUser | Hyperliquid
post
https://api.hyperliquid.xyzMainnetchevron-down
https://api.hyperliquid.xyzhttps://api.hyperliquid-testnet.xyz
/exchangecopy
Opt Out of Spot Dusting.
Body
application/jsonchevron-down
application/json
Opt Out of Spot Dusting.
actionobjectRequired
Action to perform.
Show propertiesplus
noncenumberRequired
Nonce (timestamp in ms) used to prevent replay attacks.
signatureobjectRequired
ECDSA signature components.
Show propertiesplus
expiresAfternumberOptional
Expiration time of the action.
Responses
chevron-right
200
Successful response without specific data or error response.
application/json
anyOptional
Successful response without specific data or error response.
chevron-right
422
Failed to deserialize the JSON body into the target type
text/plain
post
/exchange
TypeScript
Test it
200
Successful response without specific data or error response.
chevron-down
No content
[PreviousspotSendchevron-left](https://nktkas.gitbook.io/hyperliquid/api-reference/exchange-methods/spotsend)
[NextsubAccountModifychevron-right](https://nktkas.gitbook.io/hyperliquid/api-reference/exchange-methods/subaccountmodify)
Last updated 9 days ago
sun-brightdesktopmoon
Copy
import * as hl from "@nktkas/hyperliquid";
import { privateKeyToAccount } from "npm:viem/accounts";
const wallet = privateKeyToAccount("0x..."); // viem or ethers
const transport = new hl.HttpTransport(); // or `WebSocketTransport`
const client = new hl.ExchangeClient({ transport, wallet });
await client.spotUser({ toggleSpotDusting: { optOut: false } });
sun-brightdesktopmoon
---
# userPortfolioMargin | Hyperliquid
post
https://api.hyperliquid.xyzMainnetchevron-down
https://api.hyperliquid.xyzhttps://api.hyperliquid-testnet.xyz
/exchangecopy
Enable/disable user portfolio margin.
Body
application/jsonchevron-down
application/json
Enable/disable user portfolio margin.
actionobjectRequired
Action to perform.
Show propertiesplus
noncenumberRequired
Nonce (timestamp in ms) used to prevent replay attacks.
signatureobjectRequired
ECDSA signature components.
Show propertiesplus
Responses
chevron-right
200
Successful response without specific data or error response.
application/json
anyOptional
Successful response without specific data or error response.
chevron-right
422
Failed to deserialize the JSON body into the target type
text/plain
post
/exchange
TypeScript
Test it
200
Successful response without specific data or error response.
chevron-down
No content
[PrevioususerDexAbstractionchevron-left](https://nktkas.gitbook.io/hyperliquid/api-reference/exchange-methods/userdexabstraction)
[NextuserSetAbstractionchevron-right](https://nktkas.gitbook.io/hyperliquid/api-reference/exchange-methods/usersetabstraction)
Last updated 9 days ago
sun-brightdesktopmoon
Copy
import * as hl from "@nktkas/hyperliquid";
import { privateKeyToAccount } from "npm:viem/accounts";
const wallet = privateKeyToAccount("0x..."); // viem or ethers
const transport = new hl.HttpTransport(); // or `WebSocketTransport`
const client = new hl.ExchangeClient({ transport, wallet });
await client.userPortfolioMargin({ user: "0x...", enabled: true });
sun-brightdesktopmoon
---
# subAccountSpotTransfer | Hyperliquid
post
https://api.hyperliquid.xyzMainnetchevron-down
https://api.hyperliquid.xyzhttps://api.hyperliquid-testnet.xyz
/exchangecopy
Transfer between sub-accounts (spot).
Body
application/jsonchevron-down
application/json
Transfer between sub-accounts (spot).
actionobjectRequired
Action to perform.
Show propertiesplus
noncenumberRequired
Nonce (timestamp in ms) used to prevent replay attacks.
signatureobjectRequired
ECDSA signature components.
Show propertiesplus
expiresAfternumberOptional
Expiration time of the action.
Responses
chevron-right
200
Successful response without specific data or error response.
application/json
anyOptional
Successful response without specific data or error response.
chevron-right
422
Failed to deserialize the JSON body into the target type
text/plain
post
/exchange
TypeScript
Test it
200
Successful response without specific data or error response.
chevron-down
No content
[PrevioussubAccountModifychevron-left](https://nktkas.gitbook.io/hyperliquid/api-reference/exchange-methods/subaccountmodify)
[NextsubAccountTransferchevron-right](https://nktkas.gitbook.io/hyperliquid/api-reference/exchange-methods/subaccounttransfer)
Last updated 9 days ago
sun-brightdesktopmoon
Copy
import * as hl from "@nktkas/hyperliquid";
import { privateKeyToAccount } from "npm:viem/accounts";
const wallet = privateKeyToAccount("0x..."); // viem or ethers
const transport = new hl.HttpTransport(); // or `WebSocketTransport`
const client = new hl.ExchangeClient({ transport, wallet });
await client.subAccountSpotTransfer({
subAccountUser: "0x...",
isDeposit: true,
token: "USDC:0xeb62eee3685fc4c43992febcd9e75443",
amount: "1",
});
sun-brightdesktopmoon
---
# validatorL1Stream | Hyperliquid
post
https://api.hyperliquid.xyzMainnetchevron-down
https://api.hyperliquid.xyzhttps://api.hyperliquid-testnet.xyz
/exchangecopy
Validator vote on risk-free rate for aligned quote asset.
Body
application/jsonchevron-down
application/json
Validator vote on risk-free rate for aligned quote asset.
actionobjectRequired
Action to perform.
Show propertiesplus
noncenumberRequired
Nonce (timestamp in ms) used to prevent replay attacks.
signatureobjectRequired
ECDSA signature components.
Show propertiesplus
expiresAfternumberOptional
Expiration time of the action.
Responses
chevron-right
200
Successful response without specific data or error response.
application/json
anyOptional
Successful response without specific data or error response.
chevron-right
422
Failed to deserialize the JSON body into the target type
text/plain
post
/exchange
TypeScript
Test it
200
Successful response without specific data or error response.
chevron-down
No content
[PrevioususerSetAbstractionchevron-left](https://nktkas.gitbook.io/hyperliquid/api-reference/exchange-methods/usersetabstraction)
[NextvaultDistributechevron-right](https://nktkas.gitbook.io/hyperliquid/api-reference/exchange-methods/vaultdistribute)
Last updated 9 days ago
sun-brightdesktopmoon
Copy
import * as hl from "@nktkas/hyperliquid";
import { privateKeyToAccount } from "npm:viem/accounts";
const wallet = privateKeyToAccount("0x..."); // viem or ethers
const transport = new hl.HttpTransport(); // or `WebSocketTransport`
const client = new hl.ExchangeClient({ transport, wallet });
await client.validatorL1Stream({ riskFreeRate: "0.05" });
sun-brightdesktopmoon
---
# userSetAbstraction | Hyperliquid
post
https://api.hyperliquid.xyzMainnetchevron-down
https://api.hyperliquid.xyzhttps://api.hyperliquid-testnet.xyz
/exchangecopy
Set user abstraction mode.
Body
application/jsonchevron-down
application/json
Set user abstraction mode.
actionobjectRequired
Action to perform.
Show propertiesplus
noncenumberRequired
Nonce (timestamp in ms) used to prevent replay attacks.
signatureobjectRequired
ECDSA signature components.
Show propertiesplus
Responses
chevron-right
200
Successful response without specific data or error response.
application/json
anyOptional
Successful response without specific data or error response.
chevron-right
422
Failed to deserialize the JSON body into the target type
text/plain
post
/exchange
TypeScript
Test it
200
Successful response without specific data or error response.
chevron-down
No content
[PrevioususerPortfolioMarginchevron-left](https://nktkas.gitbook.io/hyperliquid/api-reference/exchange-methods/userportfoliomargin)
[NextvalidatorL1Streamchevron-right](https://nktkas.gitbook.io/hyperliquid/api-reference/exchange-methods/validatorl1stream)
Last updated 5 days ago
sun-brightdesktopmoon
Copy
import * as hl from "@nktkas/hyperliquid";
import { privateKeyToAccount } from "npm:viem/accounts";
const wallet = privateKeyToAccount("0x..."); // viem or ethers
const transport = new hl.HttpTransport(); // or `WebSocketTransport`
const client = new hl.ExchangeClient({ transport, wallet });
await client.userSetAbstraction({ user: "0x...", abstraction: "dexAbstraction" });
sun-brightdesktopmoon
---
# spotDeploy | Hyperliquid
post
https://api.hyperliquid.xyzMainnetchevron-down
https://api.hyperliquid.xyzhttps://api.hyperliquid-testnet.xyz
/exchangecopy
Deploying HIP-1 and HIP-2 assets.
Body
application/jsonchevron-down
application/json
Deploying HIP-1 and HIP-2 assets.
actionone ofRequired
Action to perform.
objectOptional
Action to perform.
Show propertiesplus
or
objectOptional
Action to perform.
Show propertiesplus
or
objectOptional
Action to perform.
Show propertiesplus
or
objectOptional
Action to perform.
Show propertiesplus
or
objectOptional
Action to perform.
Show propertiesplus
or
objectOptional
Action to perform.
Show propertiesplus
or
objectOptional
Action to perform.
Show propertiesplus
or
objectOptional
Action to perform.
Show propertiesplus
noncenumberRequired
Nonce (timestamp in ms) used to prevent replay attacks.
signatureobjectRequired
ECDSA signature components.
Show propertiesplus
expiresAfternumberOptional
Expiration time of the action.
Responses
chevron-right
200
Successful response without specific data or error response.
application/json
anyOptional
Successful response without specific data or error response.
chevron-right
422
Failed to deserialize the JSON body into the target type
text/plain
post
/exchange
TypeScript
Test it
200
Successful response without specific data or error response.
chevron-down
No content
[PrevioussetReferrerchevron-left](https://nktkas.gitbook.io/hyperliquid/api-reference/exchange-methods/setreferrer)
[NextspotSendchevron-right](https://nktkas.gitbook.io/hyperliquid/api-reference/exchange-methods/spotsend)
Last updated 9 days ago
sun-brightdesktopmoon
Copy
import * as hl from "@nktkas/hyperliquid";
import { privateKeyToAccount } from "npm:viem/accounts";
const wallet = privateKeyToAccount("0x..."); // viem or ethers
const transport = new hl.HttpTransport(); // or `WebSocketTransport`
const client = new hl.ExchangeClient({ transport, wallet });
await client.spotDeploy({
registerToken2: {
spec: {
name: "USDC",
szDecimals: 8,
weiDecimals: 8,
},
maxGas: 1000000,
fullName: "USD Coin",
},
});
sun-brightdesktopmoon
---
# twapOrder | Hyperliquid
post
https://api.hyperliquid.xyzMainnetchevron-down
https://api.hyperliquid.xyzhttps://api.hyperliquid-testnet.xyz
/exchangecopy
Place a TWAP order.
Body
application/jsonchevron-down
application/json
Place a TWAP order.
actionobjectRequired
Action to perform.
Show propertiesplus
noncenumberRequired
Nonce (timestamp in ms) used to prevent replay attacks.
signatureobjectRequired
ECDSA signature components.
Show propertiesplus
vaultAddressstring · min: 42 · max: 42Optional
Vault address (for vault trading).
Pattern: `^0[xX][0-9a-fA-F]+$`
expiresAfternumberOptional
Expiration time of the action.
Responses
chevron-right
200
Response for creating a TWAP order.
application/json
Response for creating a TWAP order.
statusstring · enumRequired
Successful status.
Possible values: `ok`
responseobjectRequired
Response details.
Show propertiesplus
chevron-right
422
Failed to deserialize the JSON body into the target type
text/plain
post
/exchange
TypeScript
Test it
200
Response for creating a TWAP order.
chevron-down
[PrevioustwapCancelchevron-left](https://nktkas.gitbook.io/hyperliquid/api-reference/exchange-methods/twapcancel)
[NextupdateIsolatedMarginchevron-right](https://nktkas.gitbook.io/hyperliquid/api-reference/exchange-methods/updateisolatedmargin)
Last updated 9 days ago
sun-brightdesktopmoon
Copy
import * as hl from "@nktkas/hyperliquid";
import { privateKeyToAccount } from "npm:viem/accounts";
const wallet = privateKeyToAccount("0x..."); // viem or ethers
const transport = new hl.HttpTransport(); // or `WebSocketTransport`
const client = new hl.ExchangeClient({ transport, wallet });
const data = await client.twapOrder({
twap: {
a: 0,
b: true,
s: "1",
r: false,
m: 10,
t: true,
},
});
Copy
{
"status": "ok",
"response": {
"type": "twapOrder",
"data": {
"status": {
"running": {
"twapId": 1
}
}
}
}
}
sun-brightdesktopmoon
---
# usdSend | Hyperliquid
post
https://api.hyperliquid.xyzMainnetchevron-down
https://api.hyperliquid.xyzhttps://api.hyperliquid-testnet.xyz
/exchangecopy
Send usd to another address.
Body
application/jsonchevron-down
application/json
Send usd to another address.
actionobjectRequired
Action to perform.
Show propertiesplus
noncenumberRequired
Nonce (timestamp in ms) used to prevent replay attacks.
signatureobjectRequired
ECDSA signature components.
Show propertiesplus
Responses
chevron-right
200
Successful response without specific data or error response.
application/json
anyOptional
Successful response without specific data or error response.
chevron-right
422
Failed to deserialize the JSON body into the target type
text/plain
post
/exchange
TypeScript
Test it
200
Successful response without specific data or error response.
chevron-down
No content
[PrevioususdClassTransferchevron-left](https://nktkas.gitbook.io/hyperliquid/api-reference/exchange-methods/usdclasstransfer)
[NextuserDexAbstractionchevron-right](https://nktkas.gitbook.io/hyperliquid/api-reference/exchange-methods/userdexabstraction)
Last updated 9 days ago
sun-brightdesktopmoon
Copy
import * as hl from "@nktkas/hyperliquid";
import { privateKeyToAccount } from "npm:viem/accounts";
const wallet = privateKeyToAccount("0x..."); // viem or ethers
const transport = new hl.HttpTransport(); // or `WebSocketTransport`
const client = new hl.ExchangeClient({ transport, wallet });
await client.usdSend({ destination: "0x...", amount: "1" });
sun-brightdesktopmoon
---
# vaultModify | Hyperliquid
post
https://api.hyperliquid.xyzMainnetchevron-down
https://api.hyperliquid.xyzhttps://api.hyperliquid-testnet.xyz
/exchangecopy
Modify a vault's configuration.
Body
application/jsonchevron-down
application/json
Modify a vault's configuration.
actionobjectRequired
Action to perform.
Show propertiesplus
noncenumberRequired
Nonce (timestamp in ms) used to prevent replay attacks.
signatureobjectRequired
ECDSA signature components.
Show propertiesplus
expiresAfternumberOptional
Expiration time of the action.
Responses
chevron-right
200
Successful response without specific data or error response.
application/json
anyOptional
Successful response without specific data or error response.
chevron-right
422
Failed to deserialize the JSON body into the target type
text/plain
post
/exchange
TypeScript
Test it
200
Successful response without specific data or error response.
chevron-down
No content
[PreviousvaultDistributechevron-left](https://nktkas.gitbook.io/hyperliquid/api-reference/exchange-methods/vaultdistribute)
[NextvaultTransferchevron-right](https://nktkas.gitbook.io/hyperliquid/api-reference/exchange-methods/vaulttransfer)
Last updated 9 days ago
sun-brightdesktopmoon
Copy
import * as hl from "@nktkas/hyperliquid";
import { privateKeyToAccount } from "npm:viem/accounts";
const wallet = privateKeyToAccount("0x..."); // viem or ethers
const transport = new hl.HttpTransport(); // or `WebSocketTransport`
const client = new hl.ExchangeClient({ transport, wallet });
await client.vaultModify({
vaultAddress: "0x...",
allowDeposits: true,
alwaysCloseOnWithdraw: false,
});
sun-brightdesktopmoon
---
# subAccountModify | Hyperliquid
post
https://api.hyperliquid.xyzMainnetchevron-down
https://api.hyperliquid.xyzhttps://api.hyperliquid-testnet.xyz
/exchangecopy
Modify a sub-account.
Body
application/jsonchevron-down
application/json
Modify a sub-account.
actionobjectRequired
Action to perform.
Show propertiesplus
noncenumberRequired
Nonce (timestamp in ms) used to prevent replay attacks.
signatureobjectRequired
ECDSA signature components.
Show propertiesplus
expiresAfternumberOptional
Expiration time of the action.
Responses
chevron-right
200
Successful response without specific data or error response.
application/json
anyOptional
Successful response without specific data or error response.
chevron-right
422
Failed to deserialize the JSON body into the target type
text/plain
post
/exchange
TypeScript
Test it
200
Successful response without specific data or error response.
chevron-down
No content
[PreviousspotUserchevron-left](https://nktkas.gitbook.io/hyperliquid/api-reference/exchange-methods/spotuser)
[NextsubAccountSpotTransferchevron-right](https://nktkas.gitbook.io/hyperliquid/api-reference/exchange-methods/subaccountspottransfer)
Last updated 9 days ago
sun-brightdesktopmoon
Copy
import * as hl from "@nktkas/hyperliquid";
import { privateKeyToAccount } from "npm:viem/accounts";
const wallet = privateKeyToAccount("0x..."); // viem or ethers
const transport = new hl.HttpTransport(); // or `WebSocketTransport`
const client = new hl.ExchangeClient({ transport, wallet });
await client.subAccountModify({ subAccountUser: "0x...", name: "..." });
sun-brightdesktopmoon
---
# usdClassTransfer | Hyperliquid
post
https://api.hyperliquid.xyzMainnetchevron-down
https://api.hyperliquid.xyzhttps://api.hyperliquid-testnet.xyz
/exchangecopy
Transfer funds between Spot account and Perp account.
Body
application/jsonchevron-down
application/json
Transfer funds between Spot account and Perp account.
actionobjectRequired
Action to perform.
Show propertiesplus
noncenumberRequired
Nonce (timestamp in ms) used to prevent replay attacks.
signatureobjectRequired
ECDSA signature components.
Show propertiesplus
Responses
chevron-right
200
Successful response without specific data or error response.
application/json
anyOptional
Successful response without specific data or error response.
chevron-right
422
Failed to deserialize the JSON body into the target type
text/plain
post
/exchange
TypeScript
Test it
200
Successful response without specific data or error response.
chevron-down
No content
[PreviousupdateLeveragechevron-left](https://nktkas.gitbook.io/hyperliquid/api-reference/exchange-methods/updateleverage)
[NextusdSendchevron-right](https://nktkas.gitbook.io/hyperliquid/api-reference/exchange-methods/usdsend)
Last updated 9 days ago
sun-brightdesktopmoon
Copy
import * as hl from "@nktkas/hyperliquid";
import { privateKeyToAccount } from "npm:viem/accounts";
const wallet = privateKeyToAccount("0x..."); // viem or ethers
const transport = new hl.HttpTransport(); // or `WebSocketTransport`
const client = new hl.ExchangeClient({ transport, wallet });
await client.usdClassTransfer({ amount: "1", toPerp: true });
sun-brightdesktopmoon
---
# perpDeploy | Hyperliquid
post
https://api.hyperliquid.xyzMainnetchevron-down
https://api.hyperliquid.xyzhttps://api.hyperliquid-testnet.xyz
/exchangecopy
Deploying HIP-3 assets.
Body
application/jsonchevron-down
application/json
Deploying HIP-3 assets.
actionone ofRequired
Action to perform.
objectOptional
Action to perform.
Show propertiesplus
or
objectOptional
Action to perform.
Show propertiesplus
or
objectOptional
Action to perform.
Show propertiesplus
or
objectOptional
Action to perform.
Show propertiesplus
or
objectOptional
Action to perform.
Show propertiesplus
or
objectOptional
Action to perform.
Show propertiesplus
or
objectOptional
Action to perform.
Show propertiesplus
or
objectOptional
Action to perform.
Show propertiesplus
or
objectOptional
Action to perform.
Show propertiesplus
or
objectOptional
Action to perform.
Show propertiesplus
or
objectOptional
Action to perform.
Show propertiesplus
or
objectOptional
Action to perform.
Show propertiesplus
or
objectOptional
Action to perform.
Show propertiesplus
or
objectOptional
Action to perform.
Show propertiesplus
noncenumberRequired
Nonce (timestamp in ms) used to prevent replay attacks.
signatureobjectRequired
ECDSA signature components.
Show propertiesplus
expiresAfternumberOptional
Expiration time of the action.
Responses
chevron-right
200
Successful response without specific data or error response.
application/json
anyOptional
Successful response without specific data or error response.
chevron-right
422
Failed to deserialize the JSON body into the target type
text/plain
post
/exchange
TypeScript
Test it
200
Successful response without specific data or error response.
chevron-down
No content
[Previousorderchevron-left](https://nktkas.gitbook.io/hyperliquid/api-reference/exchange-methods/order)
[NextregisterReferrerchevron-right](https://nktkas.gitbook.io/hyperliquid/api-reference/exchange-methods/registerreferrer)
Last updated 3 days ago
sun-brightdesktopmoon
Copy
import * as hl from "@nktkas/hyperliquid";
import { privateKeyToAccount } from "npm:viem/accounts";
const wallet = privateKeyToAccount("0x..."); // viem or ethers
const transport = new hl.HttpTransport(); // or `WebSocketTransport`
const client = new hl.ExchangeClient({ transport, wallet });
await client.perpDeploy({
registerAsset: {
maxGas: 1000000,
assetRequest: {
coin: "USDC",
szDecimals: 8,
oraclePx: "1",
marginTableId: 1,
onlyIsolated: false,
},
dex: "test",
schema: null,
},
});
sun-brightdesktopmoon
---
# topUpIsolatedOnlyMargin | Hyperliquid
post
https://api.hyperliquid.xyzMainnetchevron-down
https://api.hyperliquid.xyzhttps://api.hyperliquid-testnet.xyz
/exchangecopy
Top up isolated margin by targeting a specific leverage.
Body
application/jsonchevron-down
application/json
Top up isolated margin by targeting a specific leverage.
actionobjectRequired
Action to perform.
Show propertiesplus
noncenumberRequired
Nonce (timestamp in ms) used to prevent replay attacks.
signatureobjectRequired
ECDSA signature components.
Show propertiesplus
vaultAddressstring · min: 42 · max: 42Optional
Vault address (for vault trading).
Pattern: `^0[xX][0-9a-fA-F]+$`
expiresAfternumberOptional
Expiration time of the action.
Responses
chevron-right
200
Successful response without specific data or error response.
application/json
anyOptional
Successful response without specific data or error response.
chevron-right
422
Failed to deserialize the JSON body into the target type
text/plain
post
/exchange
TypeScript
Test it
200
Successful response without specific data or error response.
chevron-down
No content
[PrevioustokenDelegatechevron-left](https://nktkas.gitbook.io/hyperliquid/api-reference/exchange-methods/tokendelegate)
[NexttwapCancelchevron-right](https://nktkas.gitbook.io/hyperliquid/api-reference/exchange-methods/twapcancel)
Last updated 4 days ago
sun-brightdesktopmoon
Copy
import * as hl from "@nktkas/hyperliquid";
import { privateKeyToAccount } from "npm:viem/accounts";
const wallet = privateKeyToAccount("0x..."); // viem or ethers
const transport = new hl.HttpTransport(); // or `WebSocketTransport`
const client = new hl.ExchangeClient({ transport, wallet });
await client.topUpIsolatedOnlyMargin({ asset: 0, leverage: "0.5" });
sun-brightdesktopmoon
---
# Info Methods | Hyperliquid
[activeAssetDatachevron-right](https://nktkas.gitbook.io/hyperliquid/api-reference/info-methods/activeassetdata)
[alignedQuoteTokenInfochevron-right](https://nktkas.gitbook.io/hyperliquid/api-reference/info-methods/alignedquotetokeninfo)
[allBorrowLendReserveStateschevron-right](https://nktkas.gitbook.io/hyperliquid/api-reference/info-methods/allborrowlendreservestates)
[allMidschevron-right](https://nktkas.gitbook.io/hyperliquid/api-reference/info-methods/allmids)
[allPerpMetaschevron-right](https://nktkas.gitbook.io/hyperliquid/api-reference/info-methods/allperpmetas)
[approvedBuilderschevron-right](https://nktkas.gitbook.io/hyperliquid/api-reference/info-methods/approvedbuilders)
[blockDetailschevron-right](https://nktkas.gitbook.io/hyperliquid/api-reference/info-methods/blockdetails)
[borrowLendReserveStatechevron-right](https://nktkas.gitbook.io/hyperliquid/api-reference/info-methods/borrowlendreservestate)
[borrowLendUserStatechevron-right](https://nktkas.gitbook.io/hyperliquid/api-reference/info-methods/borrowlenduserstate)
[candleSnapshotchevron-right](https://nktkas.gitbook.io/hyperliquid/api-reference/info-methods/candlesnapshot)
[clearinghouseStatechevron-right](https://nktkas.gitbook.io/hyperliquid/api-reference/info-methods/clearinghousestate)
[delegationschevron-right](https://nktkas.gitbook.io/hyperliquid/api-reference/info-methods/delegations)
[delegatorHistorychevron-right](https://nktkas.gitbook.io/hyperliquid/api-reference/info-methods/delegatorhistory)
[delegatorRewardschevron-right](https://nktkas.gitbook.io/hyperliquid/api-reference/info-methods/delegatorrewards)
[delegatorSummarychevron-right](https://nktkas.gitbook.io/hyperliquid/api-reference/info-methods/delegatorsummary)
[exchangeStatuschevron-right](https://nktkas.gitbook.io/hyperliquid/api-reference/info-methods/exchangestatus)
[extraAgentschevron-right](https://nktkas.gitbook.io/hyperliquid/api-reference/info-methods/extraagents)
[frontendOpenOrderschevron-right](https://nktkas.gitbook.io/hyperliquid/api-reference/info-methods/frontendopenorders)
[fundingHistorychevron-right](https://nktkas.gitbook.io/hyperliquid/api-reference/info-methods/fundinghistory)
[gossipRootIpschevron-right](https://nktkas.gitbook.io/hyperliquid/api-reference/info-methods/gossiprootips)
[historicalOrderschevron-right](https://nktkas.gitbook.io/hyperliquid/api-reference/info-methods/historicalorders)
[isVipchevron-right](https://nktkas.gitbook.io/hyperliquid/api-reference/info-methods/isvip)
[l2Bookchevron-right](https://nktkas.gitbook.io/hyperliquid/api-reference/info-methods/l2book)
[leadingVaultschevron-right](https://nktkas.gitbook.io/hyperliquid/api-reference/info-methods/leadingvaults)
[legalCheckchevron-right](https://nktkas.gitbook.io/hyperliquid/api-reference/info-methods/legalcheck)
[liquidatablechevron-right](https://nktkas.gitbook.io/hyperliquid/api-reference/info-methods/liquidatable)
[marginTablechevron-right](https://nktkas.gitbook.io/hyperliquid/api-reference/info-methods/margintable)
[maxBuilderFeechevron-right](https://nktkas.gitbook.io/hyperliquid/api-reference/info-methods/maxbuilderfee)
[maxMarketOrderNtlschevron-right](https://nktkas.gitbook.io/hyperliquid/api-reference/info-methods/maxmarketorderntls)
[metachevron-right](https://nktkas.gitbook.io/hyperliquid/api-reference/info-methods/meta)
[metaAndAssetCtxschevron-right](https://nktkas.gitbook.io/hyperliquid/api-reference/info-methods/metaandassetctxs)
[openOrderschevron-right](https://nktkas.gitbook.io/hyperliquid/api-reference/info-methods/openorders)
[orderStatuschevron-right](https://nktkas.gitbook.io/hyperliquid/api-reference/info-methods/orderstatus)
[outcomeMetachevron-right](https://nktkas.gitbook.io/hyperliquid/api-reference/info-methods/outcomemeta)
[perpAnnotationchevron-right](https://nktkas.gitbook.io/hyperliquid/api-reference/info-methods/perpannotation)
[perpCategorieschevron-right](https://nktkas.gitbook.io/hyperliquid/api-reference/info-methods/perpcategories)
[perpDeployAuctionStatuschevron-right](https://nktkas.gitbook.io/hyperliquid/api-reference/info-methods/perpdeployauctionstatus)
[perpDexLimitschevron-right](https://nktkas.gitbook.io/hyperliquid/api-reference/info-methods/perpdexlimits)
[perpDexStatuschevron-right](https://nktkas.gitbook.io/hyperliquid/api-reference/info-methods/perpdexstatus)
[perpDexschevron-right](https://nktkas.gitbook.io/hyperliquid/api-reference/info-methods/perpdexs)
[perpsAtOpenInterestCapchevron-right](https://nktkas.gitbook.io/hyperliquid/api-reference/info-methods/perpsatopeninterestcap)
[portfoliochevron-right](https://nktkas.gitbook.io/hyperliquid/api-reference/info-methods/portfolio)
[preTransferCheckchevron-right](https://nktkas.gitbook.io/hyperliquid/api-reference/info-methods/pretransfercheck)
[predictedFundingschevron-right](https://nktkas.gitbook.io/hyperliquid/api-reference/info-methods/predictedfundings)
[recentTradeschevron-right](https://nktkas.gitbook.io/hyperliquid/api-reference/info-methods/recenttrades)
[referralchevron-right](https://nktkas.gitbook.io/hyperliquid/api-reference/info-methods/referral)
[spotClearinghouseStatechevron-right](https://nktkas.gitbook.io/hyperliquid/api-reference/info-methods/spotclearinghousestate)
[spotDeployStatechevron-right](https://nktkas.gitbook.io/hyperliquid/api-reference/info-methods/spotdeploystate)
[spotMetachevron-right](https://nktkas.gitbook.io/hyperliquid/api-reference/info-methods/spotmeta)
[spotMetaAndAssetCtxschevron-right](https://nktkas.gitbook.io/hyperliquid/api-reference/info-methods/spotmetaandassetctxs)
[spotPairDeployAuctionStatuschevron-right](https://nktkas.gitbook.io/hyperliquid/api-reference/info-methods/spotpairdeployauctionstatus)
[subAccountschevron-right](https://nktkas.gitbook.io/hyperliquid/api-reference/info-methods/subaccounts)
[subAccounts2chevron-right](https://nktkas.gitbook.io/hyperliquid/api-reference/info-methods/subaccounts2)
[tokenDetailschevron-right](https://nktkas.gitbook.io/hyperliquid/api-reference/info-methods/tokendetails)
[twapHistorychevron-right](https://nktkas.gitbook.io/hyperliquid/api-reference/info-methods/twaphistory)
[txDetailschevron-right](https://nktkas.gitbook.io/hyperliquid/api-reference/info-methods/txdetails)
[userAbstractionchevron-right](https://nktkas.gitbook.io/hyperliquid/api-reference/info-methods/userabstraction)
[userBorrowLendInterestchevron-right](https://nktkas.gitbook.io/hyperliquid/api-reference/info-methods/userborrowlendinterest)
[userDetailschevron-right](https://nktkas.gitbook.io/hyperliquid/api-reference/info-methods/userdetails)
[userDexAbstractionchevron-right](https://nktkas.gitbook.io/hyperliquid/api-reference/info-methods/userdexabstraction)
[userFeeschevron-right](https://nktkas.gitbook.io/hyperliquid/api-reference/info-methods/userfees)
[userFillschevron-right](https://nktkas.gitbook.io/hyperliquid/api-reference/info-methods/userfills)
[userFillsByTimechevron-right](https://nktkas.gitbook.io/hyperliquid/api-reference/info-methods/userfillsbytime)
[userFundingchevron-right](https://nktkas.gitbook.io/hyperliquid/api-reference/info-methods/userfunding)
[userNonFundingLedgerUpdateschevron-right](https://nktkas.gitbook.io/hyperliquid/api-reference/info-methods/usernonfundingledgerupdates)
[userRateLimitchevron-right](https://nktkas.gitbook.io/hyperliquid/api-reference/info-methods/userratelimit)
[userRolechevron-right](https://nktkas.gitbook.io/hyperliquid/api-reference/info-methods/userrole)
[userToMultiSigSignerschevron-right](https://nktkas.gitbook.io/hyperliquid/api-reference/info-methods/usertomultisigsigners)
[userTwapSliceFillschevron-right](https://nktkas.gitbook.io/hyperliquid/api-reference/info-methods/usertwapslicefills)
[userTwapSliceFillsByTimechevron-right](https://nktkas.gitbook.io/hyperliquid/api-reference/info-methods/usertwapslicefillsbytime)
[userVaultEquitieschevron-right](https://nktkas.gitbook.io/hyperliquid/api-reference/info-methods/uservaultequities)
[validatorL1Voteschevron-right](https://nktkas.gitbook.io/hyperliquid/api-reference/info-methods/validatorl1votes)
[validatorSummarieschevron-right](https://nktkas.gitbook.io/hyperliquid/api-reference/info-methods/validatorsummaries)
[vaultDetailschevron-right](https://nktkas.gitbook.io/hyperliquid/api-reference/info-methods/vaultdetails)
[vaultSummarieschevron-right](https://nktkas.gitbook.io/hyperliquid/api-reference/info-methods/vaultsummaries)
[webData2chevron-right](https://nktkas.gitbook.io/hyperliquid/api-reference/info-methods/webdata2)
[PreviousTree-shakingchevron-left](https://nktkas.gitbook.io/hyperliquid/guides/tree-shaking)
[NextactiveAssetDatachevron-right](https://nktkas.gitbook.io/hyperliquid/api-reference/info-methods/activeassetdata)
Last updated 5 days ago
sun-brightdesktopmoon
sun-brightdesktopmoon
---
# approvedBuilders | Hyperliquid
post
https://api.hyperliquid.xyzMainnetchevron-down
https://api.hyperliquid.xyzhttps://api.hyperliquid-testnet.xyz
/infocopy
Request approved builders for a user.
Body
application/jsonchevron-down
application/json
Request approved builders for a user.
typeundefined · enumRequired
Type of request.
Possible values: `approvedBuilders`
userstring · min: 42 · max: 42Required
User address.
Pattern: `^0[xX][0-9a-fA-F]+$`
Responses
chevron-right
200
Array of approved builder addresses.
application/json
string\[\]Optional
Array of approved builder addresses.
chevron-right
422
Failed to deserialize the JSON body into the target type
text/plain
chevron-right
500
Internal Server Error
application/json
post
/info
TypeScript
Test it
200
Array of approved builder addresses.
chevron-down
[PreviousallPerpMetaschevron-left](https://nktkas.gitbook.io/hyperliquid/api-reference/info-methods/allperpmetas)
[NextblockDetailschevron-right](https://nktkas.gitbook.io/hyperliquid/api-reference/info-methods/blockdetails)
Last updated 4 days ago
sun-brightdesktopmoon
Copy
import * as hl from "@nktkas/hyperliquid";
const transport = new hl.HttpTransport(); // or `WebSocketTransport`
const client = new hl.InfoClient({ transport });
const data = await client.approvedBuilders({ user: "0x..." });
Copy
[\
"text"\
]
sun-brightdesktopmoon
---
# allMids | Hyperliquid
post
https://api.hyperliquid.xyzMainnetchevron-down
https://api.hyperliquid.xyzhttps://api.hyperliquid-testnet.xyz
/infocopy
Request mid coin prices.
Body
application/jsonchevron-down
application/json
Request mid coin prices.
typeundefined · enumRequired
Type of request.
Possible values: `allMids`
dexstringOptional
DEX name (empty string for main dex).
Responses
chevron-right
200
Mapping of coin symbols to mid prices.
application/json
Mapping of coin symbols to mid prices.
Other propertiesstringOptionalPattern: `^[0-9]+(\.[0-9]+)?$`
chevron-right
422
Failed to deserialize the JSON body into the target type
text/plain
chevron-right
500
Internal Server Error
application/json
post
/info
TypeScript
Test it
200
Mapping of coin symbols to mid prices.
chevron-down
[PreviousallBorrowLendReserveStateschevron-left](https://nktkas.gitbook.io/hyperliquid/api-reference/info-methods/allborrowlendreservestates)
[NextallPerpMetaschevron-right](https://nktkas.gitbook.io/hyperliquid/api-reference/info-methods/allperpmetas)
Last updated 9 days ago
sun-brightdesktopmoon
Copy
import * as hl from "@nktkas/hyperliquid";
const transport = new hl.HttpTransport(); // or `WebSocketTransport`
const client = new hl.InfoClient({ transport });
const data = await client.allMids();
Copy
{
"ANY_ADDITIONAL_PROPERTY": "text"
}
sun-brightdesktopmoon
---
# borrowLendReserveState | Hyperliquid
post
https://api.hyperliquid.xyzMainnetchevron-down
https://api.hyperliquid.xyzhttps://api.hyperliquid-testnet.xyz
/infocopy
Request borrow/lend reserve states.
Body
application/jsonchevron-down
application/json
Request borrow/lend reserve states.
typeundefined · enumRequired
Type of request.
Possible values: `borrowLendReserveState`
tokennumberRequired
Token index.
Responses
chevron-right
200
Borrow/lend reserve state.
application/json
Borrow/lend reserve state.
borrowYearlyRatestringRequired
Borrow interest rate (yearly).
Pattern: `^[0-9]+(\.[0-9]+)?$`
supplyYearlyRatestringRequired
Supply interest rate (yearly).
Pattern: `^[0-9]+(\.[0-9]+)?$`
balancestringRequired
Reserve balance.
Pattern: `^[0-9]+(\.[0-9]+)?$`
utilizationstringRequired
Reserve utilization ratio.
Pattern: `^[0-9]+(\.[0-9]+)?$`
oraclePxstringRequired
Oracle price.
Pattern: `^[0-9]+(\.[0-9]+)?$`
ltvstringRequired
Loan-to-value (LTV) ratio.
Pattern: `^[0-9]+(\.[0-9]+)?$`
totalSuppliedstringRequired
Total supplied amount.
Pattern: `^[0-9]+(\.[0-9]+)?$`
totalBorrowedstringRequired
Total borrowed amount.
Pattern: `^[0-9]+(\.[0-9]+)?$`
chevron-right
422
Failed to deserialize the JSON body into the target type
text/plain
chevron-right
500
Internal Server Error
application/json
post
/info
TypeScript
Test it
200
Borrow/lend reserve state.
chevron-down
[PreviousblockDetailschevron-left](https://nktkas.gitbook.io/hyperliquid/api-reference/info-methods/blockdetails)
[NextborrowLendUserStatechevron-right](https://nktkas.gitbook.io/hyperliquid/api-reference/info-methods/borrowlenduserstate)
Last updated 9 days ago
sun-brightdesktopmoon
Copy
import * as hl from "@nktkas/hyperliquid";
const transport = new hl.HttpTransport(); // or `WebSocketTransport`
const client = new hl.InfoClient({ transport });
const data = await client.borrowLendReserveState({ token: 0 });
Copy
{
"borrowYearlyRate": "text",
"supplyYearlyRate": "text",
"balance": "text",
"utilization": "text",
"oraclePx": "text",
"ltv": "text",
"totalSupplied": "text",
"totalBorrowed": "text"
}
sun-brightdesktopmoon
---
# borrowLendUserState | Hyperliquid
post
https://api.hyperliquid.xyzMainnetchevron-down
https://api.hyperliquid.xyzhttps://api.hyperliquid-testnet.xyz
/infocopy
Request borrow/lend user state.
Body
application/jsonchevron-down
application/json
Request borrow/lend user state.
typeundefined · enumRequired
Type of request.
Possible values: `borrowLendUserState`
userstring · min: 42 · max: 42Required
User address.
Pattern: `^0[xX][0-9a-fA-F]+$`
Responses
chevron-right
200
User's borrow/lend state.
application/json
User's borrow/lend state.
tokenToStateany\[\]\[\]Required
Array of tuples of token IDs and their borrow/lend state.
Show propertiesplus
healthstring · enumRequired
Account health status.
Possible values: `healthy`
healthFactorany · nullableRequired
Health factor.
chevron-right
422
Failed to deserialize the JSON body into the target type
text/plain
chevron-right
500
Internal Server Error
application/json
post
/info
TypeScript
Test it
200
User's borrow/lend state.
chevron-down
[PreviousborrowLendReserveStatechevron-left](https://nktkas.gitbook.io/hyperliquid/api-reference/info-methods/borrowlendreservestate)
[NextcandleSnapshotchevron-right](https://nktkas.gitbook.io/hyperliquid/api-reference/info-methods/candlesnapshot)
Last updated 9 days ago
sun-brightdesktopmoon
Copy
import * as hl from "@nktkas/hyperliquid";
const transport = new hl.HttpTransport(); // or `WebSocketTransport`
const client = new hl.InfoClient({ transport });
const data = await client.borrowLendUserState({ user: "0x..." });
Copy
{
"tokenToState": [\
[]\
],
"health": "healthy",
"healthFactor": null
}
sun-brightdesktopmoon
---
# candleSnapshot | Hyperliquid
post
https://api.hyperliquid.xyzMainnetchevron-down
https://api.hyperliquid.xyzhttps://api.hyperliquid-testnet.xyz
/infocopy
Request candlestick snapshots.
Body
application/jsonchevron-down
application/json
Request candlestick snapshots.
typeundefined · enumRequired
Type of request.
Possible values: `candleSnapshot`
reqobjectRequired
Request parameters.
Show propertiesplus
Responses
chevron-right
200
Array of candlestick data points.
application/json
Array of candlestick data points.
tnumberRequired
Opening timestamp (ms since epoch).
TnumberRequired
Closing timestamp (ms since epoch).
sstringRequired
Asset symbol.
istring · enumRequired
Time interval.
Possible values: `1m``3m``5m``15m``30m``1h``2h``4h``8h``12h``1d``3d``1w``1M`
ostringRequired
Opening price.
Pattern: `^[0-9]+(\.[0-9]+)?$`
cstringRequired
Closing price.
Pattern: `^[0-9]+(\.[0-9]+)?$`
hstringRequired
Highest price.
Pattern: `^[0-9]+(\.[0-9]+)?$`
lstringRequired
Lowest price.
Pattern: `^[0-9]+(\.[0-9]+)?$`
vstringRequired
Total volume traded in base currency.
Pattern: `^[0-9]+(\.[0-9]+)?$`
nnumberRequired
Number of trades executed.
chevron-right
422
Failed to deserialize the JSON body into the target type
text/plain
chevron-right
500
Internal Server Error
application/json
post
/info
TypeScript
Test it
200
Array of candlestick data points.
chevron-down
[PreviousborrowLendUserStatechevron-left](https://nktkas.gitbook.io/hyperliquid/api-reference/info-methods/borrowlenduserstate)
[NextclearinghouseStatechevron-right](https://nktkas.gitbook.io/hyperliquid/api-reference/info-methods/clearinghousestate)
Last updated 9 days ago
sun-brightdesktopmoon
Copy
import * as hl from "@nktkas/hyperliquid";
const transport = new hl.HttpTransport(); // or `WebSocketTransport`
const client = new hl.InfoClient({ transport });
const data = await client.candleSnapshot({
coin: "ETH",
interval: "1h",
startTime: Date.now() - 1000 * 60 * 60 * 24,
});
Copy
[\
{\
"t": 1,\
"T": 1,\
"s": "text",\
"i": "1m",\
"o": "text",\
"c": "text",\
"h": "text",\
"l": "text",\
"v": "text",\
"n": 1\
}\
]
sun-brightdesktopmoon
---
# blockDetails | Hyperliquid
post
https://api.hyperliquid.xyzMainnetchevron-down
https://api.hyperliquid.xyzhttps://api.hyperliquid-testnet.xyz
/infocopy
Request block details by block height.
Body
application/jsonchevron-down
application/json
Request block details by block height.
typeundefined · enumRequired
Type of request.
Possible values: `blockDetails`
heightnumberRequired
Block height.
Responses
chevron-right
200
Response containing block information.
application/json
Response containing block information.
typestring · enumRequired
Type of response.
Possible values: `blockDetails`
blockDetailsobjectRequired
The details of a block.
Show propertiesplus
chevron-right
422
Failed to deserialize the JSON body into the target type
text/plain
chevron-right
500
Internal Server Error
application/json
post
/info
TypeScript
Test it
200
Response containing block information.
chevron-down
[PreviousapprovedBuilderschevron-left](https://nktkas.gitbook.io/hyperliquid/api-reference/info-methods/approvedbuilders)
[NextborrowLendReserveStatechevron-right](https://nktkas.gitbook.io/hyperliquid/api-reference/info-methods/borrowlendreservestate)
Last updated 9 days ago
sun-brightdesktopmoon
Copy
import * as hl from "@nktkas/hyperliquid";
const transport = new hl.HttpTransport(); // or `WebSocketTransport`
const client = new hl.InfoClient({ transport });
const data = await client.blockDetails({ height: 123 });
Copy
{
"type": "blockDetails",
"blockDetails": {
"blockTime": 1,
"hash": "text",
"height": 1,
"numTxs": 1,
"proposer": "text",
"txs": []
}
}
sun-brightdesktopmoon
---
# delegatorHistory | Hyperliquid
post
https://api.hyperliquid.xyzMainnetchevron-down
https://api.hyperliquid.xyzhttps://api.hyperliquid-testnet.xyz
/infocopy
Request user staking history.
Body
application/jsonchevron-down
application/json
Request user staking history.
typeundefined · enumRequired
Type of request.
Possible values: `delegatorHistory`
userstring · min: 42 · max: 42Required
User address.
Pattern: `^0[xX][0-9a-fA-F]+$`
Responses
chevron-right
200
Array of records of staking events by a delegator.
application/json
Array of records of staking events by a delegator.
timenumberRequired
Timestamp of the delegation event (in ms since epoch).
hashstringRequired
Transaction hash of the delegation event.
Pattern: `^0x[a-fA-F0-9]{64}$`
deltaany ofRequired
Details of the update.
objectOptional
Show propertiesplus
or
objectOptional
Show propertiesplus
or
objectOptional
Show propertiesplus
chevron-right
422
Failed to deserialize the JSON body into the target type
text/plain
chevron-right
500
Internal Server Error
application/json
post
/info
TypeScript
Test it
200
Array of records of staking events by a delegator.
chevron-down
[Previousdelegationschevron-left](https://nktkas.gitbook.io/hyperliquid/api-reference/info-methods/delegations)
[NextdelegatorRewardschevron-right](https://nktkas.gitbook.io/hyperliquid/api-reference/info-methods/delegatorrewards)
Last updated 9 days ago
sun-brightdesktopmoon
Copy
import * as hl from "@nktkas/hyperliquid";
const transport = new hl.HttpTransport(); // or `WebSocketTransport`
const client = new hl.InfoClient({ transport });
const data = await client.delegatorHistory({ user: "0x..." });
Copy
[\
{\
"time": 1,\
"hash": "text",\
"delta": {\
"delegate": {\
"validator": "text",\
"amount": "text",\
"isUndelegate": true\
}\
}\
}\
]
sun-brightdesktopmoon
---
# allBorrowLendReserveStates | Hyperliquid
post
https://api.hyperliquid.xyzMainnetchevron-down
https://api.hyperliquid.xyzhttps://api.hyperliquid-testnet.xyz
/infocopy
Request all borrow/lend reserve states.
Body
application/jsonchevron-down
application/json
Request all borrow/lend reserve states.
typeundefined · enumRequired
Type of request.
Possible values: `allBorrowLendReserveStates`
Responses
chevron-right
200
Array of tuples of reserve IDs and their borrow/lend reserve state.
application/json
Array of tuples of reserve IDs and their borrow/lend reserve state.
itemsanyOptional
chevron-right
422
Failed to deserialize the JSON body into the target type
text/plain
chevron-right
500
Internal Server Error
application/json
post
/info
TypeScript
Test it
200
Array of tuples of reserve IDs and their borrow/lend reserve state.
chevron-down
[PreviousalignedQuoteTokenInfochevron-left](https://nktkas.gitbook.io/hyperliquid/api-reference/info-methods/alignedquotetokeninfo)
[NextallMidschevron-right](https://nktkas.gitbook.io/hyperliquid/api-reference/info-methods/allmids)
Last updated 9 days ago
sun-brightdesktopmoon
Copy
import * as hl from "@nktkas/hyperliquid";
const transport = new hl.HttpTransport(); // or `WebSocketTransport`
const client = new hl.InfoClient({ transport });
const data = await client.allBorrowLendReserveStates();
Copy
[\
[]\
]
sun-brightdesktopmoon
---
# allPerpMetas | Hyperliquid
post
https://api.hyperliquid.xyzMainnetchevron-down
https://api.hyperliquid.xyzhttps://api.hyperliquid-testnet.xyz
/infocopy
Request trading metadata for all DEXes.
Body
application/jsonchevron-down
application/json
Request trading metadata for all DEXes.
typeundefined · enumRequired
Type of request.
Possible values: `allPerpMetas`
Responses
chevron-right
200
Metadata for perpetual assets across all DEXes.
application/json
MetaResponse\[\]Optional
Metadata for perpetual assets across all DEXes.
chevron-right
422
Failed to deserialize the JSON body into the target type
text/plain
chevron-right
500
Internal Server Error
application/json
post
/info
TypeScript
Test it
200
Metadata for perpetual assets across all DEXes.
chevron-down
[PreviousallMidschevron-left](https://nktkas.gitbook.io/hyperliquid/api-reference/info-methods/allmids)
[NextapprovedBuilderschevron-right](https://nktkas.gitbook.io/hyperliquid/api-reference/info-methods/approvedbuilders)
Last updated 9 days ago
sun-brightdesktopmoon
Copy
import * as hl from "@nktkas/hyperliquid";
const transport = new hl.HttpTransport(); // or `WebSocketTransport`
const client = new hl.InfoClient({ transport });
const data = await client.allPerpMetas();
Copy
[]
sun-brightdesktopmoon
---
# exchangeStatus | Hyperliquid
post
https://api.hyperliquid.xyzMainnetchevron-down
https://api.hyperliquid.xyzhttps://api.hyperliquid-testnet.xyz
/infocopy
Request exchange system status information.
Body
application/jsonchevron-down
application/json
Request exchange system status information.
typeundefined · enumRequired
Type of request.
Possible values: `exchangeStatus`
Responses
chevron-right
200
Exchange system status information.
application/json
Exchange system status information.
timenumberRequired
Server time (in ms since epoch).
specialStatusesany ofRequired
Special statuses of the exchange system.
any · nullableOptional
chevron-right
422
Failed to deserialize the JSON body into the target type
text/plain
chevron-right
500
Internal Server Error
application/json
post
/info
TypeScript
Test it
200
Exchange system status information.
chevron-down
[PreviousdelegatorSummarychevron-left](https://nktkas.gitbook.io/hyperliquid/api-reference/info-methods/delegatorsummary)
[NextextraAgentschevron-right](https://nktkas.gitbook.io/hyperliquid/api-reference/info-methods/extraagents)
Last updated 9 days ago
sun-brightdesktopmoon
Copy
import * as hl from "@nktkas/hyperliquid";
const transport = new hl.HttpTransport(); // or `WebSocketTransport`
const client = new hl.InfoClient({ transport });
const data = await client.exchangeStatus();
Copy
{
"time": 1,
"specialStatuses": null
}
sun-brightdesktopmoon
---
# delegatorRewards | Hyperliquid
post
https://api.hyperliquid.xyzMainnetchevron-down
https://api.hyperliquid.xyzhttps://api.hyperliquid-testnet.xyz
/infocopy
Request user staking rewards.
Body
application/jsonchevron-down
application/json
Request user staking rewards.
typeundefined · enumRequired
Type of request.
Possible values: `delegatorRewards`
userstring · min: 42 · max: 42Required
User address.
Pattern: `^0[xX][0-9a-fA-F]+$`
Responses
chevron-right
200
Array of rewards received from staking activities.
application/json
Array of rewards received from staking activities.
timenumberRequired
Timestamp when the reward was received (in ms since epoch).
sourcestring · enumRequired
Source of the reward.
Possible values: `delegation``commission`
totalAmountstringRequired
Total reward amount.
Pattern: `^[0-9]+(\.[0-9]+)?$`
chevron-right
422
Failed to deserialize the JSON body into the target type
text/plain
chevron-right
500
Internal Server Error
application/json
post
/info
TypeScript
Test it
200
Array of rewards received from staking activities.
chevron-down
[PreviousdelegatorHistorychevron-left](https://nktkas.gitbook.io/hyperliquid/api-reference/info-methods/delegatorhistory)
[NextdelegatorSummarychevron-right](https://nktkas.gitbook.io/hyperliquid/api-reference/info-methods/delegatorsummary)
Last updated 9 days ago
sun-brightdesktopmoon
Copy
import * as hl from "@nktkas/hyperliquid";
const transport = new hl.HttpTransport(); // or `WebSocketTransport`
const client = new hl.InfoClient({ transport });
const data = await client.delegatorRewards({ user: "0x..." });
Copy
[\
{\
"time": 1,\
"source": "delegation",\
"totalAmount": "text"\
}\
]
sun-brightdesktopmoon
---
# alignedQuoteTokenInfo | Hyperliquid
post
https://api.hyperliquid.xyzMainnetchevron-down
https://api.hyperliquid.xyzhttps://api.hyperliquid-testnet.xyz
/infocopy
Request supply, rate, and pending payment information for an aligned quote token.
Body
application/jsonchevron-down
application/json
Request supply, rate, and pending payment information for an aligned quote token.
typeundefined · enumRequired
Type of request.
Possible values: `alignedQuoteTokenInfo`
tokennumberRequired
Token index.
Responses
chevron-right
200
Supply, rate, and pending payment information for an aligned quote token.
application/json
Supply, rate, and pending payment information for an aligned quote token.
isAlignedbooleanRequired
Whether the token is aligned.
firstAlignedTimenumberRequired
Timestamp (in ms since epoch) when the token was first aligned.
evmMintedSupplystringRequired
Total EVM minted supply.
Pattern: `^[0-9]+(\.[0-9]+)?$`
dailyAmountOwedany\[\]\[\]Required
Daily amount owed as an array of \[date, amount\] tuples.
Show propertiesplus
predictedRatestringRequired
Predicted rate.
Pattern: `^[0-9]+(\.[0-9]+)?$`
chevron-right
422
Failed to deserialize the JSON body into the target type
text/plain
chevron-right
500
Internal Server Error
application/json
post
/info
TypeScript
Test it
200
Supply, rate, and pending payment information for an aligned quote token.
chevron-down
[PreviousactiveAssetDatachevron-left](https://nktkas.gitbook.io/hyperliquid/api-reference/info-methods/activeassetdata)
[NextallBorrowLendReserveStateschevron-right](https://nktkas.gitbook.io/hyperliquid/api-reference/info-methods/allborrowlendreservestates)
Last updated 9 days ago
sun-brightdesktopmoon
Copy
import * as hl from "@nktkas/hyperliquid";
const transport = new hl.HttpTransport(); // or `WebSocketTransport`
const client = new hl.InfoClient({ transport });
const data = await client.alignedQuoteTokenInfo({ token: 1328 });
Copy
{
"isAligned": true,
"firstAlignedTime": 1,
"evmMintedSupply": "text",
"dailyAmountOwed": [\
[]\
],
"predictedRate": "text"
}
sun-brightdesktopmoon
---
# delegatorSummary | Hyperliquid
post
https://api.hyperliquid.xyzMainnetchevron-down
https://api.hyperliquid.xyzhttps://api.hyperliquid-testnet.xyz
/infocopy
Request user's staking summary.
Body
application/jsonchevron-down
application/json
Request user's staking summary.
typeundefined · enumRequired
Type of request.
Possible values: `delegatorSummary`
userstring · min: 42 · max: 42Required
User address.
Pattern: `^0[xX][0-9a-fA-F]+$`
Responses
chevron-right
200
User's staking summary.
application/json
User's staking summary.
delegatedstringRequired
Total amount of delegated tokens.
Pattern: `^[0-9]+(\.[0-9]+)?$`
undelegatedstringRequired
Total amount of undelegated tokens.
Pattern: `^[0-9]+(\.[0-9]+)?$`
totalPendingWithdrawalstringRequired
Total amount of tokens pending withdrawal.
Pattern: `^[0-9]+(\.[0-9]+)?$`
nPendingWithdrawalsnumberRequired
Number of pending withdrawals.
chevron-right
422
Failed to deserialize the JSON body into the target type
text/plain
chevron-right
500
Internal Server Error
application/json
post
/info
TypeScript
Test it
200
User's staking summary.
chevron-down
[PreviousdelegatorRewardschevron-left](https://nktkas.gitbook.io/hyperliquid/api-reference/info-methods/delegatorrewards)
[NextexchangeStatuschevron-right](https://nktkas.gitbook.io/hyperliquid/api-reference/info-methods/exchangestatus)
Last updated 9 days ago
sun-brightdesktopmoon
Copy
import * as hl from "@nktkas/hyperliquid";
const transport = new hl.HttpTransport(); // or `WebSocketTransport`
const client = new hl.InfoClient({ transport });
const data = await client.delegatorSummary({ user: "0x..." });
Copy
{
"delegated": "text",
"undelegated": "text",
"totalPendingWithdrawal": "text",
"nPendingWithdrawals": 1
}
sun-brightdesktopmoon
---
# extraAgents | Hyperliquid
post
https://api.hyperliquid.xyzMainnetchevron-down
https://api.hyperliquid.xyzhttps://api.hyperliquid-testnet.xyz
/infocopy
Request user extra agents.
Body
application/jsonchevron-down
application/json
Request user extra agents.
typeundefined · enumRequired
Type of request.
Possible values: `extraAgents`
userstring · min: 42 · max: 42Required
User address.
Pattern: `^0[xX][0-9a-fA-F]+$`
Responses
chevron-right
200
Array of extra agent details for a user.
application/json
Array of extra agent details for a user.
addressstringRequired
Extra agent address.
Pattern: `^0x[a-fA-F0-9]{40}$`
namestringRequired
Extra agent name.
validUntilnumberRequired
Validity period as a timestamp (in ms since epoch).
chevron-right
422
Failed to deserialize the JSON body into the target type
text/plain
chevron-right
500
Internal Server Error
application/json
post
/info
TypeScript
Test it
200
Array of extra agent details for a user.
chevron-down
[PreviousexchangeStatuschevron-left](https://nktkas.gitbook.io/hyperliquid/api-reference/info-methods/exchangestatus)
[NextfrontendOpenOrderschevron-right](https://nktkas.gitbook.io/hyperliquid/api-reference/info-methods/frontendopenorders)
Last updated 9 days ago
sun-brightdesktopmoon
Copy
import * as hl from "@nktkas/hyperliquid";
const transport = new hl.HttpTransport(); // or `WebSocketTransport`
const client = new hl.InfoClient({ transport });
const data = await client.extraAgents({ user: "0x..." });
Copy
[\
{\
"address": "text",\
"name": "text",\
"validUntil": 1\
}\
]
sun-brightdesktopmoon
---
# fundingHistory | Hyperliquid
post
https://api.hyperliquid.xyzMainnetchevron-down
https://api.hyperliquid.xyzhttps://api.hyperliquid-testnet.xyz
/infocopy
Request funding history.
Body
application/jsonchevron-down
application/json
Request funding history.
typeundefined · enumRequired
Type of request.
Possible values: `fundingHistory`
coinstringRequired
Asset symbol (e.g., BTC).
startTimenumberRequired
Start time (in ms since epoch).
endTimeany ofOptional
End time (in ms since epoch).
number · nullableOptional
End time (in ms since epoch).
Responses
chevron-right
200
Array of historical funding rate records for an asset.
application/json
Array of historical funding rate records for an asset.
coinstringRequired
Asset symbol.
fundingRatestringRequired
Funding rate.
Pattern: `^-?[0-9]+(\.[0-9]+)?$`
premiumstringRequired
Premium price.
Pattern: `^-?[0-9]+(\.[0-9]+)?$`
timenumberRequired
Funding record timestamp (ms since epoch).
chevron-right
422
Failed to deserialize the JSON body into the target type
text/plain
chevron-right
500
Internal Server Error
application/json
post
/info
TypeScript
Test it
200
Array of historical funding rate records for an asset.
chevron-down
[PreviousfrontendOpenOrderschevron-left](https://nktkas.gitbook.io/hyperliquid/api-reference/info-methods/frontendopenorders)
[NextgossipRootIpschevron-right](https://nktkas.gitbook.io/hyperliquid/api-reference/info-methods/gossiprootips)
Last updated 9 days ago
sun-brightdesktopmoon
Copy
import * as hl from "@nktkas/hyperliquid";
const transport = new hl.HttpTransport(); // or `WebSocketTransport`
const client = new hl.InfoClient({ transport });
const data = await client.fundingHistory({
coin: "ETH",
startTime: Date.now() - 1000 * 60 * 60 * 24,
});
Copy
[\
{\
"coin": "text",\
"fundingRate": "text",\
"premium": "text",\
"time": 1\
}\
]
sun-brightdesktopmoon
---
# gossipRootIps | Hyperliquid
post
https://api.hyperliquid.xyzMainnetchevron-down
https://api.hyperliquid.xyzhttps://api.hyperliquid-testnet.xyz
/infocopy
Request gossip root IPs.
Body
application/jsonchevron-down
application/json
Request gossip root IPs.
typeundefined · enumRequired
Type of request.
Possible values: `gossipRootIps`
Responses
chevron-right
200
Array of gossip root IPs.
application/json
string\[\]Optional
Array of gossip root IPs.
chevron-right
422
Failed to deserialize the JSON body into the target type
text/plain
chevron-right
500
Internal Server Error
application/json
post
/info
TypeScript
Test it
200
Array of gossip root IPs.
chevron-down
[PreviousfundingHistorychevron-left](https://nktkas.gitbook.io/hyperliquid/api-reference/info-methods/fundinghistory)
[NexthistoricalOrderschevron-right](https://nktkas.gitbook.io/hyperliquid/api-reference/info-methods/historicalorders)
Last updated 9 days ago
sun-brightdesktopmoon
Copy
import * as hl from "@nktkas/hyperliquid";
const transport = new hl.HttpTransport(); // or `WebSocketTransport`
const client = new hl.InfoClient({ transport });
const data = await client.gossipRootIps();
Copy
[\
"text"\
]
sun-brightdesktopmoon
---
# clearinghouseState | Hyperliquid
post
https://api.hyperliquid.xyzMainnetchevron-down
https://api.hyperliquid.xyzhttps://api.hyperliquid-testnet.xyz
/infocopy
Request clearinghouse state.
Body
application/jsonchevron-down
application/json
Request clearinghouse state.
typeundefined · enumRequired
Type of request.
Possible values: `clearinghouseState`
userstring · min: 42 · max: 42Required
User address.
Pattern: `^0[xX][0-9a-fA-F]+$`
dexstringOptional
DEX name (empty string for main dex).
Responses
chevron-right
200
Account summary for perpetual trading.
application/json
Account summary for perpetual trading.
marginSummaryobjectRequired
Margin summary details.
Show propertiesplus
crossMarginSummaryobjectRequired
Cross-margin summary details.
Show propertiesplus
crossMaintenanceMarginUsedstringRequired
Maintenance margin used for cross-margin positions.
Pattern: `^[0-9]+(\.[0-9]+)?$`
withdrawablestringRequired
Amount available for withdrawal.
Pattern: `^[0-9]+(\.[0-9]+)?$`
assetPositionsobject\[\]Required
Array of asset positions.
Show propertiesplus
timenumberRequired
Timestamp when data was retrieved (in ms since epoch).
chevron-right
422
Failed to deserialize the JSON body into the target type
text/plain
chevron-right
500
Internal Server Error
application/json
post
/info
TypeScript
Test it
200
Account summary for perpetual trading.
chevron-down
[PreviouscandleSnapshotchevron-left](https://nktkas.gitbook.io/hyperliquid/api-reference/info-methods/candlesnapshot)
[Nextdelegationschevron-right](https://nktkas.gitbook.io/hyperliquid/api-reference/info-methods/delegations)
Last updated 9 days ago
sun-brightdesktopmoon
Copy
import * as hl from "@nktkas/hyperliquid";
const transport = new hl.HttpTransport(); // or `WebSocketTransport`
const client = new hl.InfoClient({ transport });
const data = await client.clearinghouseState({ user: "0x..." });
Copy
{
"marginSummary": {
"accountValue": "text",
"totalNtlPos": "text",
"totalRawUsd": "text",
"totalMarginUsed": "text"
},
"crossMarginSummary": {
"accountValue": "text",
"totalNtlPos": "text",
"totalRawUsd": "text",
"totalMarginUsed": "text"
},
"crossMaintenanceMarginUsed": "text",
"withdrawable": "text",
"assetPositions": [\
{\
"type": "oneWay",\
"position": {\
"coin": "text",\
"szi": "text",\
"leverage": {\
"type": "isolated",\
"value": 1,\
"rawUsd": "text"\
},\
"entryPx": "text",\
"positionValue": "text",\
"unrealizedPnl": "text",\
"returnOnEquity": "text",\
"liquidationPx": "text",\
"marginUsed": "text",\
"maxLeverage": 1,\
"cumFunding": {\
"allTime": "text",\
"sinceOpen": "text",\
"sinceChange": "text"\
}\
}\
}\
],
"time": 1
}
sun-brightdesktopmoon
---
# legalCheck | Hyperliquid
post
https://api.hyperliquid.xyzMainnetchevron-down
https://api.hyperliquid.xyzhttps://api.hyperliquid-testnet.xyz
/infocopy
Request legal verification status of a user.
Body
application/jsonchevron-down
application/json
Request legal verification status of a user.
typeundefined · enumRequired
Type of request.
Possible values: `legalCheck`
userstring · min: 42 · max: 42Required
User address.
Pattern: `^0[xX][0-9a-fA-F]+$`
Responses
chevron-right
200
Legal verification status for a user.
application/json
Legal verification status for a user.
ipAllowedbooleanRequired
Whether the user IP address is allowed.
acceptedTermsbooleanRequired
Whether the user has accepted the terms of service.
userAllowedbooleanRequired
Whether the user is allowed to use the platform.
chevron-right
422
Failed to deserialize the JSON body into the target type
text/plain
chevron-right
500
Internal Server Error
application/json
post
/info
TypeScript
Test it
200
Legal verification status for a user.
chevron-down
[PreviousleadingVaultschevron-left](https://nktkas.gitbook.io/hyperliquid/api-reference/info-methods/leadingvaults)
[Nextliquidatablechevron-right](https://nktkas.gitbook.io/hyperliquid/api-reference/info-methods/liquidatable)
Last updated 9 days ago
sun-brightdesktopmoon
Copy
import * as hl from "@nktkas/hyperliquid";
const transport = new hl.HttpTransport(); // or `WebSocketTransport`
const client = new hl.InfoClient({ transport });
const data = await client.legalCheck({ user: "0x..." });
Copy
{
"ipAllowed": true,
"acceptedTerms": true,
"userAllowed": true
}
sun-brightdesktopmoon
---
# isVip | Hyperliquid
post
https://api.hyperliquid.xyzMainnetchevron-down
https://api.hyperliquid.xyzhttps://api.hyperliquid-testnet.xyz
/infocopy
Request to check if a user is a VIP.
Body
application/jsonchevron-down
application/json
Request to check if a user is a VIP.
typeundefined · enumRequired
Type of request.
Possible values: `isVip`
userstring · min: 42 · max: 42Required
User address.
Pattern: `^0[xX][0-9a-fA-F]+$`
Responses
chevron-right
200
Boolean indicating user's VIP status.
application/json
boolean · nullableOptional
Boolean indicating user's VIP status.
chevron-right
422
Failed to deserialize the JSON body into the target type
text/plain
chevron-right
500
Internal Server Error
application/json
post
/info
TypeScript
Test it
200
Boolean indicating user's VIP status.
chevron-down
[PrevioushistoricalOrderschevron-left](https://nktkas.gitbook.io/hyperliquid/api-reference/info-methods/historicalorders)
[Nextl2Bookchevron-right](https://nktkas.gitbook.io/hyperliquid/api-reference/info-methods/l2book)
Last updated 9 days ago
sun-brightdesktopmoon
Copy
import * as hl from "@nktkas/hyperliquid";
const transport = new hl.HttpTransport(); // or `WebSocketTransport`
const client = new hl.InfoClient({ transport });
const data = await client.isVip({ user: "0x..." });
Copy
true
sun-brightdesktopmoon
---
# marginTable | Hyperliquid
post
https://api.hyperliquid.xyzMainnetchevron-down
https://api.hyperliquid.xyzhttps://api.hyperliquid-testnet.xyz
/infocopy
Request margin table data.
Body
application/jsonchevron-down
application/json
Request margin table data.
typeundefined · enumRequired
Type of request.
Possible values: `marginTable`
idnumberRequired
Margin requirements table.
Responses
chevron-right
200
Margin requirements table with multiple tiers.
application/json
Margin requirements table with multiple tiers.
descriptionstringRequired
Description of the margin table.
marginTiersobject\[\]Required
Array of margin tiers defining leverage limits.
Show propertiesplus
chevron-right
422
Failed to deserialize the JSON body into the target type
text/plain
chevron-right
500
Internal Server Error
application/json
post
/info
TypeScript
Test it
200
Margin requirements table with multiple tiers.
chevron-down
[Previousliquidatablechevron-left](https://nktkas.gitbook.io/hyperliquid/api-reference/info-methods/liquidatable)
[NextmaxBuilderFeechevron-right](https://nktkas.gitbook.io/hyperliquid/api-reference/info-methods/maxbuilderfee)
Last updated 9 days ago
sun-brightdesktopmoon
Copy
import * as hl from "@nktkas/hyperliquid";
const transport = new hl.HttpTransport(); // or `WebSocketTransport`
const client = new hl.InfoClient({ transport });
const data = await client.marginTable({ id: 1 });
Copy
{
"description": "text",
"marginTiers": [\
{\
"lowerBound": "text",\
"maxLeverage": 1\
}\
]
}
sun-brightdesktopmoon
---
# delegations | Hyperliquid
post
https://api.hyperliquid.xyzMainnetchevron-down
https://api.hyperliquid.xyzhttps://api.hyperliquid-testnet.xyz
/infocopy
Request user staking delegations.
Body
application/jsonchevron-down
application/json
Request user staking delegations.
typeundefined · enumRequired
Type of request.
Possible values: `delegations`
userstring · min: 42 · max: 42Required
User address.
Pattern: `^0[xX][0-9a-fA-F]+$`
Responses
chevron-right
200
Array of user's delegations to validators.
application/json
Array of user's delegations to validators.
validatorstringRequired
Validator address.
Pattern: `^0x[a-fA-F0-9]{40}$`
amountstringRequired
Amount of tokens delegated to the validator.
Pattern: `^[0-9]+(\.[0-9]+)?$`
lockedUntilTimestampnumberRequired
Locked until timestamp (in ms since epoch).
chevron-right
422
Failed to deserialize the JSON body into the target type
text/plain
chevron-right
500
Internal Server Error
application/json
post
/info
TypeScript
Test it
200
Array of user's delegations to validators.
chevron-down
[PreviousclearinghouseStatechevron-left](https://nktkas.gitbook.io/hyperliquid/api-reference/info-methods/clearinghousestate)
[NextdelegatorHistorychevron-right](https://nktkas.gitbook.io/hyperliquid/api-reference/info-methods/delegatorhistory)
Last updated 9 days ago
sun-brightdesktopmoon
Copy
import * as hl from "@nktkas/hyperliquid";
const transport = new hl.HttpTransport(); // or `WebSocketTransport`
const client = new hl.InfoClient({ transport });
const data = await client.delegations({ user: "0x..." });
Copy
[\
{\
"validator": "text",\
"amount": "text",\
"lockedUntilTimestamp": 1\
}\
]
sun-brightdesktopmoon
---
# frontendOpenOrders | Hyperliquid
post
https://api.hyperliquid.xyzMainnetchevron-down
https://api.hyperliquid.xyzhttps://api.hyperliquid-testnet.xyz
/infocopy
Request frontend open orders.
Body
application/jsonchevron-down
application/json
Request frontend open orders.
typeundefined · enumRequired
Type of request.
Possible values: `frontendOpenOrders`
userstring · min: 42 · max: 42Required
User address.
Pattern: `^0[xX][0-9a-fA-F]+$`
dexstringOptional
DEX name (empty string for main dex).
Responses
chevron-right
200
Array of open orders with additional display information.
application/json
FrontendOpenOrderSchema\[\]Optional
Array of open orders with additional display information.
chevron-right
422
Failed to deserialize the JSON body into the target type
text/plain
chevron-right
500
Internal Server Error
application/json
post
/info
TypeScript
Test it
200
Array of open orders with additional display information.
chevron-down
[PreviousextraAgentschevron-left](https://nktkas.gitbook.io/hyperliquid/api-reference/info-methods/extraagents)
[NextfundingHistorychevron-right](https://nktkas.gitbook.io/hyperliquid/api-reference/info-methods/fundinghistory)
Last updated 9 days ago
sun-brightdesktopmoon
Copy
import * as hl from "@nktkas/hyperliquid";
const transport = new hl.HttpTransport(); // or `WebSocketTransport`
const client = new hl.InfoClient({ transport });
const data = await client.frontendOpenOrders({ user: "0x..." });
Copy
[]
sun-brightdesktopmoon
---
# historicalOrders | Hyperliquid
post
https://api.hyperliquid.xyzMainnetchevron-down
https://api.hyperliquid.xyzhttps://api.hyperliquid-testnet.xyz
/infocopy
Request user historical orders.
Body
application/jsonchevron-down
application/json
Request user historical orders.
typeundefined · enumRequired
Type of request.
Possible values: `historicalOrders`
userstring · min: 42 · max: 42Required
User address.
Pattern: `^0[xX][0-9a-fA-F]+$`
Responses
chevron-right
200
Array of frontend orders with current processing status.
application/json
Array of frontend orders with current processing status.
statusTimestampnumberRequired
Timestamp when the status was last updated (in ms since epoch).
chevron-right
422
Failed to deserialize the JSON body into the target type
text/plain
chevron-right
500
Internal Server Error
application/json
post
/info
TypeScript
Test it
200
Array of frontend orders with current processing status.
chevron-down
[PreviousgossipRootIpschevron-left](https://nktkas.gitbook.io/hyperliquid/api-reference/info-methods/gossiprootips)
[NextisVipchevron-right](https://nktkas.gitbook.io/hyperliquid/api-reference/info-methods/isvip)
Last updated 9 days ago
sun-brightdesktopmoon
Copy
import * as hl from "@nktkas/hyperliquid";
const transport = new hl.HttpTransport(); // or `WebSocketTransport`
const client = new hl.InfoClient({ transport });
const data = await client.historicalOrders({ user: "0x..." });
Copy
[\
{\
"order": null,\
"status": null,\
"statusTimestamp": 1\
}\
]
sun-brightdesktopmoon
---
# leadingVaults | Hyperliquid
post
https://api.hyperliquid.xyzMainnetchevron-down
https://api.hyperliquid.xyzhttps://api.hyperliquid-testnet.xyz
/infocopy
Request leading vaults for a user.
Body
application/jsonchevron-down
application/json
Request leading vaults for a user.
typeundefined · enumRequired
Type of request.
Possible values: `leadingVaults`
userstring · min: 42 · max: 42Required
User address.
Pattern: `^0[xX][0-9a-fA-F]+$`
Responses
chevron-right
200
Array of leading vaults for a user.
application/json
Array of leading vaults for a user.
addressstringRequired
Vault address.
Pattern: `^0x[a-fA-F0-9]{40}$`
namestringRequired
Vault name.
chevron-right
422
Failed to deserialize the JSON body into the target type
text/plain
chevron-right
500
Internal Server Error
application/json
post
/info
TypeScript
Test it
200
Array of leading vaults for a user.
chevron-down
[Previousl2Bookchevron-left](https://nktkas.gitbook.io/hyperliquid/api-reference/info-methods/l2book)
[NextlegalCheckchevron-right](https://nktkas.gitbook.io/hyperliquid/api-reference/info-methods/legalcheck)
Last updated 9 days ago
sun-brightdesktopmoon
Copy
import * as hl from "@nktkas/hyperliquid";
const transport = new hl.HttpTransport(); // or `WebSocketTransport`
const client = new hl.InfoClient({ transport });
const data = await client.leadingVaults({ user: "0x..." });
Copy
[\
{\
"address": "text",\
"name": "text"\
}\
]
sun-brightdesktopmoon
---
# liquidatable | Hyperliquid
post
https://api.hyperliquid.xyzMainnetchevron-down
https://api.hyperliquid.xyzhttps://api.hyperliquid-testnet.xyz
/infocopy
Request liquidatable.
Body
application/jsonchevron-down
application/json
Request liquidatable.
typeundefined · enumRequired
Type of request.
Possible values: `liquidatable`
Responses
chevron-right
200
Response for liquidatable request.
application/json
Response for liquidatable request.
itemsanyOptional
chevron-right
422
Failed to deserialize the JSON body into the target type
text/plain
chevron-right
500
Internal Server Error
application/json
post
/info
TypeScript
Test it
200
Response for liquidatable request.
chevron-down
[PreviouslegalCheckchevron-left](https://nktkas.gitbook.io/hyperliquid/api-reference/info-methods/legalcheck)
[NextmarginTablechevron-right](https://nktkas.gitbook.io/hyperliquid/api-reference/info-methods/margintable)
Last updated 9 days ago
sun-brightdesktopmoon
Copy
import * as hl from "@nktkas/hyperliquid";
const transport = new hl.HttpTransport(); // or `WebSocketTransport`
const client = new hl.InfoClient({ transport });
const data = await client.liquidatable();
Copy
[]
sun-brightdesktopmoon
---
# maxBuilderFee | Hyperliquid
post
https://api.hyperliquid.xyzMainnetchevron-down
https://api.hyperliquid.xyzhttps://api.hyperliquid-testnet.xyz
/infocopy
Request builder fee approval.
Body
application/jsonchevron-down
application/json
Request builder fee approval.
typeundefined · enumRequired
Type of request.
Possible values: `maxBuilderFee`
userstring · min: 42 · max: 42Required
User address.
Pattern: `^0[xX][0-9a-fA-F]+$`
builderstring · min: 42 · max: 42Required
Builder address.
Pattern: `^0[xX][0-9a-fA-F]+$`
Responses
chevron-right
200
Maximum builder fee approval.
application/json
numberOptional
Maximum builder fee approval.
chevron-right
422
Failed to deserialize the JSON body into the target type
text/plain
chevron-right
500
Internal Server Error
application/json
post
/info
TypeScript
Test it
200
Maximum builder fee approval.
chevron-down
[PreviousmarginTablechevron-left](https://nktkas.gitbook.io/hyperliquid/api-reference/info-methods/margintable)
[NextmaxMarketOrderNtlschevron-right](https://nktkas.gitbook.io/hyperliquid/api-reference/info-methods/maxmarketorderntls)
Last updated 9 days ago
sun-brightdesktopmoon
Copy
import * as hl from "@nktkas/hyperliquid";
const transport = new hl.HttpTransport(); // or `WebSocketTransport`
const client = new hl.InfoClient({ transport });
const data = await client.maxBuilderFee({ user: "0x...", builder: "0x..." });
Copy
1
sun-brightdesktopmoon
---
# maxMarketOrderNtls | Hyperliquid
post
https://api.hyperliquid.xyzMainnetchevron-down
https://api.hyperliquid.xyzhttps://api.hyperliquid-testnet.xyz
/infocopy
Request maximum market order notionals.
Body
application/jsonchevron-down
application/json
Request maximum market order notionals.
typeundefined · enumRequired
Type of request.
Possible values: `maxMarketOrderNtls`
Responses
chevron-right
200
Array of tuples containing maximum market order notionals and their corresponding asset symbols.
application/json
Array of tuples containing maximum market order notionals and their corresponding asset symbols.
itemsanyOptional
chevron-right
422
Failed to deserialize the JSON body into the target type
text/plain
chevron-right
500
Internal Server Error
application/json
post
/info
TypeScript
Test it
200
Array of tuples containing maximum market order notionals and their corresponding asset symbols.
chevron-down
[PreviousmaxBuilderFeechevron-left](https://nktkas.gitbook.io/hyperliquid/api-reference/info-methods/maxbuilderfee)
[Nextmetachevron-right](https://nktkas.gitbook.io/hyperliquid/api-reference/info-methods/meta)
Last updated 9 days ago
sun-brightdesktopmoon
Copy
import * as hl from "@nktkas/hyperliquid";
const transport = new hl.HttpTransport(); // or `WebSocketTransport`
const client = new hl.InfoClient({ transport });
const data = await client.maxMarketOrderNtls();
Copy
[\
[]\
]
sun-brightdesktopmoon
---
# perpDexStatus | Hyperliquid
post
https://api.hyperliquid.xyzMainnetchevron-down
https://api.hyperliquid.xyzhttps://api.hyperliquid-testnet.xyz
/infocopy
Request perp DEX status.
Body
application/jsonchevron-down
application/json
Request perp DEX status.
typeundefined · enumRequired
Type of request.
Possible values: `perpDexStatus`
dexstringRequired
Perp dex name of builder-deployed dex market. The empty string represents the first perp dex.
Responses
chevron-right
200
Status of a perp DEX.
application/json
Status of a perp DEX.
totalNetDepositstringRequired
Total net deposit.
Pattern: `^[0-9]+(\.[0-9]+)?$`
chevron-right
422
Failed to deserialize the JSON body into the target type
text/plain
chevron-right
500
Internal Server Error
application/json
post
/info
TypeScript
Test it
200
Status of a perp DEX.
chevron-down
[PreviousperpDexLimitschevron-left](https://nktkas.gitbook.io/hyperliquid/api-reference/info-methods/perpdexlimits)
[NextperpDexschevron-right](https://nktkas.gitbook.io/hyperliquid/api-reference/info-methods/perpdexs)
Last updated 9 days ago
sun-brightdesktopmoon
Copy
import * as hl from "@nktkas/hyperliquid";
const transport = new hl.HttpTransport(); // or `WebSocketTransport`
const client = new hl.InfoClient({ transport });
const data = await client.perpDexStatus({ dex: "test" });
Copy
{
"totalNetDeposit": "text"
}
sun-brightdesktopmoon
---
# predictedFundings | Hyperliquid
post
https://api.hyperliquid.xyzMainnetchevron-down
https://api.hyperliquid.xyzhttps://api.hyperliquid-testnet.xyz
/infocopy
Request predicted funding rates.
Body
application/jsonchevron-down
application/json
Request predicted funding rates.
typeundefined · enumRequired
Type of request.
Possible values: `predictedFundings`
Responses
chevron-right
200
Array of tuples of asset symbols and their predicted funding data.
application/json
Array of tuples of asset symbols and their predicted funding data.
itemsanyOptional
chevron-right
422
Failed to deserialize the JSON body into the target type
text/plain
chevron-right
500
Internal Server Error
application/json
post
/info
TypeScript
Test it
200
Array of tuples of asset symbols and their predicted funding data.
chevron-down
[PreviouspreTransferCheckchevron-left](https://nktkas.gitbook.io/hyperliquid/api-reference/info-methods/pretransfercheck)
[NextrecentTradeschevron-right](https://nktkas.gitbook.io/hyperliquid/api-reference/info-methods/recenttrades)
Last updated 9 days ago
sun-brightdesktopmoon
Copy
import * as hl from "@nktkas/hyperliquid";
const transport = new hl.HttpTransport(); // or `WebSocketTransport`
const client = new hl.InfoClient({ transport });
const data = await client.predictedFundings();
Copy
[\
[]\
]
sun-brightdesktopmoon
---
# openOrders | Hyperliquid
post
https://api.hyperliquid.xyzMainnetchevron-down
https://api.hyperliquid.xyzhttps://api.hyperliquid-testnet.xyz
/infocopy
Request open orders.
Body
application/jsonchevron-down
application/json
Request open orders.
typeundefined · enumRequired
Type of request.
Possible values: `openOrders`
userstring · min: 42 · max: 42Required
User address.
Pattern: `^0[xX][0-9a-fA-F]+$`
dexstringOptional
DEX name (empty string for main dex).
Responses
chevron-right
200
Array of open orders.
application/json
OpenOrderSchema\[\]Optional
Array of open orders.
chevron-right
422
Failed to deserialize the JSON body into the target type
text/plain
chevron-right
500
Internal Server Error
application/json
post
/info
TypeScript
Test it
200
Array of open orders.
chevron-down
[PreviousmetaAndAssetCtxschevron-left](https://nktkas.gitbook.io/hyperliquid/api-reference/info-methods/metaandassetctxs)
[NextorderStatuschevron-right](https://nktkas.gitbook.io/hyperliquid/api-reference/info-methods/orderstatus)
Last updated 9 days ago
sun-brightdesktopmoon
Copy
import * as hl from "@nktkas/hyperliquid";
const transport = new hl.HttpTransport(); // or `WebSocketTransport`
const client = new hl.InfoClient({ transport });
const data = await client.openOrders({ user: "0x..." });
Copy
[]
sun-brightdesktopmoon
---
# outcomeMeta | Hyperliquid
post
https://api.hyperliquid.xyzMainnetchevron-down
https://api.hyperliquid.xyzhttps://api.hyperliquid-testnet.xyz
/infocopy
Request prediction market outcome metadata.
Body
application/jsonchevron-down
application/json
Request prediction market outcome metadata.
typeundefined · enumRequired
Type of request.
Possible values: `outcomeMeta`
Responses
chevron-right
200
Prediction market outcome metadata including outcomes and questions.
application/json
Prediction market outcome metadata including outcomes and questions.
outcomesobject\[\]Required
Array of prediction market outcomes.
Show propertiesplus
questionsobject\[\]Required
Array of prediction market questions.
Show propertiesplus
chevron-right
422
Failed to deserialize the JSON body into the target type
text/plain
chevron-right
500
Internal Server Error
application/json
post
/info
TypeScript
Test it
200
Prediction market outcome metadata including outcomes and questions.
chevron-down
[PreviousorderStatuschevron-left](https://nktkas.gitbook.io/hyperliquid/api-reference/info-methods/orderstatus)
[NextperpAnnotationchevron-right](https://nktkas.gitbook.io/hyperliquid/api-reference/info-methods/perpannotation)
Last updated 4 days ago
sun-brightdesktopmoon
Copy
import * as hl from "@nktkas/hyperliquid";
const transport = new hl.HttpTransport(); // or `WebSocketTransport`
const client = new hl.InfoClient({ transport });
const data = await client.outcomeMeta();
Copy
{
"outcomes": [\
{\
"outcome": 1,\
"name": "text",\
"description": "text",\
"sideSpecs": [\
{\
"name": "text",\
"token": 1\
}\
]\
}\
],
"questions": [\
{\
"question": 1,\
"name": "text",\
"description": "text",\
"fallbackOutcome": 1,\
"namedOutcomes": [\
1\
]\
}\
]
}
sun-brightdesktopmoon
---
# perpDeployAuctionStatus | Hyperliquid
post
https://api.hyperliquid.xyzMainnetchevron-down
https://api.hyperliquid.xyzhttps://api.hyperliquid-testnet.xyz
/infocopy
Request for the status of the perpetual deploy auction.
Body
application/jsonchevron-down
application/json
Request for the status of the perpetual deploy auction.
typeundefined · enumRequired
Type of request.
Possible values: `perpDeployAuctionStatus`
Responses
chevron-right
200
Status of the perpetual deploy auction.
application/json
Status of the perpetual deploy auction.
currentGasstring · nullableRequired
Current gas.
Pattern: `^[0-9]+(\.[0-9]+)?$`
durationSecondsnumberRequired
Duration in seconds.
endGasstring · nullableRequired
Ending gas.
Pattern: `^[0-9]+(\.[0-9]+)?$`
startGasstringRequired
Starting gas.
Pattern: `^[0-9]+(\.[0-9]+)?$`
startTimeSecondsnumberRequired
Auction start time (seconds since epoch).
chevron-right
422
Failed to deserialize the JSON body into the target type
text/plain
chevron-right
500
Internal Server Error
application/json
post
/info
TypeScript
Test it
200
Status of the perpetual deploy auction.
chevron-down
[PreviousperpCategorieschevron-left](https://nktkas.gitbook.io/hyperliquid/api-reference/info-methods/perpcategories)
[NextperpDexLimitschevron-right](https://nktkas.gitbook.io/hyperliquid/api-reference/info-methods/perpdexlimits)
Last updated 9 days ago
sun-brightdesktopmoon
Copy
import * as hl from "@nktkas/hyperliquid";
const transport = new hl.HttpTransport(); // or `WebSocketTransport`
const client = new hl.InfoClient({ transport });
const data = await client.perpDeployAuctionStatus();
Copy
{
"currentGas": "text",
"durationSeconds": 1,
"endGas": "text",
"startGas": "text",
"startTimeSeconds": 1
}
sun-brightdesktopmoon
---
# recentTrades | Hyperliquid
post
https://api.hyperliquid.xyzMainnetchevron-down
https://api.hyperliquid.xyzhttps://api.hyperliquid-testnet.xyz
/infocopy
Request recent trades.
Body
application/jsonchevron-down
application/json
Request recent trades.
typeundefined · enumRequired
Type of request.
Possible values: `recentTrades`
coinstringRequired
Asset symbol (e.g., BTC).
Responses
chevron-right
200
Array of recent trades.
application/json
Array of recent trades.
coinstringRequired
Asset symbol (e.g., BTC).
sidestring · enumRequired
Trade side ("B" = Bid/Buy, "A" = Ask/Sell).
Possible values: `B``A`
pxstringRequired
Trade price.
Pattern: `^[0-9]+(\.[0-9]+)?$`
szstringRequired
Trade size.
Pattern: `^[0-9]+(\.[0-9]+)?$`
timenumberRequired
Trade timestamp (in ms since epoch).
hashstringRequired
Transaction hash.
Pattern: `^0x[a-fA-F0-9]{64}$`
tidnumberRequired
Trade ID.
usersany\[\] · min: 2 · max: 2Required
Addresses of users involved in the trade \[Maker, Taker\].
Show propertiesplus
chevron-right
422
Failed to deserialize the JSON body into the target type
text/plain
chevron-right
500
Internal Server Error
application/json
post
/info
TypeScript
Test it
200
Array of recent trades.
chevron-down
[PreviouspredictedFundingschevron-left](https://nktkas.gitbook.io/hyperliquid/api-reference/info-methods/predictedfundings)
[Nextreferralchevron-right](https://nktkas.gitbook.io/hyperliquid/api-reference/info-methods/referral)
Last updated 9 days ago
sun-brightdesktopmoon
Copy
import * as hl from "@nktkas/hyperliquid";
const transport = new hl.HttpTransport(); // or `WebSocketTransport`
const client = new hl.InfoClient({ transport });
const data = await client.recentTrades({ coin: "ETH" });
Copy
[\
{\
"coin": "text",\
"side": "B",\
"px": "text",\
"sz": "text",\
"time": 1,\
"hash": "text",\
"tid": 1,\
"users": []\
}\
]
sun-brightdesktopmoon
---
# perpAnnotation | Hyperliquid
post
https://api.hyperliquid.xyzMainnetchevron-down
https://api.hyperliquid.xyzhttps://api.hyperliquid-testnet.xyz
/infocopy
Request perp annotation.
Body
application/jsonchevron-down
application/json
Request perp annotation.
typeundefined · enumRequired
Type of request.
Possible values: `perpAnnotation`
coinstringRequired
Coin symbol for the perpetual asset.
Responses
chevron-right
200
Perp annotation for an asset.
application/json
Perp annotation for an asset.
object · nullableOptional
Show propertiesplus
chevron-right
422
Failed to deserialize the JSON body into the target type
text/plain
chevron-right
500
Internal Server Error
application/json
post
/info
TypeScript
Test it
200
Perp annotation for an asset.
chevron-down
[PreviousoutcomeMetachevron-left](https://nktkas.gitbook.io/hyperliquid/api-reference/info-methods/outcomemeta)
[NextperpCategorieschevron-right](https://nktkas.gitbook.io/hyperliquid/api-reference/info-methods/perpcategories)
Last updated 3 days ago
sun-brightdesktopmoon
Copy
import * as hl from "@nktkas/hyperliquid";
const transport = new hl.HttpTransport(); // or `WebSocketTransport`
const client = new hl.InfoClient({ transport });
const data = await client.perpAnnotation({ coin: "BTC" });
Copy
{
"category": "text",
"description": "text"
}
sun-brightdesktopmoon
---
# spotClearinghouseState | Hyperliquid
post
https://api.hyperliquid.xyzMainnetchevron-down
https://api.hyperliquid.xyzhttps://api.hyperliquid-testnet.xyz
/infocopy
Request spot clearinghouse state.
Body
application/jsonchevron-down
application/json
Request spot clearinghouse state.
typeundefined · enumRequired
Type of request.
Possible values: `spotClearinghouseState`
userstring · min: 42 · max: 42Required
User address.
Pattern: `^0[xX][0-9a-fA-F]+$`
dexstringOptional
DEX name (empty string for main dex).
Responses
chevron-right
200
Account summary for spot trading.
application/json
Account summary for spot trading.
balancesobject\[\]Required
Array of available token balances.
Show propertiesplus
evmEscrowsobject\[\]Optional
Array of escrowed balances.
Show propertiesplus
chevron-right
422
Failed to deserialize the JSON body into the target type
text/plain
chevron-right
500
Internal Server Error
application/json
post
/info
TypeScript
Test it
200
Account summary for spot trading.
chevron-down
[Previousreferralchevron-left](https://nktkas.gitbook.io/hyperliquid/api-reference/info-methods/referral)
[NextspotDeployStatechevron-right](https://nktkas.gitbook.io/hyperliquid/api-reference/info-methods/spotdeploystate)
Last updated 9 days ago
sun-brightdesktopmoon
Copy
import * as hl from "@nktkas/hyperliquid";
const transport = new hl.HttpTransport(); // or `WebSocketTransport`
const client = new hl.InfoClient({ transport });
const data = await client.spotClearinghouseState({ user: "0x..." });
Copy
{
"balances": [\
{\
"coin": "text",\
"token": 1,\
"total": "text",\
"hold": "text",\
"entryNtl": "text"\
}\
],
"evmEscrows": [\
{\
"coin": "text",\
"token": 1,\
"total": "text"\
}\
]
}
sun-brightdesktopmoon
---
# portfolio | Hyperliquid
post
https://api.hyperliquid.xyzMainnetchevron-down
https://api.hyperliquid.xyzhttps://api.hyperliquid-testnet.xyz
/infocopy
Request user portfolio.
Body
application/jsonchevron-down
application/json
Request user portfolio.
typeundefined · enumRequired
Type of request.
Possible values: `portfolio`
userstring · min: 42 · max: 42Required
User address.
Pattern: `^0[xX][0-9a-fA-F]+$`
Responses
chevron-right
200
Portfolio metrics grouped by time periods.
application/json
Portfolio metrics grouped by time periods.
itemsanyOptional
chevron-right
422
Failed to deserialize the JSON body into the target type
text/plain
chevron-right
500
Internal Server Error
application/json
post
/info
TypeScript
Test it
200
Portfolio metrics grouped by time periods.
chevron-down
[PreviousperpsAtOpenInterestCapchevron-left](https://nktkas.gitbook.io/hyperliquid/api-reference/info-methods/perpsatopeninterestcap)
[NextpreTransferCheckchevron-right](https://nktkas.gitbook.io/hyperliquid/api-reference/info-methods/pretransfercheck)
Last updated 9 days ago
sun-brightdesktopmoon
Copy
import * as hl from "@nktkas/hyperliquid";
const transport = new hl.HttpTransport(); // or `WebSocketTransport`
const client = new hl.InfoClient({ transport });
const data = await client.portfolio({ user: "0x..." });
Copy
[]
sun-brightdesktopmoon
---
# metaAndAssetCtxs | Hyperliquid
post
https://api.hyperliquid.xyzMainnetchevron-down
https://api.hyperliquid.xyzhttps://api.hyperliquid-testnet.xyz
/infocopy
Request metadata and asset contexts.
Body
application/jsonchevron-down
application/json
Request metadata and asset contexts.
typeundefined · enumRequired
Type of request.
Possible values: `metaAndAssetCtxs`
dexstringOptional
DEX name (empty string for main dex).
Responses
chevron-right
200
Tuple containing metadata and array of asset contexts.
application/json
Tuple containing metadata and array of asset contexts.
itemsanyOptional
chevron-right
422
Failed to deserialize the JSON body into the target type
text/plain
chevron-right
500
Internal Server Error
application/json
post
/info
TypeScript
Test it
200
Tuple containing metadata and array of asset contexts.
chevron-down
[Previousmetachevron-left](https://nktkas.gitbook.io/hyperliquid/api-reference/info-methods/meta)
[NextopenOrderschevron-right](https://nktkas.gitbook.io/hyperliquid/api-reference/info-methods/openorders)
Last updated 9 days ago
sun-brightdesktopmoon
Copy
import * as hl from "@nktkas/hyperliquid";
const transport = new hl.HttpTransport(); // or `WebSocketTransport`
const client = new hl.InfoClient({ transport });
const data = await client.metaAndAssetCtxs();
Copy
[]
sun-brightdesktopmoon
---
# perpDexLimits | Hyperliquid
post
https://api.hyperliquid.xyzMainnetchevron-down
https://api.hyperliquid.xyzhttps://api.hyperliquid-testnet.xyz
/infocopy
Request builder deployed perpetual market limits.
Body
application/jsonchevron-down
application/json
Request builder deployed perpetual market limits.
typeundefined · enumRequired
Type of request.
Possible values: `perpDexLimits`
dexstringRequired
DEX name (empty string for main dex).
Responses
chevron-right
200
Builder deployed perpetual market limits.
application/json
Builder deployed perpetual market limits.
object · nullableOptional
Show propertiesplus
chevron-right
422
Failed to deserialize the JSON body into the target type
text/plain
chevron-right
500
Internal Server Error
application/json
post
/info
TypeScript
Test it
200
Builder deployed perpetual market limits.
chevron-down
[PreviousperpDeployAuctionStatuschevron-left](https://nktkas.gitbook.io/hyperliquid/api-reference/info-methods/perpdeployauctionstatus)
[NextperpDexStatuschevron-right](https://nktkas.gitbook.io/hyperliquid/api-reference/info-methods/perpdexstatus)
Last updated 9 days ago
sun-brightdesktopmoon
Copy
import * as hl from "@nktkas/hyperliquid";
const transport = new hl.HttpTransport(); // or `WebSocketTransport`
const client = new hl.InfoClient({ transport });
const data = await client.perpDexLimits({ dex: "test" });
Copy
{
"totalOiCap": "text",
"oiSzCapPerPerp": "text",
"maxTransferNtl": "text",
"coinToOiCap": [\
[]\
]
}
sun-brightdesktopmoon
---
# l2Book | Hyperliquid
post
https://api.hyperliquid.xyzMainnetchevron-down
https://api.hyperliquid.xyzhttps://api.hyperliquid-testnet.xyz
/infocopy
Request L2 order book.
Body
application/jsonchevron-down
application/json
Request L2 order book.
typeundefined · enumRequired
Type of request.
Possible values: `l2Book`
coinstringRequired
Asset symbol (e.g., BTC).
nSigFigsany ofOptional
Number of significant figures.
undefined · enum · nullableOptional
Number of significant figures.
Possible values: `2``3``4``5`
mantissaany ofOptional
Mantissa for aggregation (if `nSigFigs` is 5).
undefined · enum · nullableOptional
Mantissa for aggregation (if `nSigFigs` is 5).
Possible values: `2``5`
Responses
chevron-right
200
L2 order book snapshot or `null` if the market does not exist.
application/json
L2 order book snapshot or `null` if the market does not exist.
object · nullableOptional
Show propertiesplus
chevron-right
422
Failed to deserialize the JSON body into the target type
text/plain
chevron-right
500
Internal Server Error
application/json
post
/info
TypeScript
Test it
200
L2 order book snapshot or `null` if the market does not exist.
chevron-down
[PreviousisVipchevron-left](https://nktkas.gitbook.io/hyperliquid/api-reference/info-methods/isvip)
[NextleadingVaultschevron-right](https://nktkas.gitbook.io/hyperliquid/api-reference/info-methods/leadingvaults)
Last updated 9 days ago
sun-brightdesktopmoon
Copy
import * as hl from "@nktkas/hyperliquid";
const transport = new hl.HttpTransport(); // or `WebSocketTransport`
const client = new hl.InfoClient({ transport });
const data = await client.l2Book({ coin: "ETH", nSigFigs: 2 });
Copy
{
"coin": "text",
"time": 1,
"levels": [],
"spread": "text"
}
sun-brightdesktopmoon
---
# perpsAtOpenInterestCap | Hyperliquid
post
https://api.hyperliquid.xyzMainnetchevron-down
https://api.hyperliquid.xyzhttps://api.hyperliquid-testnet.xyz
/infocopy
Request perpetuals at open interest cap.
Body
application/jsonchevron-down
application/json
Request perpetuals at open interest cap.
typeundefined · enumRequired
Type of request.
Possible values: `perpsAtOpenInterestCap`
dexstringOptional
DEX name (empty string for main dex).
Responses
chevron-right
200
Array of perpetuals at open interest caps.
application/json
string\[\]Optional
Array of perpetuals at open interest caps.
chevron-right
422
Failed to deserialize the JSON body into the target type
text/plain
chevron-right
500
Internal Server Error
application/json
post
/info
TypeScript
Test it
200
Array of perpetuals at open interest caps.
chevron-down
[PreviousperpDexschevron-left](https://nktkas.gitbook.io/hyperliquid/api-reference/info-methods/perpdexs)
[Nextportfoliochevron-right](https://nktkas.gitbook.io/hyperliquid/api-reference/info-methods/portfolio)
Last updated 9 days ago
sun-brightdesktopmoon
Copy
import * as hl from "@nktkas/hyperliquid";
const transport = new hl.HttpTransport(); // or `WebSocketTransport`
const client = new hl.InfoClient({ transport });
const data = await client.perpsAtOpenInterestCap();
Copy
[\
"text"\
]
sun-brightdesktopmoon
---
# perpCategories | Hyperliquid
post
https://api.hyperliquid.xyzMainnetchevron-down
https://api.hyperliquid.xyzhttps://api.hyperliquid-testnet.xyz
/infocopy
Request all perpetual asset categories.
Body
application/jsonchevron-down
application/json
Request all perpetual asset categories.
typeundefined · enumRequired
Type of request.
Possible values: `perpCategories`
Responses
chevron-right
200
Array of tuples mapping coin names to their categories.
application/json
Array of tuples mapping coin names to their categories.
itemsanyOptional
chevron-right
422
Failed to deserialize the JSON body into the target type
text/plain
chevron-right
500
Internal Server Error
application/json
post
/info
TypeScript
Test it
200
Array of tuples mapping coin names to their categories.
chevron-down
[PreviousperpAnnotationchevron-left](https://nktkas.gitbook.io/hyperliquid/api-reference/info-methods/perpannotation)
[NextperpDeployAuctionStatuschevron-right](https://nktkas.gitbook.io/hyperliquid/api-reference/info-methods/perpdeployauctionstatus)
Last updated 4 days ago
sun-brightdesktopmoon
Copy
import * as hl from "@nktkas/hyperliquid";
const transport = new hl.HttpTransport(); // or `WebSocketTransport`
const client = new hl.InfoClient({ transport });
const data = await client.perpCategories();
Copy
[\
[]\
]
sun-brightdesktopmoon
---
# spotDeployState | Hyperliquid
post
https://api.hyperliquid.xyzMainnetchevron-down
https://api.hyperliquid.xyzhttps://api.hyperliquid-testnet.xyz
/infocopy
Request spot deploy state.
Body
application/jsonchevron-down
application/json
Request spot deploy state.
typeundefined · enumRequired
Type of request.
Possible values: `spotDeployState`
userstring · min: 42 · max: 42Required
User address.
Pattern: `^0[xX][0-9a-fA-F]+$`
Responses
chevron-right
200
Deploy state for spot tokens.
application/json
Deploy state for spot tokens.
statesobject\[\]Required
Array of deploy states for tokens.
Show propertiesplus
chevron-right
422
Failed to deserialize the JSON body into the target type
text/plain
chevron-right
500
Internal Server Error
application/json
post
/info
TypeScript
Test it
200
Deploy state for spot tokens.
chevron-down
[PreviousspotClearinghouseStatechevron-left](https://nktkas.gitbook.io/hyperliquid/api-reference/info-methods/spotclearinghousestate)
[NextspotMetachevron-right](https://nktkas.gitbook.io/hyperliquid/api-reference/info-methods/spotmeta)
Last updated 9 days ago
sun-brightdesktopmoon
Copy
import * as hl from "@nktkas/hyperliquid";
const transport = new hl.HttpTransport(); // or `WebSocketTransport`
const client = new hl.InfoClient({ transport });
const data = await client.spotDeployState({ user: "0x..." });
Copy
{
"states": [\
{\
"token": 1,\
"spec": {\
"name": "text",\
"szDecimals": 1,\
"weiDecimals": 1\
},\
"fullName": "text",\
"deployerTradingFeeShare": "text",\
"spots": [\
1\
],\
"maxSupply": "text",\
"hyperliquidityGenesisBalance": "text",\
"totalGenesisBalanceWei": "text",\
"userGenesisBalances": [\
[]\
],\
"existingTokenGenesisBalances": [\
[]\
],\
"blacklistUsers": [\
"text"\
]\
}\
],
"gasAuction": null
}
sun-brightdesktopmoon
---
# meta | Hyperliquid
post
https://api.hyperliquid.xyzMainnetchevron-down
https://api.hyperliquid.xyzhttps://api.hyperliquid-testnet.xyz
/infocopy
Request trading metadata.
Body
application/jsonchevron-down
application/json
Request trading metadata.
typeundefined · enumRequired
Type of request.
Possible values: `meta`
dexstringOptional
DEX name (empty string for main dex).
Responses
chevron-right
200
Metadata for perpetual assets.
application/json
Metadata for perpetual assets.
universeobject\[\]Required
Trading universes available for perpetual trading.
Show propertiesplus
marginTablesany\[\]\[\]Required
Margin requirement tables for different leverage tiers.
Show propertiesplus
collateralTokennumberRequired
Collateral token index.
chevron-right
422
Failed to deserialize the JSON body into the target type
text/plain
chevron-right
500
Internal Server Error
application/json
post
/info
TypeScript
Test it
200
Metadata for perpetual assets.
chevron-down
[PreviousmaxMarketOrderNtlschevron-left](https://nktkas.gitbook.io/hyperliquid/api-reference/info-methods/maxmarketorderntls)
[NextmetaAndAssetCtxschevron-right](https://nktkas.gitbook.io/hyperliquid/api-reference/info-methods/metaandassetctxs)
Last updated 9 days ago
sun-brightdesktopmoon
Copy
import * as hl from "@nktkas/hyperliquid";
const transport = new hl.HttpTransport(); // or `WebSocketTransport`
const client = new hl.InfoClient({ transport });
const data = await client.meta();
Copy
{
"universe": [\
{\
"szDecimals": 1,\
"name": "text",\
"maxLeverage": 1,\
"marginTableId": 1,\
"onlyIsolated": true,\
"isDelisted": true,\
"marginMode": "strictIsolated",\
"growthMode": "enabled",\
"lastGrowthModeChangeTime": "text"\
}\
],
"marginTables": [\
[]\
],
"collateralToken": 1
}
sun-brightdesktopmoon
---
# preTransferCheck | Hyperliquid
post
https://api.hyperliquid.xyzMainnetchevron-down
https://api.hyperliquid.xyzhttps://api.hyperliquid-testnet.xyz
/infocopy
Request user existence check before transfer.
Body
application/jsonchevron-down
application/json
Request user existence check before transfer.
typeundefined · enumRequired
Type of request.
Possible values: `preTransferCheck`
userstring · min: 42 · max: 42Required
User address.
Pattern: `^0[xX][0-9a-fA-F]+$`
sourcestring · min: 42 · max: 42Required
Source address.
Pattern: `^0[xX][0-9a-fA-F]+$`
Responses
chevron-right
200
Pre-transfer user existence check result.
application/json
Pre-transfer user existence check result.
feestringRequired
Activation fee.
Pattern: `^[0-9]+(\.[0-9]+)?$`
isSanctionedbooleanRequired
Whether the user is sanctioned.
userExistsbooleanRequired
Whether the user exists.
userHasSentTxbooleanRequired
Whether the user has sent a transaction.
chevron-right
422
Failed to deserialize the JSON body into the target type
text/plain
chevron-right
500
Internal Server Error
application/json
post
/info
TypeScript
Test it
200
Pre-transfer user existence check result.
chevron-down
[Previousportfoliochevron-left](https://nktkas.gitbook.io/hyperliquid/api-reference/info-methods/portfolio)
[NextpredictedFundingschevron-right](https://nktkas.gitbook.io/hyperliquid/api-reference/info-methods/predictedfundings)
Last updated 9 days ago
sun-brightdesktopmoon
Copy
import * as hl from "@nktkas/hyperliquid";
const transport = new hl.HttpTransport(); // or `WebSocketTransport`
const client = new hl.InfoClient({ transport });
const data = await client.preTransferCheck({ user: "0x...", source: "0x..." });
Copy
{
"fee": "text",
"isSanctioned": true,
"userExists": true,
"userHasSentTx": true
}
sun-brightdesktopmoon
---
# referral | Hyperliquid
post
https://api.hyperliquid.xyzMainnetchevron-down
https://api.hyperliquid.xyzhttps://api.hyperliquid-testnet.xyz
/infocopy
Request user referral.
Body
application/jsonchevron-down
application/json
Request user referral.
typeundefined · enumRequired
Type of request.
Possible values: `referral`
userstring · min: 42 · max: 42Required
User address.
Pattern: `^0[xX][0-9a-fA-F]+$`
Responses
chevron-right
200
Referral details for a user.
application/json
Referral details for a user.
referredByany ofRequired
Referrer details.
object · nullableOptional
Show propertiesplus
cumVlmstringRequired
Cumulative traded volume.
Pattern: `^[0-9]+(\.[0-9]+)?$`
unclaimedRewardsstringRequired
Rewards earned but not yet claimed.
Pattern: `^[0-9]+(\.[0-9]+)?$`
claimedRewardsstringRequired
Rewards that have been claimed.
Pattern: `^[0-9]+(\.[0-9]+)?$`
builderRewardsstringRequired
Builder reward amount.
Pattern: `^[0-9]+(\.[0-9]+)?$`
referrerStateany ofRequired
Current state of the referrer.
objectOptional
Show propertiesplus
or
objectOptional
Show propertiesplus
or
objectOptional
Show propertiesplus
rewardHistoryobject\[\]Required
History of referral rewards.
Show propertiesplus
tokenToStateany\[\]\[\]Required
Mapping of token IDs to referral reward states.
Show propertiesplus
chevron-right
422
Failed to deserialize the JSON body into the target type
text/plain
chevron-right
500
Internal Server Error
application/json
post
/info
TypeScript
Test it
200
Referral details for a user.
chevron-down
[PreviousrecentTradeschevron-left](https://nktkas.gitbook.io/hyperliquid/api-reference/info-methods/recenttrades)
[NextspotClearinghouseStatechevron-right](https://nktkas.gitbook.io/hyperliquid/api-reference/info-methods/spotclearinghousestate)
Last updated 9 days ago
sun-brightdesktopmoon
Copy
import * as hl from "@nktkas/hyperliquid";
const transport = new hl.HttpTransport(); // or `WebSocketTransport`
const client = new hl.InfoClient({ transport });
const data = await client.referral({ user: "0x..." });
Copy
{
"referredBy": {
"referrer": "text",
"code": "text"
},
"cumVlm": "text",
"unclaimedRewards": "text",
"claimedRewards": "text",
"builderRewards": "text",
"referrerState": {
"stage": "ready",
"data": {
"code": "text",
"nReferrals": 1,
"referralStates": [\
{\
"cumVlm": "text",\
"cumRewardedFeesSinceReferred": "text",\
"cumFeesRewardedToReferrer": "text",\
"timeJoined": 1,\
"user": "text",\
"tokenToState": [\
[]\
]\
}\
]
}
},
"rewardHistory": [\
{\
"earned": "text",\
"vlm": "text",\
"referralVlm": "text",\
"time": 1\
}\
],
"tokenToState": [\
[]\
]
}
sun-brightdesktopmoon
---
# perpDexs | Hyperliquid
post
https://api.hyperliquid.xyzMainnetchevron-down
https://api.hyperliquid.xyzhttps://api.hyperliquid-testnet.xyz
/infocopy
Request all perpetual dexs.
Body
application/jsonchevron-down
application/json
Request all perpetual dexs.
typeundefined · enumRequired
Type of request.
Possible values: `perpDexs`
Responses
chevron-right
200
Array of perpetual dexes (null is main dex).
application/json
Array of perpetual dexes (null is main dex).
object · nullableOptional
Show propertiesplus
chevron-right
422
Failed to deserialize the JSON body into the target type
text/plain
chevron-right
500
Internal Server Error
application/json
post
/info
TypeScript
Test it
200
Array of perpetual dexes (null is main dex).
chevron-down
[PreviousperpDexStatuschevron-left](https://nktkas.gitbook.io/hyperliquid/api-reference/info-methods/perpdexstatus)
[NextperpsAtOpenInterestCapchevron-right](https://nktkas.gitbook.io/hyperliquid/api-reference/info-methods/perpsatopeninterestcap)
Last updated 9 days ago
sun-brightdesktopmoon
Copy
import * as hl from "@nktkas/hyperliquid";
const transport = new hl.HttpTransport(); // or `WebSocketTransport`
const client = new hl.InfoClient({ transport });
const data = await client.perpDexs();
Copy
[\
{\
"name": "text",\
"fullName": "text",\
"deployer": "text",\
"oracleUpdater": "text",\
"feeRecipient": "text",\
"assetToStreamingOiCap": [\
[]\
],\
"subDeployers": [\
[]\
],\
"deployerFeeScale": "text",\
"lastDeployerFeeScaleChangeTime": "text",\
"assetToFundingMultiplier": [\
[]\
],\
"assetToFundingInterestRate": [\
[]\
]\
}\
]
sun-brightdesktopmoon
---
# orderStatus | Hyperliquid
post
https://api.hyperliquid.xyzMainnetchevron-down
https://api.hyperliquid.xyzhttps://api.hyperliquid-testnet.xyz
/infocopy
Request order status.
Body
application/jsonchevron-down
application/json
Request order status.
typeundefined · enumRequired
Type of request.
Possible values: `orderStatus`
userstring · min: 42 · max: 42Required
User address.
Pattern: `^0[xX][0-9a-fA-F]+$`
oidany ofRequired
Order ID or Client Order ID.
numberOptional
Order ID or Client Order ID.
or
string · min: 34 · max: 34Optional
Order ID or Client Order ID.
Pattern: `^0[xX][0-9a-fA-F]+$`
Responses
chevron-right
200
Order status response.
* If the order is found, returns detailed order information and its current status.
* If the order is not found, returns a status of "unknownOid".
application/json
Order status response.
* If the order is found, returns detailed order information and its current status.
* If the order is not found, returns a status of "unknownOid".
objectOptional
Show propertiesplus
or
objectOptional
Show propertiesplus
chevron-right
422
Failed to deserialize the JSON body into the target type
text/plain
chevron-right
500
Internal Server Error
application/json
post
/info
TypeScript
Test it
200
Order status response.
* If the order is found, returns detailed order information and its current status.
* If the order is not found, returns a status of "unknownOid".
chevron-down
[PreviousopenOrderschevron-left](https://nktkas.gitbook.io/hyperliquid/api-reference/info-methods/openorders)
[NextoutcomeMetachevron-right](https://nktkas.gitbook.io/hyperliquid/api-reference/info-methods/outcomemeta)
Last updated 9 days ago
sun-brightdesktopmoon
Copy
import * as hl from "@nktkas/hyperliquid";
const transport = new hl.HttpTransport(); // or `WebSocketTransport`
const client = new hl.InfoClient({ transport });
const data = await client.orderStatus({ user: "0x...", oid: 12345 });
Copy
{
"status": "order",
"order": {
"order": null,
"status": null,
"statusTimestamp": 1
}
}
sun-brightdesktopmoon
---
# spotMeta | Hyperliquid
post
https://api.hyperliquid.xyzMainnetchevron-down
https://api.hyperliquid.xyzhttps://api.hyperliquid-testnet.xyz
/infocopy
Request spot trading metadata.
Body
application/jsonchevron-down
application/json
Request spot trading metadata.
typeundefined · enumRequired
Type of request.
Possible values: `spotMeta`
Responses
chevron-right
200
Metadata for spot assets.
application/json
Metadata for spot assets.
universeobject\[\]Required
Trading universes available for spot trading.
Show propertiesplus
tokensobject\[\]Required
Tokens available for spot trading.
Show propertiesplus
chevron-right
422
Failed to deserialize the JSON body into the target type
text/plain
chevron-right
500
Internal Server Error
application/json
post
/info
TypeScript
Test it
200
Metadata for spot assets.
chevron-down
[PreviousspotDeployStatechevron-left](https://nktkas.gitbook.io/hyperliquid/api-reference/info-methods/spotdeploystate)
[NextspotMetaAndAssetCtxschevron-right](https://nktkas.gitbook.io/hyperliquid/api-reference/info-methods/spotmetaandassetctxs)
Last updated 4 days ago
sun-brightdesktopmoon
Copy
import * as hl from "@nktkas/hyperliquid";
const transport = new hl.HttpTransport(); // or `WebSocketTransport`
const client = new hl.InfoClient({ transport });
const data = await client.spotMeta();
Copy
{
"universe": [\
{\
"tokens": [\
1\
],\
"name": "text",\
"index": 1,\
"isCanonical": true\
}\
],
"tokens": [\
{\
"name": "text",\
"szDecimals": 1,\
"weiDecimals": 1,\
"index": 1,\
"tokenId": "text",\
"isCanonical": true,\
"evmContract": {\
"address": "text",\
"evm_extra_wei_decimals": 1\
},\
"fullName": "text",\
"deployerTradingFeeShare": "text"\
}\
]
}
sun-brightdesktopmoon
---
# spotMetaAndAssetCtxs | Hyperliquid
post
https://api.hyperliquid.xyzMainnetchevron-down
https://api.hyperliquid.xyzhttps://api.hyperliquid-testnet.xyz
/infocopy
Request spot metadata and asset contexts.
Body
application/jsonchevron-down
application/json
Request spot metadata and asset contexts.
typeundefined · enumRequired
Type of request.
Possible values: `spotMetaAndAssetCtxs`
Responses
chevron-right
200
Tuple of spot metadata and asset contexts.
application/json
Tuple of spot metadata and asset contexts.
itemsanyOptional
chevron-right
422
Failed to deserialize the JSON body into the target type
text/plain
chevron-right
500
Internal Server Error
application/json
post
/info
TypeScript
Test it
200
Tuple of spot metadata and asset contexts.
chevron-down
[PreviousspotMetachevron-left](https://nktkas.gitbook.io/hyperliquid/api-reference/info-methods/spotmeta)
[NextspotPairDeployAuctionStatuschevron-right](https://nktkas.gitbook.io/hyperliquid/api-reference/info-methods/spotpairdeployauctionstatus)
Last updated 4 days ago
sun-brightdesktopmoon
Copy
import * as hl from "@nktkas/hyperliquid";
const transport = new hl.HttpTransport(); // or `WebSocketTransport`
const client = new hl.InfoClient({ transport });
const data = await client.spotMetaAndAssetCtxs();
Copy
[]
sun-brightdesktopmoon
---
# spotPairDeployAuctionStatus | Hyperliquid
post
https://api.hyperliquid.xyzMainnetchevron-down
https://api.hyperliquid.xyzhttps://api.hyperliquid-testnet.xyz
/infocopy
Request for the status of the spot deploy auction.
Body
application/jsonchevron-down
application/json
Request for the status of the spot deploy auction.
typeundefined · enumRequired
Type of request.
Possible values: `spotPairDeployAuctionStatus`
Responses
chevron-right
200
Status of the spot deploy auction.
application/json
anyOptional
Status of the spot deploy auction.
chevron-right
422
Failed to deserialize the JSON body into the target type
text/plain
chevron-right
500
Internal Server Error
application/json
post
/info
TypeScript
Test it
200
Status of the spot deploy auction.
chevron-down
No content
[PreviousspotMetaAndAssetCtxschevron-left](https://nktkas.gitbook.io/hyperliquid/api-reference/info-methods/spotmetaandassetctxs)
[NextsubAccountschevron-right](https://nktkas.gitbook.io/hyperliquid/api-reference/info-methods/subaccounts)
Last updated 9 days ago
sun-brightdesktopmoon
Copy
import * as hl from "@nktkas/hyperliquid";
const transport = new hl.HttpTransport(); // or `WebSocketTransport`
const client = new hl.InfoClient({ transport });
const data = await client.spotPairDeployAuctionStatus();
sun-brightdesktopmoon
---
# validatorL1Votes | Hyperliquid
post
https://api.hyperliquid.xyzMainnetchevron-down
https://api.hyperliquid.xyzhttps://api.hyperliquid-testnet.xyz
/infocopy
Request validator L1 votes.
Body
application/jsonchevron-down
application/json
Request validator L1 votes.
typeundefined · enumRequired
Type of request.
Possible values: `validatorL1Votes`
Responses
chevron-right
200
Array of L1 governance votes cast by validators.
application/json
Array of L1 governance votes cast by validators.
expireTimenumberRequired
Timestamp when the vote expires (in ms since epoch).
actionany ofRequired
Type of the vote.
objectOptional
Show propertiesplus
or
objectOptional
Show propertiesplus
votesstring\[\]Required
List of validator addresses that cast this vote.
Pattern: `^0x[a-fA-F0-9]{40}$`
chevron-right
422
Failed to deserialize the JSON body into the target type
text/plain
chevron-right
500
Internal Server Error
application/json
post
/info
TypeScript
Test it
200
Array of L1 governance votes cast by validators.
chevron-down
[PrevioususerVaultEquitieschevron-left](https://nktkas.gitbook.io/hyperliquid/api-reference/info-methods/uservaultequities)
[NextvalidatorSummarieschevron-right](https://nktkas.gitbook.io/hyperliquid/api-reference/info-methods/validatorsummaries)
Last updated 9 days ago
sun-brightdesktopmoon
Copy
import * as hl from "@nktkas/hyperliquid";
const transport = new hl.HttpTransport(); // or `WebSocketTransport`
const client = new hl.InfoClient({ transport });
const data = await client.validatorL1Votes();
Copy
[\
{\
"expireTime": 1,\
"action": {\
"D": "text"\
},\
"votes": [\
"text"\
]\
}\
]
sun-brightdesktopmoon
---
# userBorrowLendInterest | Hyperliquid
post
https://api.hyperliquid.xyzMainnetchevron-down
https://api.hyperliquid.xyzhttps://api.hyperliquid-testnet.xyz
/infocopy
Request user borrow/lend interest.
Body
application/jsonchevron-down
application/json
Request user borrow/lend interest.
typeundefined · enumRequired
Type of request.
Possible values: `userBorrowLendInterest`
userstring · min: 42 · max: 42Required
User address.
Pattern: `^0[xX][0-9a-fA-F]+$`
startTimenumberRequired
Start time (in ms since epoch).
endTimeany ofOptional
End time (in ms since epoch).
number · nullableOptional
End time (in ms since epoch).
Responses
chevron-right
200
User's borrow/lend interest.
application/json
User's borrow/lend interest.
timenumberRequired
Timestamp of the update (in ms since epoch).
tokenstringRequired
Token symbol.
borrowstringRequired
Borrow interest amount.
Pattern: `^[0-9]+(\.[0-9]+)?$`
supplystringRequired
Supply interest amount.
Pattern: `^[0-9]+(\.[0-9]+)?$`
chevron-right
422
Failed to deserialize the JSON body into the target type
text/plain
chevron-right
500
Internal Server Error
application/json
post
/info
TypeScript
Test it
200
User's borrow/lend interest.
chevron-down
[PrevioususerAbstractionchevron-left](https://nktkas.gitbook.io/hyperliquid/api-reference/info-methods/userabstraction)
[NextuserDetailschevron-right](https://nktkas.gitbook.io/hyperliquid/api-reference/info-methods/userdetails)
Last updated 9 days ago
sun-brightdesktopmoon
Copy
import * as hl from "@nktkas/hyperliquid";
const transport = new hl.HttpTransport(); // or `WebSocketTransport`
const client = new hl.InfoClient({ transport });
const data = await client.userBorrowLendInterest({
user: "0x...",
startTime: Date.now() - 1000 * 60 * 60 * 24,
});
Copy
[\
{\
"time": 1,\
"token": "text",\
"borrow": "text",\
"supply": "text"\
}\
]
sun-brightdesktopmoon
---
# tokenDetails | Hyperliquid
post
https://api.hyperliquid.xyzMainnetchevron-down
https://api.hyperliquid.xyzhttps://api.hyperliquid-testnet.xyz
/infocopy
Request token details.
Body
application/jsonchevron-down
application/json
Request token details.
typeundefined · enumRequired
Type of request.
Possible values: `tokenDetails`
tokenIdstring · min: 34 · max: 34Required
Token ID.
Pattern: `^0[xX][0-9a-fA-F]+$`
Responses
chevron-right
200
Details of a token.
application/json
Details of a token.
namestringRequired
Name of the token.
maxSupplystringRequired
Maximum supply of the token.
Pattern: `^[0-9]+(\.[0-9]+)?$`
totalSupplystringRequired
Total supply of the token.
Pattern: `^[0-9]+(\.[0-9]+)?$`
circulatingSupplystringRequired
Circulating supply of the token.
Pattern: `^[0-9]+(\.[0-9]+)?$`
szDecimalsnumberRequired
Decimal places for the minimum tradable unit.
weiDecimalsnumberRequired
Decimal places for the token's smallest unit.
midPxstringRequired
Mid price of the token.
Pattern: `^[0-9]+(\.[0-9]+)?$`
markPxstringRequired
Mark price of the token.
Pattern: `^[0-9]+(\.[0-9]+)?$`
prevDayPxstringRequired
Previous day's price of the token.
Pattern: `^[0-9]+(\.[0-9]+)?$`
genesisany ofRequired
Genesis data for the token.
object · nullableOptional
Show propertiesplus
deployerstring · nullableRequired
Deployer address.
Pattern: `^0x[a-fA-F0-9]{40}$`
deployGasstring · nullableRequired
Gas used during token deployment.
Pattern: `^[0-9]+(\.[0-9]+)?$`
deployTimestring · nullableRequired
Timestamp of token deployment.
Pattern: `^\d{4}-\d{2}-\d{2}T\d{2}:\d{2}:\d{2}\.\d{3}$`
seededUsdcstringRequired
Seeded USDC amount for the token.
Pattern: `^[0-9]+(\.[0-9]+)?$`
nonCirculatingUserBalancesany\[\]\[\]Required
Non-circulating user balances of the token.
Show propertiesplus
futureEmissionsstringRequired
Future emissions amount.
Pattern: `^[0-9]+(\.[0-9]+)?$`
chevron-right
422
Failed to deserialize the JSON body into the target type
text/plain
chevron-right
500
Internal Server Error
application/json
post
/info
TypeScript
Test it
200
Details of a token.
chevron-down
[PrevioussubAccounts2chevron-left](https://nktkas.gitbook.io/hyperliquid/api-reference/info-methods/subaccounts2)
[NexttwapHistorychevron-right](https://nktkas.gitbook.io/hyperliquid/api-reference/info-methods/twaphistory)
Last updated 9 days ago
sun-brightdesktopmoon
Copy
import * as hl from "@nktkas/hyperliquid";
const transport = new hl.HttpTransport(); // or `WebSocketTransport`
const client = new hl.InfoClient({ transport });
const data = await client.tokenDetails({ tokenId: "0x..." });
Copy
{
"name": "text",
"maxSupply": "text",
"totalSupply": "text",
"circulatingSupply": "text",
"szDecimals": 1,
"weiDecimals": 1,
"midPx": "text",
"markPx": "text",
"prevDayPx": "text",
"genesis": {
"userBalances": [\
[]\
],
"existingTokenBalances": [\
[]\
],
"blacklistUsers": [\
"text"\
]
},
"deployer": "text",
"deployGas": "text",
"deployTime": "text",
"seededUsdc": "text",
"nonCirculatingUserBalances": [\
[]\
],
"futureEmissions": "text"
}
sun-brightdesktopmoon
---
# subAccounts | Hyperliquid
post
https://api.hyperliquid.xyzMainnetchevron-down
https://api.hyperliquid.xyzhttps://api.hyperliquid-testnet.xyz
/infocopy
Request user sub-accounts.
Body
application/jsonchevron-down
application/json
Request user sub-accounts.
typeundefined · enumRequired
Type of request.
Possible values: `subAccounts`
userstring · min: 42 · max: 42Required
User address.
Pattern: `^0[xX][0-9a-fA-F]+$`
Responses
chevron-right
200
Array of user sub-account or null if the user does not have any sub-accounts.
application/json
Array of user sub-account or null if the user does not have any sub-accounts.
object\[\] · nullableOptional
Show propertiesplus
chevron-right
422
Failed to deserialize the JSON body into the target type
text/plain
chevron-right
500
Internal Server Error
application/json
post
/info
TypeScript
Test it
200
Array of user sub-account or null if the user does not have any sub-accounts.
chevron-down
[PreviousspotPairDeployAuctionStatuschevron-left](https://nktkas.gitbook.io/hyperliquid/api-reference/info-methods/spotpairdeployauctionstatus)
[NextsubAccounts2chevron-right](https://nktkas.gitbook.io/hyperliquid/api-reference/info-methods/subaccounts2)
Last updated 9 days ago
sun-brightdesktopmoon
Copy
import * as hl from "@nktkas/hyperliquid";
const transport = new hl.HttpTransport(); // or `WebSocketTransport`
const client = new hl.InfoClient({ transport });
const data = await client.subAccounts({ user: "0x..." });
Copy
[\
{\
"name": "text",\
"subAccountUser": "text",\
"master": "text",\
"clearinghouseState": null,\
"spotState": null\
}\
]
sun-brightdesktopmoon
---
# subAccounts2 | Hyperliquid
post
https://api.hyperliquid.xyzMainnetchevron-down
https://api.hyperliquid.xyzhttps://api.hyperliquid-testnet.xyz
/infocopy
Request user sub-accounts (V2).
Body
application/jsonchevron-down
application/json
Request user sub-accounts (V2).
typeundefined · enumRequired
Type of request.
Possible values: `subAccounts2`
userstring · min: 42 · max: 42Required
User address.
Pattern: `^0[xX][0-9a-fA-F]+$`
Responses
chevron-right
200
Array of user sub-account or null if the user does not have any sub-accounts.
application/json
Array of user sub-account or null if the user does not have any sub-accounts.
object\[\] · nullableOptional
Show propertiesplus
chevron-right
422
Failed to deserialize the JSON body into the target type
text/plain
chevron-right
500
Internal Server Error
application/json
post
/info
TypeScript
Test it
200
Array of user sub-account or null if the user does not have any sub-accounts.
chevron-down
[PrevioussubAccountschevron-left](https://nktkas.gitbook.io/hyperliquid/api-reference/info-methods/subaccounts)
[NexttokenDetailschevron-right](https://nktkas.gitbook.io/hyperliquid/api-reference/info-methods/tokendetails)
Last updated 9 days ago
sun-brightdesktopmoon
Copy
import * as hl from "@nktkas/hyperliquid";
const transport = new hl.HttpTransport(); // or `WebSocketTransport`
const client = new hl.InfoClient({ transport });
const data = await client.subAccounts2({ user: "0x..." });
Copy
[\
{\
"name": "text",\
"subAccountUser": "text",\
"master": "text",\
"dexToClearinghouseState": [\
[]\
],\
"spotState": null\
}\
]
sun-brightdesktopmoon
---
# userDexAbstraction | Hyperliquid
post
https://api.hyperliquid.xyzMainnetchevron-down
https://api.hyperliquid.xyzhttps://api.hyperliquid-testnet.xyz
/infocopy
Request user HIP-3 DEX abstraction state.
Body
application/jsonchevron-down
application/json
Request user HIP-3 DEX abstraction state.
typeundefined · enumRequired
Type of request.
Possible values: `userDexAbstraction`
userstring · min: 42 · max: 42Required
User address.
Pattern: `^0[xX][0-9a-fA-F]+$`
Responses
chevron-right
200
User HIP-3 DEX abstraction state.
application/json
boolean · nullableOptional
User HIP-3 DEX abstraction state.
chevron-right
422
Failed to deserialize the JSON body into the target type
text/plain
chevron-right
500
Internal Server Error
application/json
post
/info
TypeScript
Test it
200
User HIP-3 DEX abstraction state.
chevron-down
[PrevioususerDetailschevron-left](https://nktkas.gitbook.io/hyperliquid/api-reference/info-methods/userdetails)
[NextuserFeeschevron-right](https://nktkas.gitbook.io/hyperliquid/api-reference/info-methods/userfees)
Last updated 9 days ago
sun-brightdesktopmoon
Copy
import * as hl from "@nktkas/hyperliquid";
const transport = new hl.HttpTransport(); // or `WebSocketTransport`
const client = new hl.InfoClient({ transport });
const data = await client.userDexAbstraction({ user: "0x..." });
Copy
true
sun-brightdesktopmoon
---
# txDetails | Hyperliquid
post
https://api.hyperliquid.xyzMainnetchevron-down
https://api.hyperliquid.xyzhttps://api.hyperliquid-testnet.xyz
/infocopy
Request transaction details by transaction hash.
Body
application/jsonchevron-down
application/json
Request transaction details by transaction hash.
typeundefined · enumRequired
Type of request.
Possible values: `txDetails`
hashstring · min: 66 · max: 66Required
Transaction hash.
Pattern: `^0[xX][0-9a-fA-F]+$`
Responses
chevron-right
200
Response with transaction details.
application/json
Response with transaction details.
typestring · enumRequired
Response type.
Possible values: `txDetails`
chevron-right
422
Failed to deserialize the JSON body into the target type
text/plain
chevron-right
500
Internal Server Error
application/json
post
/info
TypeScript
Test it
200
Response with transaction details.
chevron-down
[PrevioustwapHistorychevron-left](https://nktkas.gitbook.io/hyperliquid/api-reference/info-methods/twaphistory)
[NextuserAbstractionchevron-right](https://nktkas.gitbook.io/hyperliquid/api-reference/info-methods/userabstraction)
Last updated 9 days ago
sun-brightdesktopmoon
Copy
import * as hl from "@nktkas/hyperliquid";
const transport = new hl.HttpTransport(); // or `WebSocketTransport`
const client = new hl.InfoClient({ transport });
const data = await client.txDetails({ hash: "0x..." });
Copy
{
"type": "txDetails",
"tx": null
}
sun-brightdesktopmoon
---
# userVaultEquities | Hyperliquid
post
https://api.hyperliquid.xyzMainnetchevron-down
https://api.hyperliquid.xyzhttps://api.hyperliquid-testnet.xyz
/infocopy
Request user vault deposits.
Body
application/jsonchevron-down
application/json
Request user vault deposits.
typeundefined · enumRequired
Type of request.
Possible values: `userVaultEquities`
userstring · min: 42 · max: 42Required
User address.
Pattern: `^0[xX][0-9a-fA-F]+$`
Responses
chevron-right
200
Array of user's vault deposits.
application/json
Array of user's vault deposits.
vaultAddressstringRequired
Vault address.
Pattern: `^0x[a-fA-F0-9]{40}$`
equitystringRequired
User deposited equity.
Pattern: `^[0-9]+(\.[0-9]+)?$`
lockedUntilTimestampnumberRequired
Timestamp when the user can withdraw their equity.
chevron-right
422
Failed to deserialize the JSON body into the target type
text/plain
chevron-right
500
Internal Server Error
application/json
post
/info
TypeScript
Test it
200
Array of user's vault deposits.
chevron-down
[PrevioususerTwapSliceFillsByTimechevron-left](https://nktkas.gitbook.io/hyperliquid/api-reference/info-methods/usertwapslicefillsbytime)
[NextvalidatorL1Voteschevron-right](https://nktkas.gitbook.io/hyperliquid/api-reference/info-methods/validatorl1votes)
Last updated 9 days ago
sun-brightdesktopmoon
Copy
import * as hl from "@nktkas/hyperliquid";
const transport = new hl.HttpTransport(); // or `WebSocketTransport`
const client = new hl.InfoClient({ transport });
const data = await client.userVaultEquities({ user: "0x..." });
Copy
[\
{\
"vaultAddress": "text",\
"equity": "text",\
"lockedUntilTimestamp": 1\
}\
]
sun-brightdesktopmoon
---
# userFillsByTime | Hyperliquid
post
https://api.hyperliquid.xyzMainnetchevron-down
https://api.hyperliquid.xyzhttps://api.hyperliquid-testnet.xyz
/infocopy
Request array of user fills by time.
Body
application/jsonchevron-down
application/json
Request array of user fills by time.
typeundefined · enumRequired
Type of request.
Possible values: `userFillsByTime`
userstring · min: 42 · max: 42Required
User address.
Pattern: `^0[xX][0-9a-fA-F]+$`
startTimenumberRequired
Start time (in ms since epoch).
endTimeany ofOptional
End time (in ms since epoch).
number · nullableOptional
End time (in ms since epoch).
aggregateByTimebooleanOptional
If true, partial fills are aggregated when a crossing order fills multiple resting orders.
reversedbooleanOptional
If true, fills are returned in reverse chronological order (newest first).
Responses
chevron-right
200
Array of user trade fills by time.
application/json
anyOptional
Array of user trade fills by time.
chevron-right
422
Failed to deserialize the JSON body into the target type
text/plain
chevron-right
500
Internal Server Error
application/json
post
/info
TypeScript
Test it
200
Array of user trade fills by time.
chevron-down
No content
[PrevioususerFillschevron-left](https://nktkas.gitbook.io/hyperliquid/api-reference/info-methods/userfills)
[NextuserFundingchevron-right](https://nktkas.gitbook.io/hyperliquid/api-reference/info-methods/userfunding)
Last updated 4 days ago
sun-brightdesktopmoon
Copy
import * as hl from "@nktkas/hyperliquid";
const transport = new hl.HttpTransport(); // or `WebSocketTransport`
const client = new hl.InfoClient({ transport });
const data = await client.userFillsByTime({
user: "0x...",
startTime: Date.now() - 1000 * 60 * 60 * 24,
});
sun-brightdesktopmoon
---
# userAbstraction | Hyperliquid
post
https://api.hyperliquid.xyzMainnetchevron-down
https://api.hyperliquid.xyzhttps://api.hyperliquid-testnet.xyz
/infocopy
Request user abstraction state.
Body
application/jsonchevron-down
application/json
Request user abstraction state.
typeundefined · enumRequired
Type of request.
Possible values: `userAbstraction`
userstring · min: 42 · max: 42Required
User address.
Pattern: `^0[xX][0-9a-fA-F]+$`
Responses
chevron-right
200
User abstraction state.
application/json
string · enumOptional
User abstraction state.
Possible values: `unifiedAccount``portfolioMargin``disabled``default``dexAbstraction`
chevron-right
422
Failed to deserialize the JSON body into the target type
text/plain
chevron-right
500
Internal Server Error
application/json
post
/info
TypeScript
Test it
200
User abstraction state.
chevron-down
[PrevioustxDetailschevron-left](https://nktkas.gitbook.io/hyperliquid/api-reference/info-methods/txdetails)
[NextuserBorrowLendInterestchevron-right](https://nktkas.gitbook.io/hyperliquid/api-reference/info-methods/userborrowlendinterest)
Last updated 4 days ago
sun-brightdesktopmoon
Copy
import * as hl from "@nktkas/hyperliquid";
const transport = new hl.HttpTransport(); // or `WebSocketTransport`
const client = new hl.InfoClient({ transport });
const data = await client.userAbstraction({ user: "0x..." });
Copy
unifiedAccount
sun-brightdesktopmoon
---
# userRole | Hyperliquid
post
https://api.hyperliquid.xyzMainnetchevron-down
https://api.hyperliquid.xyzhttps://api.hyperliquid-testnet.xyz
/infocopy
Request user role.
Body
application/jsonchevron-down
application/json
Request user role.
typeundefined · enumRequired
Type of request.
Possible values: `userRole`
userstring · min: 42 · max: 42Required
User address.
Pattern: `^0[xX][0-9a-fA-F]+$`
Responses
chevron-right
200
User role.
application/json
User role.
objectOptional
Show propertiesplus
or
objectOptional
Show propertiesplus
or
objectOptional
Show propertiesplus
chevron-right
422
Failed to deserialize the JSON body into the target type
text/plain
chevron-right
500
Internal Server Error
application/json
post
/info
TypeScript
Test it
200
User role.
chevron-down
[PrevioususerRateLimitchevron-left](https://nktkas.gitbook.io/hyperliquid/api-reference/info-methods/userratelimit)
[NextuserToMultiSigSignerschevron-right](https://nktkas.gitbook.io/hyperliquid/api-reference/info-methods/usertomultisigsigners)
Last updated 9 days ago
sun-brightdesktopmoon
Copy
import * as hl from "@nktkas/hyperliquid";
const transport = new hl.HttpTransport(); // or `WebSocketTransport`
const client = new hl.InfoClient({ transport });
const data = await client.userRole({ user: "0x..." });
Copy
{
"role": "missing"
}
sun-brightdesktopmoon
---
# userRateLimit | Hyperliquid
post
https://api.hyperliquid.xyzMainnetchevron-down
https://api.hyperliquid.xyzhttps://api.hyperliquid-testnet.xyz
/infocopy
Request user rate limits.
Body
application/jsonchevron-down
application/json
Request user rate limits.
typeundefined · enumRequired
Type of request.
Possible values: `userRateLimit`
userstring · min: 42 · max: 42Required
User address.
Pattern: `^0[xX][0-9a-fA-F]+$`
Responses
chevron-right
200
User rate limits.
application/json
User rate limits.
cumVlmstringRequired
Cumulative trading volume.
Pattern: `^[0-9]+(\.[0-9]+)?$`
nRequestsUsednumberRequired
Number of API requests used.
nRequestsCapnumberRequired
Maximum allowed API requests.
nRequestsSurplusnumberRequired
Number of surplus API requests.
chevron-right
422
Failed to deserialize the JSON body into the target type
text/plain
chevron-right
500
Internal Server Error
application/json
post
/info
TypeScript
Test it
200
User rate limits.
chevron-down
[PrevioususerNonFundingLedgerUpdateschevron-left](https://nktkas.gitbook.io/hyperliquid/api-reference/info-methods/usernonfundingledgerupdates)
[NextuserRolechevron-right](https://nktkas.gitbook.io/hyperliquid/api-reference/info-methods/userrole)
Last updated 9 days ago
sun-brightdesktopmoon
Copy
import * as hl from "@nktkas/hyperliquid";
const transport = new hl.HttpTransport(); // or `WebSocketTransport`
const client = new hl.InfoClient({ transport });
const data = await client.userRateLimit({ user: "0x..." });
Copy
{
"cumVlm": "text",
"nRequestsUsed": 1,
"nRequestsCap": 1,
"nRequestsSurplus": 1
}
sun-brightdesktopmoon
---
# userDetails | Hyperliquid
post
https://api.hyperliquid.xyzMainnetchevron-down
https://api.hyperliquid.xyzhttps://api.hyperliquid-testnet.xyz
/infocopy
Request array of user transaction details.
Body
application/jsonchevron-down
application/json
Request array of user transaction details.
typeundefined · enumRequired
Type of request.
Possible values: `userDetails`
userstring · min: 42 · max: 42Required
User address.
Pattern: `^0[xX][0-9a-fA-F]+$`
Responses
chevron-right
200
Response array of user transaction details.
application/json
Response array of user transaction details.
typestring · enumRequired
Type of response.
Possible values: `userDetails`
txsExplorerTransactionSchema\[\]Required
Array of user transaction details.
chevron-right
422
Failed to deserialize the JSON body into the target type
text/plain
chevron-right
500
Internal Server Error
application/json
post
/info
TypeScript
Test it
200
Response array of user transaction details.
chevron-down
[PrevioususerBorrowLendInterestchevron-left](https://nktkas.gitbook.io/hyperliquid/api-reference/info-methods/userborrowlendinterest)
[NextuserDexAbstractionchevron-right](https://nktkas.gitbook.io/hyperliquid/api-reference/info-methods/userdexabstraction)
Last updated 9 days ago
sun-brightdesktopmoon
Copy
import * as hl from "@nktkas/hyperliquid";
const transport = new hl.HttpTransport(); // or `WebSocketTransport`
const client = new hl.InfoClient({ transport });
const data = await client.userDetails({ user: "0x..." });
Copy
{
"type": "userDetails",
"txs": []
}
sun-brightdesktopmoon
---
# userTwapSliceFills | Hyperliquid
post
https://api.hyperliquid.xyzMainnetchevron-down
https://api.hyperliquid.xyzhttps://api.hyperliquid-testnet.xyz
/infocopy
Request user TWAP slice fills.
Body
application/jsonchevron-down
application/json
Request user TWAP slice fills.
typeundefined · enumRequired
Type of request.
Possible values: `userTwapSliceFills`
userstring · min: 42 · max: 42Required
User address.
Pattern: `^0[xX][0-9a-fA-F]+$`
Responses
chevron-right
200
Array of user's TWAP slice fills.
application/json
Array of user's TWAP slice fills.
twapIdnumberRequired
ID of the TWAP.
chevron-right
422
Failed to deserialize the JSON body into the target type
text/plain
chevron-right
500
Internal Server Error
application/json
post
/info
TypeScript
Test it
200
Array of user's TWAP slice fills.
chevron-down
[PrevioususerToMultiSigSignerschevron-left](https://nktkas.gitbook.io/hyperliquid/api-reference/info-methods/usertomultisigsigners)
[NextuserTwapSliceFillsByTimechevron-right](https://nktkas.gitbook.io/hyperliquid/api-reference/info-methods/usertwapslicefillsbytime)
Last updated 5 days ago
sun-brightdesktopmoon
Copy
import * as hl from "@nktkas/hyperliquid";
const transport = new hl.HttpTransport(); // or `WebSocketTransport`
const client = new hl.InfoClient({ transport });
const data = await client.userTwapSliceFills({ user: "0x..." });
Copy
[\
{\
"fill": null,\
"twapId": 1\
}\
]
sun-brightdesktopmoon
---
# userToMultiSigSigners | Hyperliquid
post
https://api.hyperliquid.xyzMainnetchevron-down
https://api.hyperliquid.xyzhttps://api.hyperliquid-testnet.xyz
/infocopy
Request multi-sig signers for a user.
Body
application/jsonchevron-down
application/json
Request multi-sig signers for a user.
typeundefined · enumRequired
Type of request.
Possible values: `userToMultiSigSigners`
userstring · min: 42 · max: 42Required
User address.
Pattern: `^0[xX][0-9a-fA-F]+$`
Responses
chevron-right
200
Multi-sig signers for a user or null if the user does not have any multi-sig signers.
application/json
Multi-sig signers for a user or null if the user does not have any multi-sig signers.
object · nullableOptional
Show propertiesplus
chevron-right
422
Failed to deserialize the JSON body into the target type
text/plain
chevron-right
500
Internal Server Error
application/json
post
/info
TypeScript
Test it
200
Multi-sig signers for a user or null if the user does not have any multi-sig signers.
chevron-down
[PrevioususerRolechevron-left](https://nktkas.gitbook.io/hyperliquid/api-reference/info-methods/userrole)
[NextuserTwapSliceFillschevron-right](https://nktkas.gitbook.io/hyperliquid/api-reference/info-methods/usertwapslicefills)
Last updated 9 days ago
sun-brightdesktopmoon
Copy
import * as hl from "@nktkas/hyperliquid";
const transport = new hl.HttpTransport(); // or `WebSocketTransport`
const client = new hl.InfoClient({ transport });
const data = await client.userToMultiSigSigners({ user: "0x..." });
Copy
{
"authorizedUsers": [\
"text"\
],
"threshold": 1
}
sun-brightdesktopmoon
---
# userTwapSliceFillsByTime | Hyperliquid
post
https://api.hyperliquid.xyzMainnetchevron-down
https://api.hyperliquid.xyzhttps://api.hyperliquid-testnet.xyz
/infocopy
Request user TWAP slice fills by time.
Body
application/jsonchevron-down
application/json
Request user TWAP slice fills by time.
typeundefined · enumRequired
Type of request.
Possible values: `userTwapSliceFillsByTime`
userstring · min: 42 · max: 42Required
User address.
Pattern: `^0[xX][0-9a-fA-F]+$`
startTimenumberRequired
Start time (in ms since epoch).
endTimeany ofOptional
End time (in ms since epoch).
number · nullableOptional
End time (in ms since epoch).
aggregateByTimebooleanOptional
If true, partial fills are aggregated when a crossing order fills multiple resting orders.
Responses
chevron-right
200
Array of user's TWAP slice fill by time.
application/json
anyOptional
Array of user's TWAP slice fill by time.
chevron-right
422
Failed to deserialize the JSON body into the target type
text/plain
chevron-right
500
Internal Server Error
application/json
post
/info
TypeScript
Test it
200
Array of user's TWAP slice fill by time.
chevron-down
No content
[PrevioususerTwapSliceFillschevron-left](https://nktkas.gitbook.io/hyperliquid/api-reference/info-methods/usertwapslicefills)
[NextuserVaultEquitieschevron-right](https://nktkas.gitbook.io/hyperliquid/api-reference/info-methods/uservaultequities)
Last updated 5 days ago
sun-brightdesktopmoon
Copy
import * as hl from "@nktkas/hyperliquid";
const transport = new hl.HttpTransport(); // or `WebSocketTransport`
const client = new hl.InfoClient({ transport });
const data = await client.userTwapSliceFillsByTime({
user: "0x...",
startTime: Date.now() - 1000 * 60 * 60 * 24,
});
sun-brightdesktopmoon
---
# userFunding | Hyperliquid
post
https://api.hyperliquid.xyzMainnetchevron-down
https://api.hyperliquid.xyzhttps://api.hyperliquid-testnet.xyz
/infocopy
Request array of user funding ledger updates.
Body
application/jsonchevron-down
application/json
Request array of user funding ledger updates.
typeundefined · enumRequired
Type of request.
Possible values: `userFunding`
userstring · min: 42 · max: 42Required
User address.
Pattern: `^0[xX][0-9a-fA-F]+$`
startTimeany ofOptional
Start time (in ms since epoch).
number · nullableOptional
Start time (in ms since epoch).
endTimeany ofOptional
End time (in ms since epoch).
number · nullableOptional
End time (in ms since epoch).
Responses
chevron-right
200
Array of user funding ledger updates.
application/json
Array of user funding ledger updates.
timenumberRequired
Timestamp of the update (in ms since epoch).
hashstringRequired
L1 transaction hash.
Pattern: `^0x[a-fA-F0-9]{64}$`
deltaobjectRequired
Update details.
Show propertiesplus
chevron-right
422
Failed to deserialize the JSON body into the target type
text/plain
chevron-right
500
Internal Server Error
application/json
post
/info
TypeScript
Test it
200
Array of user funding ledger updates.
chevron-down
[PrevioususerFillsByTimechevron-left](https://nktkas.gitbook.io/hyperliquid/api-reference/info-methods/userfillsbytime)
[NextuserNonFundingLedgerUpdateschevron-right](https://nktkas.gitbook.io/hyperliquid/api-reference/info-methods/usernonfundingledgerupdates)
Last updated 9 days ago
sun-brightdesktopmoon
Copy
import * as hl from "@nktkas/hyperliquid";
const transport = new hl.HttpTransport(); // or `WebSocketTransport`
const client = new hl.InfoClient({ transport });
const data = await client.userFunding({ user: "0x..." });
Copy
[\
{\
"time": 1,\
"hash": "text",\
"delta": {\
"type": "funding",\
"coin": "text",\
"usdc": "text",\
"szi": "text",\
"fundingRate": "text",\
"nSamples": 1\
}\
}\
]
sun-brightdesktopmoon
---
# vaultSummaries | Hyperliquid
post
https://api.hyperliquid.xyzMainnetchevron-down
https://api.hyperliquid.xyzhttps://api.hyperliquid-testnet.xyz
/infocopy
Request a list of vaults less than 2 hours old.
Body
application/jsonchevron-down
application/json
Request a list of vaults less than 2 hours old.
typeundefined · enumRequired
Type of request.
Possible values: `vaultSummaries`
Responses
chevron-right
200
Array of vaults less than 2 hours old.
application/json
Array of vaults less than 2 hours old.
namestringRequired
Vault name.
vaultAddressstringRequired
Vault address.
Pattern: `^0x[a-fA-F0-9]{40}$`
leaderstringRequired
Leader address.
Pattern: `^0x[a-fA-F0-9]{40}$`
tvlstringRequired
Total value locked.
Pattern: `^[0-9]+(\.[0-9]+)?$`
isClosedbooleanRequired
Vault closure status.
createTimeMillisnumberRequired
Creation timestamp.
chevron-right
422
Failed to deserialize the JSON body into the target type
text/plain
chevron-right
500
Internal Server Error
application/json
post
/info
TypeScript
Test it
200
Array of vaults less than 2 hours old.
chevron-down
[PreviousvaultDetailschevron-left](https://nktkas.gitbook.io/hyperliquid/api-reference/info-methods/vaultdetails)
[NextwebData2chevron-right](https://nktkas.gitbook.io/hyperliquid/api-reference/info-methods/webdata2)
Last updated 9 days ago
sun-brightdesktopmoon
Copy
import * as hl from "@nktkas/hyperliquid";
const transport = new hl.HttpTransport(); // or `WebSocketTransport`
const client = new hl.InfoClient({ transport });
const data = await client.vaultSummaries();
Copy
[\
{\
"name": "text",\
"vaultAddress": "text",\
"leader": "text",\
"tvl": "text",\
"isClosed": true,\
"relationship": null,\
"createTimeMillis": 1\
}\
]
sun-brightdesktopmoon
---
# userFills | Hyperliquid
post
https://api.hyperliquid.xyzMainnetchevron-down
https://api.hyperliquid.xyzhttps://api.hyperliquid-testnet.xyz
/infocopy
Request array of user fills.
Body
application/jsonchevron-down
application/json
Request array of user fills.
typeundefined · enumRequired
Type of request.
Possible values: `userFills`
userstring · min: 42 · max: 42Required
User address.
Pattern: `^0[xX][0-9a-fA-F]+$`
aggregateByTimebooleanOptional
If true, partial fills are aggregated when a crossing order fills multiple resting orders.
Responses
chevron-right
200
Array of user trade fills.
application/json
Array of user trade fills.
cloidstringOptional
Client Order ID.
Pattern: `^0x[a-fA-F0-9]{32}$`
liquidationobjectOptional
Liquidation details.
Show propertiesplus
coinstringRequired
Asset symbol.
pxstringRequired
Price.
Pattern: `^[0-9]+(\.[0-9]+)?$`
szstringRequired
Size.
Pattern: `^[0-9]+(\.[0-9]+)?$`
sidestring · enumRequired
Order side ("B" = Bid/Buy, "A" = Ask/Sell).
Possible values: `B``A`
timenumberRequired
Timestamp when the trade occurred (in ms since epoch).
startPositionstringRequired
Start position size.
Pattern: `^-?[0-9]+(\.[0-9]+)?$`
dirstringRequired
Direction indicator for frontend display.
closedPnlstringRequired
Realized PnL.
Pattern: `^-?[0-9]+(\.[0-9]+)?$`
hashstringRequired
L1 transaction hash.
Pattern: `^0x[a-fA-F0-9]{64}$`
oidnumberRequired
Order ID.
crossedbooleanRequired
Indicates if the fill was a taker order.
feestringRequired
Fee charged or rebate received (negative indicates rebate).
Pattern: `^-?[0-9]+(\.[0-9]+)?$`
builderFeestringOptional
Optional fee charged by the UI builder.
Pattern: `^-?[0-9]+(\.[0-9]+)?$`
tidnumberRequired
Unique transaction identifier for a partial fill of an order.
feeTokenstringRequired
Token in which the fee is denominated (e.g., "USDC").
twapIdnumber · nullableRequired
ID of the TWAP.
chevron-right
422
Failed to deserialize the JSON body into the target type
text/plain
chevron-right
500
Internal Server Error
application/json
post
/info
TypeScript
Test it
200
Array of user trade fills.
chevron-down
[PrevioususerFeeschevron-left](https://nktkas.gitbook.io/hyperliquid/api-reference/info-methods/userfees)
[NextuserFillsByTimechevron-right](https://nktkas.gitbook.io/hyperliquid/api-reference/info-methods/userfillsbytime)
Last updated 9 days ago
sun-brightdesktopmoon
Copy
import * as hl from "@nktkas/hyperliquid";
const transport = new hl.HttpTransport(); // or `WebSocketTransport`
const client = new hl.InfoClient({ transport });
const data = await client.userFills({ user: "0x..." });
Copy
[\
{\
"cloid": "text",\
"liquidation": {\
"liquidatedUser": "text",\
"markPx": "text",\
"method": "market"\
},\
"coin": "text",\
"px": "text",\
"sz": "text",\
"side": "B",\
"time": 1,\
"startPosition": "text",\
"dir": "text",\
"closedPnl": "text",\
"hash": "text",\
"oid": 1,\
"crossed": true,\
"fee": "text",\
"builderFee": "text",\
"tid": 1,\
"feeToken": "text",\
"twapId": 1\
}\
]
sun-brightdesktopmoon
---
# userFees | Hyperliquid
post
https://api.hyperliquid.xyzMainnetchevron-down
https://api.hyperliquid.xyzhttps://api.hyperliquid-testnet.xyz
/infocopy
Request user fees.
Body
application/jsonchevron-down
application/json
Request user fees.
typeundefined · enumRequired
Type of request.
Possible values: `userFees`
userstring · min: 42 · max: 42Required
User address.
Pattern: `^0[xX][0-9a-fA-F]+$`
Responses
chevron-right
200
User fees.
application/json
User fees.
dailyUserVlmobject\[\]Required
Daily user volume metrics.
Show propertiesplus
feeScheduleobjectRequired
Fee schedule information.
Show propertiesplus
userCrossRatestringRequired
User cross-trade rate.
Pattern: `^[0-9]+(\.[0-9]+)?$`
userAddRatestringRequired
User add-liquidity rate.
Pattern: `^[0-9]+(\.[0-9]+)?$`
userSpotCrossRatestringRequired
User spot cross-trade rate.
Pattern: `^[0-9]+(\.[0-9]+)?$`
userSpotAddRatestringRequired
User spot add-liquidity rate.
Pattern: `^[0-9]+(\.[0-9]+)?$`
activeReferralDiscountstringRequired
Active referral discount rate.
Pattern: `^[0-9]+(\.[0-9]+)?$`
trialany ofRequired
Trial details.
any · nullableOptional
feeTrialEscrowstringRequired
Fee trial escrow amount.
Pattern: `^[0-9]+(\.[0-9]+)?$`
nextTrialAvailableTimestampany ofRequired
Timestamp when next trial becomes available.
any · nullableOptional
stakingLinkany ofRequired
Permanent link between staking and trading accounts. Staking user gains full control of trading account funds. Staking user forfeits own fee discounts.
object · nullableOptional
Show propertiesplus
activeStakingDiscountobjectRequired
Active staking discount details.
Show propertiesplus
chevron-right
422
Failed to deserialize the JSON body into the target type
text/plain
chevron-right
500
Internal Server Error
application/json
post
/info
TypeScript
Test it
200
User fees.
chevron-down
[PrevioususerDexAbstractionchevron-left](https://nktkas.gitbook.io/hyperliquid/api-reference/info-methods/userdexabstraction)
[NextuserFillschevron-right](https://nktkas.gitbook.io/hyperliquid/api-reference/info-methods/userfills)
Last updated 9 days ago
sun-brightdesktopmoon
Copy
import * as hl from "@nktkas/hyperliquid";
const transport = new hl.HttpTransport(); // or `WebSocketTransport`
const client = new hl.InfoClient({ transport });
const data = await client.userFees({ user: "0x..." });
Copy
{
"dailyUserVlm": [\
{\
"date": "text",\
"userCross": "text",\
"userAdd": "text",\
"exchange": "text"\
}\
],
"feeSchedule": {
"cross": "text",
"add": "text",
"spotCross": "text",
"spotAdd": "text",
"tiers": {
"vip": [\
{\
"ntlCutoff": "text",\
"cross": "text",\
"add": "text",\
"spotCross": "text",\
"spotAdd": "text"\
}\
],
"mm": [\
{\
"makerFractionCutoff": "text",\
"add": "text"\
}\
]
},
"referralDiscount": "text",
"stakingDiscountTiers": [\
{\
"bpsOfMaxSupply": "text",\
"discount": "text"\
}\
]
},
"userCrossRate": "text",
"userAddRate": "text",
"userSpotCrossRate": "text",
"userSpotAddRate": "text",
"activeReferralDiscount": "text",
"trial": null,
"feeTrialEscrow": "text",
"nextTrialAvailableTimestamp": null,
"stakingLink": {
"stakingUser": "text",
"type": "requested"
},
"activeStakingDiscount": {
"bpsOfMaxSupply": "text",
"discount": "text"
}
}
sun-brightdesktopmoon
---
# twapHistory | Hyperliquid
post
https://api.hyperliquid.xyzMainnetchevron-down
https://api.hyperliquid.xyzhttps://api.hyperliquid-testnet.xyz
/infocopy
Request TWAP history of a user.
Body
application/jsonchevron-down
application/json
Request TWAP history of a user.
typeundefined · enumRequired
Type of request.
Possible values: `twapHistory`
userstring · min: 42 · max: 42Required
User address.
Pattern: `^0[xX][0-9a-fA-F]+$`
Responses
chevron-right
200
Array of user's TWAP history.
application/json
Array of user's TWAP history.
timenumberRequired
Creation time of the history record (in seconds since epoch).
statusany ofRequired
Current status of the TWAP order.
* `"finished"`: Fully executed.
* `"activated"`: Active and executing.
* `"terminated"`: Terminated.
* `"error"`: An error occurred.
objectOptional
Show propertiesplus
or
objectOptional
Show propertiesplus
twapIdnumberOptional
ID of the TWAP.
chevron-right
422
Failed to deserialize the JSON body into the target type
text/plain
chevron-right
500
Internal Server Error
application/json
post
/info
TypeScript
Test it
200
Array of user's TWAP history.
chevron-down
[PrevioustokenDetailschevron-left](https://nktkas.gitbook.io/hyperliquid/api-reference/info-methods/tokendetails)
[NexttxDetailschevron-right](https://nktkas.gitbook.io/hyperliquid/api-reference/info-methods/txdetails)
Last updated 5 days ago
sun-brightdesktopmoon
Copy
import * as hl from "@nktkas/hyperliquid";
const transport = new hl.HttpTransport(); // or `WebSocketTransport`
const client = new hl.InfoClient({ transport });
const data = await client.twapHistory({ user: "0x..." });
Copy
[\
{\
"time": 1,\
"state": null,\
"status": {\
"status": "finished"\
},\
"twapId": 1\
}\
]
sun-brightdesktopmoon
---
# validatorSummaries | Hyperliquid
post
https://api.hyperliquid.xyzMainnetchevron-down
https://api.hyperliquid.xyzhttps://api.hyperliquid-testnet.xyz
/infocopy
Request validator summaries.
Body
application/jsonchevron-down
application/json
Request validator summaries.
typeundefined · enumRequired
Type of request.
Possible values: `validatorSummaries`
Responses
chevron-right
200
Array of validator performance statistics.
application/json
Array of validator performance statistics.
validatorstringRequired
Address of the validator.
Pattern: `^0x[a-fA-F0-9]{40}$`
signerstringRequired
Address of the validator signer.
Pattern: `^0x[a-fA-F0-9]{40}$`
namestringRequired
Name of the validator.
descriptionstringRequired
Description of the validator.
nRecentBlocksnumberRequired
Number of blocks produced recently.
stakenumberRequired
Total amount of tokens staked **(unsafe integer)**.
isJailedbooleanRequired
Whether the validator is currently jailed.
unjailableAfternumber · nullableRequired
Timestamp when the validator can be unjailed (in ms since epoch).
isActivebooleanRequired
Whether the validator is currently active.
commissionstringRequired
Commission rate charged by the validator.
Pattern: `^[0-9]+(\.[0-9]+)?$`
statsany\[\] · min: 3 · max: 3Required
Performance statistics over different time periods.
Show propertiesplus
chevron-right
422
Failed to deserialize the JSON body into the target type
text/plain
chevron-right
500
Internal Server Error
application/json
post
/info
TypeScript
Test it
200
Array of validator performance statistics.
chevron-down
[PreviousvalidatorL1Voteschevron-left](https://nktkas.gitbook.io/hyperliquid/api-reference/info-methods/validatorl1votes)
[NextvaultDetailschevron-right](https://nktkas.gitbook.io/hyperliquid/api-reference/info-methods/vaultdetails)
Last updated 9 days ago
sun-brightdesktopmoon
Copy
import * as hl from "@nktkas/hyperliquid";
const transport = new hl.HttpTransport(); // or `WebSocketTransport`
const client = new hl.InfoClient({ transport });
const data = await client.validatorSummaries();
Copy
[\
{\
"validator": "text",\
"signer": "text",\
"name": "text",\
"description": "text",\
"nRecentBlocks": 1,\
"stake": 1,\
"isJailed": true,\
"unjailableAfter": 1,\
"isActive": true,\
"commission": "text",\
"stats": []\
}\
]
sun-brightdesktopmoon
---
# vaultDetails | Hyperliquid
post
https://api.hyperliquid.xyzMainnetchevron-down
https://api.hyperliquid.xyzhttps://api.hyperliquid-testnet.xyz
/infocopy
Request details of a vault.
Body
application/jsonchevron-down
application/json
Request details of a vault.
typeundefined · enumRequired
Type of request.
Possible values: `vaultDetails`
vaultAddressstring · min: 42 · max: 42Required
Vault address.
Pattern: `^0[xX][0-9a-fA-F]+$`
userany ofOptional
User address.
string · min: 42 · max: 42 · nullableOptional
User address.
Pattern: `^0[xX][0-9a-fA-F]+$`
Responses
chevron-right
200
Details of a vault or null if the vault does not exist.
application/json
Details of a vault or null if the vault does not exist.
namestringRequired
Vault name.
vaultAddressstringRequired
Vault address.
Pattern: `^0x[a-fA-F0-9]{40}$`
leaderstringRequired
Leader address.
Pattern: `^0x[a-fA-F0-9]{40}$`
descriptionstringRequired
Vault description.
aprnumberRequired
Annual percentage rate.
followerStateany ofRequired
Current user follower state.
object · nullableOptional
Show propertiesplus
leaderFractionnumberRequired
Ownership percentage held by leader.
leaderCommissionnumberRequired
Leader commission percentage.
followersobject\[\]Required
Array of vault followers.
Show propertiesplus
maxDistributablenumberRequired
Maximum distributable amount.
maxWithdrawablenumberRequired
Maximum withdrawable amount.
isClosedbooleanRequired
Vault closure status.
allowDepositsbooleanRequired
Deposit permission status.
alwaysCloseOnWithdrawbooleanRequired
Position closure policy on withdrawal.
chevron-right
422
Failed to deserialize the JSON body into the target type
text/plain
chevron-right
500
Internal Server Error
application/json
post
/info
TypeScript
Test it
200
Details of a vault or null if the vault does not exist.
chevron-down
[PreviousvalidatorSummarieschevron-left](https://nktkas.gitbook.io/hyperliquid/api-reference/info-methods/validatorsummaries)
[NextvaultSummarieschevron-right](https://nktkas.gitbook.io/hyperliquid/api-reference/info-methods/vaultsummaries)
Last updated 9 days ago
sun-brightdesktopmoon
Copy
import * as hl from "@nktkas/hyperliquid";
const transport = new hl.HttpTransport(); // or `WebSocketTransport`
const client = new hl.InfoClient({ transport });
const data = await client.vaultDetails({ vaultAddress: "0x..." });
Copy
{
"name": "text",
"vaultAddress": "text",
"leader": "text",
"description": "text",
"portfolio": null,
"apr": 1,
"followerState": {
"user": "text",
"vaultEquity": "text",
"pnl": "text",
"allTimePnl": "text",
"daysFollowing": 1,
"vaultEntryTime": 1,
"lockupUntil": 1
},
"leaderFraction": 1,
"leaderCommission": 1,
"followers": [\
{\
"user": "text",\
"vaultEquity": "text",\
"pnl": "text",\
"allTimePnl": "text",\
"daysFollowing": 1,\
"vaultEntryTime": 1,\
"lockupUntil": 1\
}\
],
"maxDistributable": 1,
"maxWithdrawable": 1,
"isClosed": true,
"relationship": null,
"allowDeposits": true,
"alwaysCloseOnWithdraw": true
}
sun-brightdesktopmoon
---
# userNonFundingLedgerUpdates | Hyperliquid
post
https://api.hyperliquid.xyzMainnetchevron-down
https://api.hyperliquid.xyzhttps://api.hyperliquid-testnet.xyz
/infocopy
Request user non-funding ledger updates.
Body
application/jsonchevron-down
application/json
Request user non-funding ledger updates.
typeundefined · enumRequired
Type of request.
Possible values: `userNonFundingLedgerUpdates`
userstring · min: 42 · max: 42Required
User address.
Pattern: `^0[xX][0-9a-fA-F]+$`
startTimenumberOptional
Start time (in ms since epoch).
endTimeany ofOptional
End time (in ms since epoch).
number · nullableOptional
End time (in ms since epoch).
Responses
chevron-right
200
Array of user's non-funding ledger update.
application/json
Array of user's non-funding ledger update.
timenumberRequired
Timestamp of the update (in ms since epoch).
hashstringRequired
L1 transaction hash.
Pattern: `^0x[a-fA-F0-9]{64}$`
deltaany ofRequired
Update details.
objectOptional
Show propertiesplus
or
objectOptional
Show propertiesplus
or
objectOptional
Show propertiesplus
or
objectOptional
Show propertiesplus
or
objectOptional
Show propertiesplus
or
objectOptional
Show propertiesplus
or
objectOptional
Show propertiesplus
or
objectOptional
Show propertiesplus
or
objectOptional
Show propertiesplus
or
objectOptional
Show propertiesplus
or
objectOptional
Show propertiesplus
or
objectOptional
Show propertiesplus
or
objectOptional
Show propertiesplus
or
objectOptional
Show propertiesplus
or
objectOptional
Show propertiesplus
or
objectOptional
Show propertiesplus
or
objectOptional
Show propertiesplus
or
objectOptional
Show propertiesplus
chevron-right
422
Failed to deserialize the JSON body into the target type
text/plain
chevron-right
500
Internal Server Error
application/json
post
/info
TypeScript
Test it
200
Array of user's non-funding ledger update.
chevron-down
[PrevioususerFundingchevron-left](https://nktkas.gitbook.io/hyperliquid/api-reference/info-methods/userfunding)
[NextuserRateLimitchevron-right](https://nktkas.gitbook.io/hyperliquid/api-reference/info-methods/userratelimit)
Last updated 9 days ago
sun-brightdesktopmoon
Copy
import * as hl from "@nktkas/hyperliquid";
const transport = new hl.HttpTransport(); // or `WebSocketTransport`
const client = new hl.InfoClient({ transport });
const data = await client.userNonFundingLedgerUpdates({ user: "0x..." });
Copy
[\
{\
"time": 1,\
"hash": "text",\
"delta": {\
"type": "accountClassTransfer",\
"usdc": "text",\
"toPerp": true\
}\
}\
]
sun-brightdesktopmoon
---
# webData2 | Hyperliquid
post
https://api.hyperliquid.xyzMainnetchevron-down
https://api.hyperliquid.xyzhttps://api.hyperliquid-testnet.xyz
/infocopy
Request comprehensive user and market data.
Body
application/jsonchevron-down
application/json
Request comprehensive user and market data.
typeundefined · enumRequired
Type of request.
Possible values: `webData2`
userstring · min: 42 · max: 42Required
User address.
Pattern: `^0[xX][0-9a-fA-F]+$`
Responses
chevron-right
200
Comprehensive user and market data.
application/json
Comprehensive user and market data.
totalVaultEquitystringRequired
Total equity in vaults.
Pattern: `^[0-9]+(\.[0-9]+)?$`
agentAddressstring · nullableRequired
Agent address if one exists.
Pattern: `^0x[a-fA-F0-9]{40}$`
agentValidUntilnumber · nullableRequired
Timestamp until which the agent is valid.
cumLedgerstringRequired
Cumulative ledger value.
Pattern: `^[0-9]+(\.[0-9]+)?$`
assetCtxsPerpAssetCtxSchema\[\]Required
Array of contexts for each perpetual asset.
serverTimenumberRequired
Server timestamp (in ms since epoch).
isVaultbooleanRequired
Whether this account is a vault.
userstringRequired
User address.
Pattern: `^0x[a-fA-F0-9]{40}$`
twapStatesany\[\]\[\]Required
Array of tuples containing TWAP order ID and its state.
Show propertiesplus
spotAssetCtxsSpotAssetCtxSchema\[\]Required
Asset context for each spot asset.
optOutOfSpotDustingboolean · enumOptional
Whether the user has opted out of spot dusting.
Possible values: `true`
chevron-right
422
Failed to deserialize the JSON body into the target type
text/plain
chevron-right
500
Internal Server Error
application/json
post
/info
TypeScript
Test it
200
Comprehensive user and market data.
chevron-down
[PreviousvaultSummarieschevron-left](https://nktkas.gitbook.io/hyperliquid/api-reference/info-methods/vaultsummaries)
[NextExchange Methodschevron-right](https://nktkas.gitbook.io/hyperliquid/api-reference/exchange-methods)
Last updated 5 days ago
sun-brightdesktopmoon
Copy
import * as hl from "@nktkas/hyperliquid";
const transport = new hl.HttpTransport(); // or `WebSocketTransport`
const client = new hl.InfoClient({ transport });
const data = await client.webData2({ user: "0x..." });
Copy
{
"clearinghouseState": null,
"leadingVaults": null,
"totalVaultEquity": "text",
"openOrders": null,
"agentAddress": "text",
"agentValidUntil": 1,
"cumLedger": "text",
"meta": null,
"assetCtxs": [],
"serverTime": 1,
"isVault": true,
"user": "text",
"twapStates": [\
[]\
],
"spotState": null,
"spotAssetCtxs": [],
"optOutOfSpotDusting": true,
"perpsAtOpenInterestCap": null
}
sun-brightdesktopmoon
---