Official command-line interface for the Impreza Host public REST API
Project description
impreza-cli — Official CLI for Impreza Host
Command-line interface for the Impreza Host public REST API.
Built on top of impreza-sdk — same
auth model, same Tor support, same retry behaviour, plus
multi-context configuration and Rich-rendered tables for human-
friendly output.
pip install impreza-cli
Requires Python 3.10+. See ../CHANGELOG.md for
release history.
Quickstart
# 1. Add a context with your API credentials. Generate keys in
# Impreza Account → API Keys; whitelist the calling
# machine's IP at the same screen.
$ impreza context create personal --key imp_... --secret ...
Context 'personal' created and set as default.
# 2. Confirm everything works. impreza doctor runs five sequenced
# health checks (config, API reachable, key status, IP
# whitelist, account profile) and exits 0 only if all pass.
$ impreza doctor
impreza doctor
----------------------------------------
[OK] active-context: Default context
[OK] api-reachable: GET /account/api-keys/self OK (142ms)
key prefix='imp_a1b2c3d4', label='devkit'
[OK] key-status: status='active'
[OK] ip-whitelist: request_ip 200.1.2.3 matches entry ('home')
[OK] account-profile: Jane Doe <jane@example.com>, balance 5.00 USD
registered 2024-01-15
----------------------------------------
All checks passed. 5/5.
# 3. Read commands span every resource group:
$ impreza account info # profile + balance
$ impreza vps list # across both backends
$ impreza domain check example.com mydomain.io
$ impreza catalog products --group "VPS"
# 4. Pipe into jq for scripting (every read verb supports --output
# json | yaml):
$ impreza invoice list --output json \
| jq '[.[] | select(.status == "Unpaid")] | length'
# 5. Write verbs are gated by confirm_or_exit so you don't lose
# data accidentally; pass --yes / -y to skip prompts in scripts:
$ impreza vps reboot 17988
$ impreza vps proxmox snapshots create 17988 pre-update
$ impreza domain dns add example.com --type A --name www --value 1.2.3.4
# 6. Crypto top-up. --browser opens the BTCPay invoice URL
# automatically; --wait polls until the gateway confirms
# (default 2h timeout matches server-side invoice expiry).
$ impreza account topup --amount 50 --method xmr --browser --wait
Authentication
Two ways to authenticate. The CLI tries them in order:
-
Context (recommended) —
impreza context create <name>stores credentials in a config file; commands read them automatically. Per-invocation override viaimpreza --context other <command>. -
Environment variables —
IMPREZA_API_KEY+IMPREZA_API_SECRET. Useful in CI, but contexts are preferred for local work.
The config file lives at:
| OS | Path |
|---|---|
| Linux | $XDG_CONFIG_HOME/impreza/config.toml (default ~/.config/impreza/config.toml) |
| macOS | ~/Library/Application Support/impreza/config.toml |
| Windows | %APPDATA%\impreza\config.toml |
Override with IMPREZA_CONFIG=/path/to/config.toml for testing or
non-standard layouts.
On POSIX, the config file is chmod 0o600 after every write so only
the owner can read the credentials. Windows ACLs are left to the OS
default.
Commands
The CLI groups commands by resource. Run impreza <group> --help
to see the full subcommand list, or impreza <group> <command> --help for option-level detail.
| Group | Verbs | Notes |
|---|---|---|
context |
create / use / list / current / delete |
Local credential management — never hits the network |
doctor |
(single command) | Health check — config + API reachable + key status + IP whitelist + account profile |
account |
info / balance / services / topup / topup-status |
Profile + balance + services + crypto top-up |
catalog |
products / product / product-groups / tlds |
Pre-purchase discovery |
domain |
show / check / pricing / register / transfer / set-nameservers / lock / unlock / id-protection / raa-verify / gdpr-auth / transfer-approval + domain dns list / add / update / delete / activate |
Domain registrations + full DNS CRUD |
vps |
list / show / status / start / stop / reboot / shutdown / set-hostname / set-password / reinstall / migrate / cancel + vps proxmox snapshots / backups / backup-schedules / network + vps cloud images / rescue / iso / ssh-keys / vnc / vnc-password / resize / boot-order / ipv6 |
Cross-backend (Proxmox + Cloud) VPS with smart dispatch |
order |
list / show / create / upgrade |
Submit / browse product orders |
service |
cancel |
Submit cancellation request (any service) |
webhook |
list / show / create / update / delete / rotate-secret / deliveries / event-types |
Webhook subscription management + delivery history. Event-payload contract documented in ../openapi/asyncapi.yaml. |
invoice |
list / show |
Invoices with line items + transactions |
key |
whoami |
Active API key identity + IP whitelist |
Conventions:
- Destructive verbs prompt for confirmation; pass
--yes/-yto skip the prompt in scripts. - Operation-returning verbs (
vps reinstall,vps migrate,vps proxmox snapshots rollback,vps proxmox backups create/restore) accept--waitto block on the Proxmox queue, with--timeout(default 600 s for fast ops, 1800 s for the slower restores). - Cost-incurring verbs (
domain register/transfer/id-protection,order create/upgrade,account topup) call out the balance impact in the confirmation prompt; anInsufficientCredit402 surfaces with a hint pointing atimpreza account topup. - Verbs that mutate a resource emit a green success line on stdout; queued / reboot-required state changes emit a cyan info line. Errors are red on stderr.
Service termination policy: service cancel / vps cancel
submit an AddCancelRequest — staff approves the actual
termination. There is no direct customer path to terminate a
service or remove a service suspension (suspension is
billing-state and is removed automatically when the overdue
invoice is paid, or manually by staff after an abuse hold is
resolved).
Output formats
Every command supports --output table|json|yaml (short form -o).
| Format | Default | Best for |
|---|---|---|
table |
yes | human reading at the terminal |
json |
piping into jq, automation, scripting |
|
yaml |
human-editable config snapshots, CI/CD pipelines |
YAML output requires the optional pyyaml dependency:
pip install impreza-cli[yaml]
The CLI raises a clear RuntimeError pointing at the install hint
if you select --output yaml without it.
The flag works at both the global level and per-command:
# Global default for the invocation
impreza --output json account info
# Per-command override (wins over global)
impreza --output yaml account info --output table
Tab completion
Typer ships completion for bash, zsh, fish, and PowerShell
out of the box:
# Install for the current shell (auto-detected)
impreza --install-completion
# Or explicitly
impreza --install-completion bash # / zsh / fish / powershell
# Inspect the script before installing
impreza --show-completion bash
After installing, restart the shell (or source ~/.bashrc /
equivalent) and impreza <TAB> should suggest resource groups,
impreza account <TAB> should suggest verbs, and so on.
Tor
Inherited from the SDK. Three knobs:
# Per-context override at create time
impreza context create offshore \
--key imp_... --secret ... \
# No --proxy flag yet; for now, set IMPREZA_USE_TOR before invoking
# Env var, picked up by the SDK transparently
IMPREZA_USE_TOR=1 impreza account info
# Programmatic via the SDK (Python users skip the CLI for this)
The SDK's auto_tor=True path (probe Tor, fall back to clearnet)
isn't surfaced through the CLI yet — coming in a future release
alongside the --via-tor shortcut.
Error handling
The CLI maps SDK exceptions to friendly stderr messages and a
non-zero exit code, matching the format ImprezaError.__str__
produces:
Error: Invalid API credentials. (code=UNAUTHORIZED) [request_id=req_abc]
Tracebacks never leak from expected failures (auth errors, missing contexts, 404s, 429s, etc.). Bugs in the CLI itself still raise so the traceback isn't swallowed — that's intentional.
Development
git clone https://github.com/imprezahost/impreza-devkit.git
cd impreza-devkit/cli-python
python -m venv .venv
# Linux/macOS: source .venv/bin/activate
# Windows PowerShell: .venv\Scripts\Activate.ps1
# Install editable + test/dev/yaml extras + the SDK as a path dep
pip install -e ../sdk-python -e ".[test,dev,yaml]"
pytest # unit + Typer-runner E2E
ruff check
mypy --strict impreza_cli
To run the live integration smokes (skipped silently without creds):
export IMPREZA_API_KEY="imp_..."
export IMPREZA_API_SECRET="..."
# Optional, for `impreza domain show / dns list`:
export IMPREZA_TEST_DOMAIN="<a domain on your account>"
pytest -v -s tests/
The smokes exercise the same surface as the unit tests against the real API, so they catch contract drift between the CLI and the server.
License
MIT. See ../LICENSE at the repository root.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file impreza_cli-0.3.2.tar.gz.
File metadata
- Download URL: impreza_cli-0.3.2.tar.gz
- Upload date:
- Size: 122.5 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.12.10
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
c5cb893a19864b6ba92bebc68663ec5578017404c9c6878bb47b8c5b1b7a19f6
|
|
| MD5 |
342d80993c662170cdff3619ae5af81a
|
|
| BLAKE2b-256 |
90493f8c92f16c6e68bf76b5a652de49d12232209a239a5610dd231bad7088d4
|
File details
Details for the file impreza_cli-0.3.2-py3-none-any.whl.
File metadata
- Download URL: impreza_cli-0.3.2-py3-none-any.whl
- Upload date:
- Size: 80.3 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.12.10
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
a19fb8297d450296388dca722cb4d13f92a35fd9ed8c11d9d23e990f060a8832
|
|
| MD5 |
eda7df188e9a968189857956edec94c8
|
|
| BLAKE2b-256 |
0abb6a7b1ff8e5e85bc71365949cec502c47536874e69a37a5d3754d43586469
|