> For the complete documentation index, see [llms.txt](https://docs.hostinger.com/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.hostinger.com/api-reference/cli.md).

# Hostinger CLI

Install and use the hostinger command-line client — Homebrew and binary downloads, shell completion, browser sign-in or API token authentication, command structure, prompts, deploying a website with h

[`hostinger`](https://github.com/hostinger/api-cli) is the official command-line client for the Hostinger API. It's generated from the same OpenAPI specification as the [API reference](/api-reference/overview.md), so it tracks the API as endpoints are added.

## Install

On macOS and Linux, install with Homebrew:

```bash
brew install hostinger/tap/hostinger
```

Upgrade later with `brew upgrade hostinger`. Homebrew also installs shell completion for bash, zsh, and fish, and the man pages (`man hostinger`).

On Windows, or without Homebrew, download the archive for your platform from the [releases page](https://github.com/hostinger/api-cli/releases) and put the `hostinger` binary on your `PATH`. Each archive also bundles the completion files and man pages.

Confirm the install:

```bash
hostinger version
```

## Set up shell completion

Completion fills in commands, flags, and flag values with a fixed set of choices. It also completes the IDs and names of your own resources: `hostinger vps virtual-machines start <TAB>` lists your virtual machines with their hostnames, and `hostinger dns records list <TAB>` lists your domains. Those suggestions are fetched from the API with your current credentials and never open a browser sign-in.

If you didn't install with Homebrew, install the completion script for your shell:

```bash
hostinger completion install        # detects the shell from $SHELL
hostinger completion install zsh    # or name it: bash, zsh, fish, powershell
```

The command prints any one-time step your shell still needs, such as adding a directory to `fpath` in zsh. Run it again after upgrading so new commands complete. For a manual setup, see [AUTOCOMPLETE.md](https://github.com/hostinger/api-cli/blob/main/AUTOCOMPLETE.md) in the CLI repository.

## Authenticate

Sign in through the browser:

```bash
hostinger auth login
```

You don't have to do this first — any command run without credentials opens the same sign-in. The CLI caches those credentials and refreshes them for you. `hostinger auth logout` signs out and removes them.

To authenticate with a token instead — in CI, for example — set `HOSTINGER_API_TOKEN`, or store it in the config file:

```bash
hostinger config set api_token
```

Leaving out the value makes the CLI ask for it without echoing, so the token stays out of your shell history. Generate tokens in [hPanel → API](https://hpanel.hostinger.com/api). See [Security & Access](/account/security.md) for how tokens are managed.

Check which credentials are in use:

```bash
hostinger auth status
```

> **Note:** A configured token takes precedence over browser sign-in. If commands suddenly fail to authorize, run `hostinger auth status` — it shows whether a token is set and where it comes from (the environment or the config file).

## Settings

Settings live in `$HOME/.hostinger.yaml`. Manage them with `hostinger config`:

| Command                              | What it does                                                           |
| ------------------------------------ | ---------------------------------------------------------------------- |
| `hostinger config list`              | Shows every setting and its current value. Tokens are masked.          |
| `hostinger config set <key> [value]` | Writes a setting to the config file.                                   |
| `hostinger config get <key>`         | Prints the value in effect, including one set through the environment. |
| `hostinger config unset <key>`       | Removes a setting from the config file.                                |
| `hostinger config path`              | Prints the config file location.                                       |

The settings are `api_token`, `api_url`, `format` (the default output format), and `no_input` (`true` turns off all prompts). Each can also be set through an environment variable, which overrides the file — for example `HOSTINGER_FORMAT=json`.

## Run commands

Commands follow the pattern `hostinger <group> <subgroup> <verb>`:

```bash
hostinger hosting websites list
hostinger dns records list example.com
hostinger vps virtual-machines list
```

Add `--help` at any level to see what a group or subgroup contains:

```bash
hostinger vps --help
hostinger vps firewall --help
```

A command's help lists its required flags in a separate section above the optional ones, and ends with examples. For flags that take JSON, it also shows the shape of the value — see [Passing JSON to flags](/api-reference/cli-scripting.md#passing-json-to-flags).

If you mistype a command, the CLI suggests the closest match:

```bash
hostinger vps virtual-machines stat
# Error: unknown command "stat" for "hostinger vps virtual-machines"
#
# Did you mean this?
#   start
#   stop
```

### Prompts and confirmations

In a terminal, the CLI asks for anything required that you left out. Run `hostinger vps virtual-machines get` without an ID and it lists your virtual machines to pick from. Leave out a required flag and it asks for that too, listing the allowed values where there's a fixed set.

Commands that delete, stop, restart, restore, reset, uninstall, deactivate, or purchase ask before running:

```
Stop virtual machine 1234567? [y/N]:
```

Pass `--yes` (or `-y`) to skip the question. Pass `--no-input`, or set `no_input` to `true`, to turn prompting off entirely — missing values then fail straight away.

To see exactly what a command would send without running it, add `--dry-run`. The CLI prints the request as an equivalent `curl` command and sends nothing:

```bash
hostinger vps virtual-machines stop 1234567 --dry-run
```

### Waiting for VPS actions

VPS power and maintenance commands — start, stop, restart, recreate, backup and snapshot restores, and others — return as soon as the action is queued. Add `--wait` to block until it finishes:

```bash
hostinger vps virtual-machines start 1234567 --wait
```

The CLI reports each state change and exits with an error if the action fails. `--wait-timeout` sets how long to wait (default `10m`).

## Deploy a website

`hostinger up` deploys the current directory, or a path you give it, to a Web or Cloud hosting website in one command. It's also available as `hostinger deploy`.

```bash
hostinger up
```

On the first run it asks only for what it can't work out:

* **Which website** — an existing one, or a new one on your hosting plan. A new website without a domain gets a free subdomain.
* **What to deploy** — static files (HTML, CSS, JavaScript, PHP) or a Node.js app, which is built on the server. The type is detected from the directory; you confirm it.
* **Node.js build settings** — shown for review before the first build.

The answers are saved in `.hostinger/site.json` in the current directory, so the next deploy is just `hostinger up` again. Inside a Git checkout, `.hostinger/` is added to `.gitignore`, because the file names your hosting account.

> **Warning:** Every deploy replaces the website's current files. On the first deploy to a website that already has content, the CLI asks before overwriting it.

A few variations:

```bash
hostinger up ./dist          # deploy a folder; the link is still saved in the current directory
hostinger up --type nodejs   # override the detected or remembered type
hostinger up --settings      # review the Node.js build settings again
hostinger up --source git    # deploy the pushed branch through a connected GitHub or GitLab account
```

`node_modules`, `.git`, and secret files such as `.env` are never uploaded, and files matched by `.gitignore` are left out. To control what's uploaded separately from Git, add a `.hostingerignore` file — it uses the same syntax and replaces the `.gitignore` rules when present.

Unlike other commands, `hostinger up --dry-run` doesn't print `curl` commands. It prints the deploy plan as JSON — the website, type, and source it resolved, and which files would be uploaded or skipped — and changes nothing.

### Link a directory to a website

The saved link serves other commands too. Run from a linked directory, commands that act on a website — `hostinger hosting cdn status`, for example — use the linked website when you leave out the domain.

```bash
hostinger link example.com   # point this directory at a website
hostinger link --show        # show what commands here act on, and where each value comes from
hostinger unlink             # forget the link
```

`hostinger link --global example.com` sets `default_domain` in the config file instead, for commands run outside any linked directory. `hostinger up` never deploys to `default_domain` — only to the linked website, `--domain`, or `HOSTINGER_DOMAIN`.

To deploy from CI or an AI agent, where nothing can be asked, see [Deploying from scripts](/api-reference/cli-scripting.md#deploying-from-scripts).

## What you can manage

The CLI covers the whole Public API, grouped by product area. Use this to find the right group, then `--help` your way down to the verb.

| Group            | What it covers                                                                                                                                                              |
| ---------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| `hosting`        | Websites and the hosting environment — databases, PHP versions and extensions, cron jobs, cache, subdomains, and Node.js builds.                                            |
| `vps`            | Virtual machines and everything around them — power actions, backups and snapshots, firewall, Docker, SSH keys, recovery mode, PTR records, OS templates, malware scanning. |
| `mail`           | Mailboxes, forwarders, aliases, auto-replies, catch-alls, access logs, and webhooks.                                                                                        |
| `wordpress`      | Installations, plugins, themes, one-click login links, maintenance mode, LiteSpeed and object caching, and AI tools.                                                        |
| `domains`        | Availability checks, registration, transfers, forwarding, WHOIS contact profiles, and ownership verification.                                                               |
| `dns`            | Zone records and zone snapshots, including validation and restore.                                                                                                          |
| `agency-hosting` | Agency plan websites and their per-site resources — provisioning, databases, cron jobs, cache, files, Node.js builds, and WordPress.                                        |
| `ecommerce`      | Stores, physical and digital products, payment methods, shipping, and sales channels.                                                                                       |
| `reach`          | Email marketing — contacts, segments, and sending profiles.                                                                                                                 |
| `billing`        | Catalog lookups, purchase orders, payment methods, subscriptions, and auto-renewal.                                                                                         |
| `horizons`       | Hostinger Horizons websites.                                                                                                                                                |

## Output formats

In a terminal, results print as a table. When the output is piped or redirected, the CLI prints JSON instead, so it's ready for other tools. Choose a format explicitly with `--format` (or `-o`): `table`, `json`, `yaml`, or `tree` for nested data. To change the default, run `hostinger config set format json`.

Filter results with `--jq`, which takes a [jq](https://jqlang.org/) expression — no separate `jq` install needed:

```bash
hostinger vps virtual-machines list --jq '.[] | {id, hostname, state}'
```

List commands that return results in pages take `--all` to fetch every page in one go.

For exit codes, error output, passing JSON to flags, and the commands worth being careful with, see [Scripting with the CLI](/api-reference/cli-scripting.md).

## Full command reference

Every command is documented in the CLI repository. Start from the [command index](https://github.com/hostinger/api-cli/blob/main/docs/hostinger.md), which links through to each group and on to the individual verbs. The same reference is available offline with `man hostinger` and `hostinger <command> --help`.

***

*Last updated: October 27, 2026*
