CLI

Command-line interface for interacting with Hyperliquid API without writing code.

Usage

npx @nktkas/hyperliquid <endpoint> <method> [options]

endpoint

  • Type: "info" | "exchange"

API endpoint to use:

  • info - query market data and account state

  • exchange - execute trading operations (requires --private-key)

method

Method name matching the SDK client methods (e.g., allMids, order, cancel).

Run npx @nktkas/hyperliquid --help for the full list.

--testnet

Use testnet instead of mainnet.

npx @nktkas/hyperliquid info allMids --testnet

--timeout

  • Type: number

  • Default: 10000

Request timeout in milliseconds.

--private-key

  • Type: `0x${string}`

Private key for exchange operations. Required for exchange endpoint.

[!WARNING] Passing private keys via command line is insecure. Use environment variables:

--vault

  • Type: `0x${string}`

Vault address for trading on behalf of a vault.

--offline

Generate request payload without sending. Useful for debugging or signing transactions offline.

Examples

Info Endpoint

Exchange Endpoint

JSON Arguments

Some methods require JSON arguments. Escape quotes properly for your shell:

Output

CLI outputs JSON to stdout. Format with jqarrow-up-right or PowerShell:

Last updated