A powerful command-line interface for managing Hostinger services through the Hostinger API.
For more information, please visit https://developers.hostinger.com.
Download the latest binary from the releases page.
Download, extract and move the binary:
cd ~
wget https://github.com/hostinger/api-cli/releases/download/<version>/hapi-<version>-linux-<arch>.tar.gz
tar xf ~/hapi-<version>-linux-<arch>.tar.gz
mv hapi /usr/local/bin
Full example and possible values of the configuration file can be found here
By default, configuration file will be read from $HOME/.hapi.yaml
.
You can always define which configuration file to use by using --config
argument, eg.:
hapi --config path/to/your/config.yaml ...
Instead of providing configuration file, you can provide configuration using environment variables.
Each config file property must have HAPI_
prefix and key name in ALL CAPS, for example to provide
api_token
parameter, you would export variable like this:
export HAPI_API_TOKEN=<your token>
hapi vps vm list
See the full reference documentation for information about each available command.
hapi
has auto-complete support. This makes it easier to use the CLI and improves user experience by completing command
names by clicking TAB key. For example if you type hapi vps dat<TAB>
with auto-completion enabled, shell will automatically append
rest of the command: hapi vps data-centers
.
Auto-completion can be generated for multiple shells. The currently supported shells are:
- Bash
- Zsh
- fish
- PowerShell
After adding shell auto-completion, remember to refresh your shell profile by logging out from the shell and log back in.
Read more on how to enable auto-completion.