Comprehensive OpenAPI 3.1.0 specification and AsyncAPI 3.0.0 documentation for the Hyperliquid DEX API.
π Home: https://bowen31337.github.io/hyperliquid-openapi/landing.html
π Redoc: https://bowen31337.github.io/hyperliquid-openapi/
π§ Swagger UI: https://bowen31337.github.io/hyperliquid-openapi/swagger.html - Now with integrated Quick Tester!
π§ͺ API Tester: https://bowen31337.github.io/hyperliquid-openapi/api-tester.html
π» GitHub Repository: https://github.com/bowen31337/hyperliquid-openapi
This repository contains complete API documentation for Hyperliquid, including:
- REST API: Complete OpenAPI 3.1.0 specification with all endpoints
- WebSocket API: AsyncAPI 3.0.0 specification for real-time data streaming
- Interactive Documentation:
- Redoc: Beautiful, responsive documentation with advanced search
- Swagger UI: Interactive API explorer with "Try it out" functionality + integrated Quick Tester
- API Tester: Standalone quick testing tool with pre-built examples
- Automated Deployment: GitHub Actions for continuous deployment
-
Install dependencies:
npm install
-
Start local server:
npm start
-
Open browser: Navigate to
http://localhost:8080
python3 -m http.server 8080Then open http://localhost:8080 in your browser.
openapi.yaml- Complete REST API specification (OpenAPI 3.1.0)websocket-api.yaml- WebSocket API specification (AsyncAPI 3.0.0)index.html- Redoc documentation viewerREADME.md- This file
- Mainnet:
https://api.hyperliquid.xyz - Testnet:
https://api.hyperliquid-testnet.xyz
- Mainnet:
wss://api.hyperliquid.xyz/ws - Testnet:
wss://api.hyperliquid-testnet.xyz/ws
Query various types of information:
- Market Data: Mid prices, order books, candles
- User Data: Open orders, fills, positions
- Account Data: Balances, fees, referrals
- Staking Data: Delegations, rewards
Execute trading and account operations:
- Orders: Place, cancel, modify orders
- Leverage: Update leverage and margin
- Transfers: Send USDC, spot tokens
- Withdrawals: Bridge to L1
- Staking: Delegate/undelegate
- Vaults: Deposit/withdraw
Real-time data streams:
allMids- All mid pricesl2Book- Level 2 order booktrades- Recent tradescandle- Candlestick datauserEvents- User fills, funding, liquidationsorderUpdates- Order status updateswebData2- Comprehensive user data
Trading operations require EIP-712 signatures. See the official documentation for signing details.
You can test trading endpoints (place order, cancel order, etc.) directly in Swagger UI using your Web3 wallet:
- Open Swagger UI.
- Click Connect Wallet and approve MetaMask (or any WalletConnect-compatible wallet).
- Ensure your wallet is on Arbitrum One (Mainnet) or Arbitrum Sepolia (Testnet); the page can prompt to switch.
- Use Quick Tester or Try it out on
POST /exchange; requests are signed with EIP-712 and sent automatically. - Your private keys never leave your wallet; you approve each signature in the wallet.
Supported: MetaMask and other wallets that inject window.ethereum. Network validation and auto-switch for Arbitrum are included.
Official and community SDKs:
- Python: hyperliquid-python-sdk
- TypeScript:
- Rust: infinitefield/hypersdk
npm run validateOr using Docker:
docker run --rm -v $(pwd):/spec redocly/cli lint openapi.yamlnpm run validate:asyncapicurl -X POST https://api.hyperliquid.xyz/info \
-H "Content-Type: application/json" \
-d '{"type": "allMids"}'curl -X POST https://api.hyperliquid.xyz/info \
-H "Content-Type: application/json" \
-d '{
"type": "openOrders",
"user": "0x0000000000000000000000000000000000000000"
}'curl -X POST https://api.hyperliquid.xyz/info \
-H "Content-Type: application/json" \
-d '{
"type": "l2Book",
"coin": "BTC",
"nSigFigs": 5
}'const ws = new WebSocket('wss://api.hyperliquid.xyz/ws');
ws.onopen = () => {
ws.send(JSON.stringify({
method: 'subscribe',
subscription: {
type: 'allMids'
}
}));
};
ws.onmessage = (event) => {
const data = JSON.parse(event.data);
console.log('Mid prices:', data);
};ws.send(JSON.stringify({
method: 'subscribe',
subscription: {
type: 'l2Book',
coin: 'BTC',
nSigFigs: 5
}
}));ws.send(JSON.stringify({
method: 'subscribe',
subscription: {
type: 'userEvents',
user: '0x0000000000000000000000000000000000000000'
}
}));Rate limits are address-based and can be increased through:
- Trading Volume: Higher volume increases limits
- Reserve Actions: Pay 0.0005 USDC per request to reserve additional actions
All responses are in JSON format. Successful responses have status: "ok", errors have status: "err".
{
"status": "ok",
"response": {
"type": "order",
"data": {
"statuses": [{
"resting": {
"oid": 123456
}
}]
}
}
}{
"status": "ok",
"response": {
"type": "order",
"data": {
"statuses": [{
"error": "Order must have minimum value of $10."
}]
}
}
}rejected- Order rejected at placementmarginCanceled- Insufficient marginopenInterestCapCanceled- Open interest cap reachedreduceOnlyCanceled- Reduce-only order doesn't reduce positionliquidatedCanceled- Canceled due to liquidation
See Error Responses for complete list.
Contributions are welcome! Please feel free to submit issues or pull requests.
MIT License - see LICENSE file for details.
This is unofficial documentation. Always refer to the official Hyperliquid documentation for the most up-to-date information.
Built with β€οΈ for the Hyperliquid community