Clone-and-run examples for the Hyperliquid API builder API. Trade perps, spot, and HIP-3 markets on Hyperliquid via a single REST API endpoint. Your private key never leaves your machine — you sign locally, the service forwards to Hyperliquid.
Export your private key (hex, with or without 0x prefix):
export PRIVATE_KEY="0xYOUR_HEX_PRIVATE_KEY"cd python pip install -r requirements.txtRun any example:
python3 approve.py # one-time builder fee approval (run first) python3 check_status.py # check approval status python3 list_markets.py # list all perps, spot, and HIP-3 markets python3 open_orders.py # view open orders with cancel actions python3 order_status.py 123 # check what happened to order by OID python3 place_order.py # place BTC perp IOC buy (~$11) python3 cancel_order.py # place resting order, then cancel it python3 modify_order.py # place resting order, then modify its price python3 roundtrip.py # IOC buy then sell (full trade cycle) python3 hip3_order.py # HIP-3 market order (xyz:SILVER) python3 revoke.py # revoke builder fee approvalcd typescript npm installRun any example:
npx ts-node src/approve.ts # one-time builder fee approval (run first) npx ts-node src/checkStatus.ts # check approval status npx ts-node src/listMarkets.ts # list all markets npx ts-node src/openOrders.ts # view open orders with cancel actions npx ts-node src/orderStatus.ts 123 # check what happened to order by OID npx ts-node src/placeOrder.ts # place BTC perp IOC buy (~$11) npx ts-node src/cancelOrder.ts # place resting order, then cancel npx ts-node src/modifyOrder.ts # place resting order, then modify npx ts-node src/roundtrip.ts # IOC buy then sell (full trade cycle) npx ts-node src/hip3Order.ts # HIP-3 market order (xyz:SILVER) npx ts-node src/revoke.ts # revoke builder fee approvalcd rustRun any example:
cargo run --example approve # one-time builder fee approval (run first) cargo run --example check_status # check approval status cargo run --example list_markets # list all markets cargo run --example open_orders # view open orders with cancel actions cargo run --example order_status -- 123 # check what happened to order by OID cargo run --example place_order # place BTC perp IOC buy (~$11) cargo run --example cancel_order # place resting order, then cancel cargo run --example roundtrip # IOC buy then sell (full trade cycle) cargo run --example revoke # revoke builder fee approvalEvery example follows the same pattern:
- Build — call
hl_build*to get a hash (the service computes the EIP-712 hash, injects builder fee) - Sign — sign the 32-byte hash locally with your private key
- Send — call
hl_send*with the signature (the service forwards to Hyperliquid)
All coin references use names ("BTC", "ETH", "xyz:SILVER") — the service resolves them to numeric indices.
Full API reference, error codes, and fees: https://hyperliquidapi.com
Wallet-based approval (no code needed): https://hyperliquidapi.com/approve
llms.txt: https://hyperliquidapi.com/llms.txt
Hyperliquid API & hyperliquidapi.com are not affiliated with Hyperliquid Corp or Hyper Foundation.