Skip to main content
The WhiteBIT CLI provides 110+ commands covering the full WhiteBIT API surface — market data, spot trading, collateral trading, earn, sub-accounts, deposits, and withdrawals — directly from the terminal.

Prerequisites

  • A WhiteBIT account with an API key for authenticated commands — see Authentication
Public market data commands (market, mining-pool) require no account or API key.
FeatureDetail
110+ commandsFull API surface: spot, collateral, earn, sub-accounts, deposits, withdrawals
Multi-profileNamed profiles in ~/.whitebit/config.toml, switch with --profile
--dry-run modePreview the exact request payload before sending
JSON output--json flag on every command — pipe into jq or any automation tool
Shell completionTab-completion for Bash, Zsh, and Fish
Cross-platformmacOS (ARM + x64), Linux, and Windows

Install the CLI

Packaged releases (npm, Homebrew, and pre-compiled binaries) are coming soon. The source code is available at github.com/whitebit-exchange/whitebit-cli.

Quick start

# 1. Set credentials (required for account and trading commands)
export WHITEBIT_API_KEY="YOUR_API_KEY"
export WHITEBIT_API_SECRET="YOUR_SECRET"

# 2. Verify setup — no authentication required
whitebit market list

# 3. Check the trading balance
whitebit balance trade

# 4. Place a limit order
whitebit trade spot limit-order BTC_USDT buy 0.001 50000

Authentication

Credentials are resolved in priority order (highest first):
MethodBest forPersistenceSecurity note
CLI flags (--api-key, --api-secret)Quick testingNoneVisible in process list
Environment variablesCI/CD, Docker, one-off scriptsPer-sessionDepends on environment
Config file (~/.whitebit/config.toml)Daily use, multiple profilesPermanentSet chmod 600 on the file
Store API keys securely. Do not commit ~/.whitebit/config.toml to version control. Avoid --api-key flags in production scripts — the value is visible in the process list.

Config file

Create ~/.whitebit/config.toml with one or more named profiles:
[default]
api_key = "YOUR_API_KEY"
api_secret = "YOUR_SECRET"
format = "table"  # or "json"

[work]
api_key = "WORK_API_KEY"
api_secret = "WORK_SECRET"
Switch profiles with --profile:
whitebit balance trade --profile work

Commands

ModuleCommandsAuthDescription
market14NoTickers, order book, trades, klines, funding rates, platform status
mining-pool2NoPool statistics and hashrate
balance3YesSpot, main, and personal fee balances
deposit4YesCrypto and fiat deposit addresses
withdraw4YesCrypto and fiat withdrawals + history
transfer1YesTransfer between main, spot, and collateral accounts
codes4YesCreate, apply, and list redemption codes
earn13YesFixed and flexible staking, interest history
trade spot18YesLimit, market, stop, bulk orders; cancel, modify, kill-switch
trade collateral22YesMargin: leverage, positions, OCO, OTO, conditional orders
trade convert3YesEstimate and execute asset conversions
sub-account17YesSub-account management, API keys, IP whitelists

Examples

Market data

# List all available markets
whitebit market list

# Get the BTC_USDT ticker
whitebit market ticker BTC_USDT

# Get order book depth
whitebit market depth BTC_USDT

# Get recent trades
whitebit market trades BTC_USDT

Account and balance

# Check spot balance
whitebit balance spot

# Check main account balance
whitebit balance main

# Transfer 100 USDT from main to spot
whitebit transfer --from main --to spot --amount 100 --currency USDT

Spot trading

# Place a limit buy order
whitebit trade spot limit-order BTC_USDT buy 0.001 50000

# Place a market sell order
whitebit trade spot market-order BTC_USDT sell 0.001

# List open orders
whitebit trade spot orders BTC_USDT

# Cancel an order
whitebit trade spot cancel BTC_USDT ORDER_ID

JSON output and scripting

# Output as JSON
whitebit balance spot --json

# Pipe into jq
whitebit balance spot --json | jq '.[] | {currency: .currency, balance: .available}'

# Dry run — preview the request without sending
whitebit trade spot limit-order BTC_USDT buy 0.001 50000 --dry-run

Shell completion

source <(whitebit completion --shell bash)
To persist across sessions, add the line above to ~/.bashrc.

Global options

OptionDescription
--profile <name>Use a named config profile (default: default)
--api-key <key>Override the API key for this command
--api-secret <secret>Override the API secret for this command
--api-url <url>Override the API base URL
--format <table|json>Output format
--jsonShorthand for --format json
--verbose, -VShow raw API responses
--dry-runShow the request payload without sending

Exit codes

CodeMeaning
0Success
1General error
2Authentication or credential error
3Network error
4Usage or bad arguments
5Rate limit (HTTP 429)

Security best practices

  • Never commit credentials to version control.
  • Use environment variables for CI/CD pipelines.
  • Set restrictive file permissions: chmod 600 ~/.whitebit/config.toml.
  • Use API key restrictions in the WhiteBIT dashboard — IP whitelist and read-only scope when appropriate.
  • Avoid --api-key and --api-secret flags in production scripts — values are visible in the process list.

What’s next