Docs / Reference / Command-Line Interface

Command-Line Interface

The monsterops CLI talks to the REST API, so it works against any running instance (local or remote). Point it with --url / $MONSTEROPS_URL and authenticate with --api-key / $MONSTEROPS_API_KEY. Add --format json to any read command for machine-readable output.

# Serve
monsterops serve --host 0.0.0.0 --port 8000

# Database schema (create or upgrade to the latest migration)
monsterops migrate

# Users
monsterops users list --search acme --size 100
monsterops users create alice --password 's3cret' --group premium --expiration 2026-12-31
monsterops users disable alice
monsterops users delete alice --yes

# Groups
monsterops groups create premium
monsterops groups add-member premium alice

# NAS devices
monsterops nas list

Local vs. API commands

Most subcommands talk to the REST API. Two run locally against the database instead:

  • migrate — applies Alembic migrations. The migrations ship inside the installed package, so it works from a pip install with no source checkout.
  • rotate-secret-key — re-encrypts stored credentials from the old key to a new one, so it must read the ciphertext directly.
monsterops rotate-secret-key --new-key "<new-key>" --dry-run   # report only
monsterops rotate-secret-key --new-key "<new-key>"             # rotate for real

rotate-secret-key is abort-safe (nothing is written if any value fails to decrypt with the old key). When it finishes, set MONSTEROPS_SECRET_KEY to the new value and restart. See Configuration → Rotating the secret key.

Problems you may hit

  • command not found — activate the virtual environment or use the full path to the venv's bin/monsterops.
  • API commands fail with 401/403 — set --api-key (or $MONSTEROPS_API_KEY) with a key that has the right scope.
  • migrate can't find alembic.ini — on a source checkout pass --config, or just use the bundled path from a pip install.