Skip to content

CLI Overview

The hiveguard CLI lets you manage every aspect of HiveGuard from your terminal — uploading data, exporting labels, managing API keys, configuring proxy rules, and more. It’s designed for automation: scripts, CI pipelines, and ML training workflows.

Installation

Terminal window
pip install hiveguard-cli
# or
pipx install hiveguard-cli

Authentication

The CLI uses two credential types:

CredentialCommandsHow to provide
API key (X-HiveGuard-Key)items, labels, challenge, healthHIVEGUARD_API_KEY env var or ~/.hiveguard/config.json
Dashboard token (HTTP Basic)datasets, keys, config, proxy-rules, ml, metricsHIVEGUARD_DASHBOARD_TOKEN env var or ~/.hiveguard/config.json

Configure both at once:

Terminal window
hiveguard auth configure

Config file

The CLI stores credentials in ~/.hiveguard/config.json (mode 0o600, directory mode 0o700):

{
"base_url": "http://localhost:8000",
"api_key": "hg_...",
"dashboard_token": "base64(username:password)"
}

The raw API key is never passed as a CLI flag — only via env var or config file. This prevents the key from appearing in shell history or /proc.

Global options

FlagDescription
--base-url URLOverride the HiveGuard server URL
--output [table|json|jsonl|csv]Output format (default: table)
--versionShow CLI version
--helpShow help

Command groups

GroupDescription
authConfigure credentials
healthCheck server health
challengeGenerate test challenges
itemsUpload and list ground-truth items
labelsList and export consensus labels
datasetsManage datasets
keysManage API keys
metricsView traffic metrics
configRead and update runtime config
proxy-rulesManage proxy routing rules
mlTrain and inspect the ML model

Output formats

Every list command accepts --output:

Terminal window
hiveguard datasets list --output json
hiveguard labels export --fmt csv --output labels.csv

table (default) uses Rich for formatted terminal output. json, jsonl, and csv are pipe-safe — no color codes, no borders.