CLI
Drive HostStack from a terminal, a script or a CI job with the hoststack command. This page is the reference for every command it has.
Install
npm install -g @hoststack.dev/clibun add -g @hoststack.dev/cliThe package needs Node.js 18 or later. Check the install with hoststack version.
Log in
Create an API key
In the dashboard, open Settings → API keys and create a key. Choose Deploy Only for a CI job that only triggers deploys, or Full Access to manage resources. Every key starts with
hs_live_.Save it on this machine
bashhoststack login --key hs_live_...The CLI checks the key against the API, then writes it and its team id to
~/.hoststack/config.jsonwith file mode0600.Check who you are
bashhoststack whoamiIt prints the team, its Team ID and your role — the team id is also what the SDK takes as its first argument.
An API key belongs to one team, so every command acts on that team. To work in another team, log in with a key created there.
Configuration
Environment variables override the config file, which suits CI:
HOSTSTACK_API_ KEY stringThe API key to use instead of the saved one.
HOSTSTACK_API_ URL stringThe API base URL.
login --urlsaves the same setting.Default:
https://hoststack.devHOSTSTACK_TEAM_ ID numberThe team id to use instead of the saved one. A key only answers for its own team — any other id gets
404 Team not found.NO_COLOR any valueTurns colour off. Colour is also off whenever output is not a terminal, so piped output and CI logs are clean.
FORCE_COLOR=1turns it back on.
Common workflows
hoststack deploy trigger svc_...
# prints the new deploy's dpl_... id and the command to read its log
hoststack deploy logs svc_... dpl_...hoststack env set svc_... NODE_ENV=production
hoststack env set svc_... STRIPE_SECRET_KEY=sk_live_... --secret
hoststack deploy trigger svc_...hoststack db create --project prj_... --name app-db --engine postgres
hoststack db link db_... --service svc_... # injects DATABASE_URL
hoststack deploy trigger svc_... # the link applies on the next deployhoststack machines add desktop
# prints a one-line installer: run THAT on the machine itself, as root
hoststack machines list
hoststack services create --name api --type web --project prj_... --machine desktop# A Deploy Only key, stored as a CI secret
export HOSTSTACK_API_KEY=hs_live_...
npm install -g @hoststack.dev/cli
hoststack deploy trigger svc_...Scripting
- A command exits
0on success and1on an error or a missing argument, after printing its usage. - Commands with
[--json]in their usage print the raw API response forjq. - Arguments that take an id accept the public id (
svc_…,prj_…,db_…) where the usage line shows one.
Authentication
| Command | Usage and what it does |
|---|---|
| login |
Check the key against the API, then save it and its team id to |
| whoami |
Who the key acts as: the user, or for an API key its id and permission — plus the team name, slug, id and your role. |
| help |
Every command group, with examples. Also |
| version |
The installed CLI version. Also |
Projects
| Command | Usage and what it does |
|---|---|
| projects list |
Projects in the team, with their id, region and creation date. The default when you run |
| projects create |
Create a project and print its |
| projects delete |
Delete a project (alias: |
Services
--type takes the full service type or its short form: web, private, worker, cron, static. The CLI has no flag for a cron schedule, and the API refuses a cron_job without one, so create cron jobs in the dashboard, the SDK or the MCP server. Run hoststack services update with no flags to print every field it can change. Guide: Deploying.
| Command | Usage and what it does |
|---|---|
| services list |
Services across every project in the team. |
| services get |
Name, id, type, status, internal URL and creation date — and the configured image when one is set (alias: |
| services create |
Create a service. |
| services delete |
Delete a service (alias: |
| services scale |
|
| services suspend |
Stop the service and keep its configuration and data. |
| services resume |
Start a suspended service again. |
| services update |
Change build and runtime settings. Build and repo fields ( |
| services metrics |
CPU, memory against its limit, disk and network for the container, plus the latest sample from the host it runs on. |
| services templates |
The template ids |
| services links |
The managed resources linked into this service today. |
| services link |
Link any managed resource — object storage, a queue, a search index, an email domain, a database. |
| services unlink |
Remove a link. The resource itself is untouched; its variables disappear on the next deploy. |
Deploys
| Command | Usage and what it does |
|---|---|
| deploy trigger |
Start a deploy and print its |
| deploy list |
Recent deploys of a service (alias: |
| deploy logs |
The build log of one deploy. |
| deploy cancel |
Cancel a deploy that is still in progress. |
| deploy rollback |
Roll the service back to an earlier deploy. |
| deploy diagnose |
The deploy record, the tail of its build log (200 lines by default) and the runtime log since it started (100 lines). The runtime half is skipped when the deploy never reached a container, because it would show the previous release’s output. |
| deploy promote |
Run a deploy’s already-built image on the sibling service in another environment — no rebuild. Env vars, secret files, volumes, IP allowlists and custom domains are per environment and do not come with it. |
Runtime logs
| Command | Usage and what it does |
|---|---|
| logs |
Recent runtime output of a service: 100 lines from the last hour unless you say otherwise. |
Environment variables
--target is build, runtime or both (the default). A secret on both is injected at runtime only, because build arguments are baked into the image history — use build to force it into the build. Guide: Environment variables.
| Command | Usage and what it does |
|---|---|
| env list |
Variables on a service. Secret values are masked (alias: |
| env get |
One variable. A secret value is masked. |
| env set |
Create or update one variable. Without |
| env delete |
Delete a variable by key or by numeric id (alias: |
| env bulk |
Replace every variable on the service with this set — anything not listed is deleted. With |
| env import |
Import a |
Environments
| Command | Usage and what it does |
|---|---|
| environments list |
Environments in a project (alias: |
| environments create |
|
| environments delete |
Delete an environment (alias: |
Databases
A linked database reaches the service as DATABASE_URL (Postgres, MySQL, MariaDB), REDIS_URL or MONGO_URL, plus variables prefixed with the link’s alias. A link takes effect on the next deploy. Guide: Databases.
| Command | Usage and what it does |
|---|---|
| db list |
Databases in a project (alias: |
| db get |
One database’s details (alias: |
| db create |
Provision a managed database. On your own machine ( |
| db credentials |
Host, port, user, password, database name and the internal connection URL — and the external URL and allowlist when external access is on (alias: |
| db connect |
Open |
| db external |
Expose the database on a public host and port, TLS required. Postgres only. Repeat |
| db update |
Rename, change the plan, or grow the disk. The disk cannot shrink, so there is no undo for a size you overshoot (alias: |
| db query |
Run one read-only statement against a Postgres database — a single |
| db delete |
Deprovision a database (alias: |
| db suspend |
Stop the container and keep the data. |
| db resume |
Start a suspended database again. |
| db restart |
Restart the container in place: same volume, same connection URL, every open connection dropped. |
| db link |
Link the database to a service. The alias defaults to the database name in upper case. |
| db links |
The managed resources linked to a service. |
| db unlink |
Remove a link. Its variables disappear on the next deploy. |
| db upgrade-version |
In-place major upgrade — Postgres 15–18, Redis 6–8, newer versions only. The database is dumped, recreated at the new version under the same name and restored, so connection URLs keep working. It runs in the background: poll |
| db upgrade-to-ha |
Move a standalone Postgres to a three-node high-availability cluster. The team must have HA enabled. |
| db cluster |
An HA cluster’s members and failover history. |
| db backups |
The off-site archives you could restore from. A dump that only exists on the database’s own machine is not listed — it would be lost with the database. |
Volumes
Guide: Volumes.
| Command | Usage and what it does |
|---|---|
| volumes list |
Volumes attached to a service (alias: |
| volumes create |
Attach a new volume, 10–10240 GB, 10 GB by default (alias: |
| volumes resize |
Grow a volume. Volumes can only grow. |
| volumes delete |
Detach and delete a volume (alias: |
| volumes backup |
Turn nightly backups on or off. Turning them off keeps the archives you already have. |
| volumes backups |
The archives you can restore from. Backups being on is not the same as having one. |
| volumes restore |
Replace the volume’s contents with an archive. There is no undo and no snapshot of the current state; without |
Domains
A domain argument is the hostname, its dom_… id or its numeric id. Guide: Custom domains.
| Command | Usage and what it does |
|---|---|
| domains list |
Custom domains in the team (alias: |
| domains add |
Attach a domain to a service. Every custom domain points at a service (alias: |
| domains verify |
Check the domain’s DNS now and report whether it is active — or, for a zone HostStack hosts, that the registry is not delegating it here. |
| domains update |
|
| domains delete |
Remove a custom domain (alias: |
DNS
<zone| is a zone id (dnz_…) or any name under the zone. A record <name> is @ for the apex or a bare label such as www, without the zone suffix.
| Command | Usage and what it does |
|---|---|
| dns zones |
Hosted zones, and whether the registry actually delegates each one to HostStack (aliases: |
| dns check |
Read the registry’s nameservers for a zone, live. A zone can be active and full of correct records while the registry still points at the old host. Exits 1 when the zone is delegated elsewhere and 0 otherwise — including when the answer could not be determined — so it works as a cutover gate. |
| dns records |
Every record in a zone (alias: |
| dns add |
Create a record (alias: |
| dns update |
Replace a record — a full write, not a patch (alias: |
| dns delete |
Delete a record (alias: |
| dns resync |
Push a record stuck at status |
Dev boxes
new creates a standalone box in the team’s Development area; create puts one inside a project, or clones an existing service into one with --service. The box size defaults to standard, and a smaller size is raised to it. Run hoststack dev help for every flag and a cheat sheet of what runs inside a box. Guide: AI dev environments.
| Command | Usage and what it does |
|---|---|
| dev new |
A standalone box from a connected GitHub repo ( |
| dev list |
Your dev boxes and their companion services (alias: |
| dev create |
A box inside a project. |
| dev create --service |
A box that runs a clone of an existing service, with its env vars, a clone of its linked database (unless |
| dev delete |
Remove the box together with its cloned database and its |
Dev box tasks
A task is a written prompt for the agent in a project’s dev box. add files it; starting it is a separate step, so you can queue work for a box that is asleep. Task ids are the task_… id or the numeric id.
| Command | Usage and what it does |
|---|---|
| task list |
The project’s task backlog (alias: |
| task add |
File a task. |
| task show |
One task with its full prompt (alias: |
| task done |
Mark a task finished. |
| task reopen |
Put a task back in the backlog. |
| task delete |
Delete a task (alias: |
Your own machines
Enrol a spare desktop, a home server or a VPS, then pin work to it with --machine on services create, db create and dev new/dev create. The CLI is the only scriptable way to enrol a machine. Guide: Your own machines.
| Command | Usage and what it does |
|---|---|
| machines list |
Enrolled machines, whether each is online, and what runs on it (alias: |
| machines show |
One machine and everything running on it — worth reading before you switch it off (alias: |
| machines add |
Register a machine and print the installer to run on it — for Linux and macOS as root, and for Windows PowerShell as Administrator. The command carries a single-use pairing token with an expiry, and installs Docker if the machine has none (aliases: |
| machines remove |
Unenrol a machine and print the command that removes the agent from it. Refused while anything is still pinned to it (aliases: |
Cron jobs
| Command | Usage and what it does |
|---|---|
| cron list |
Recent executions of a cron job, with exit codes (alias: |
| cron get |
One execution (alias: |
| cron trigger |
Run the job now (alias: |
Errors
Guide: Error tracking.
| Command | Usage and what it does |
|---|---|
| errors list |
Exceptions your apps reported, grouped into issues. |
| errors show |
One issue and its recent stack traces (alias: |
| errors resolve |
Mark it fixed; you hear about it again if it comes back. |
| errors ignore |
Keep counting it and stop being told about it. |
| errors reopen |
Undo |
| errors fix |
Write an agent task for the error in the project’s dev box. The task is written, not started. |
| errors keys |
List, mint ( |
Alerts
An alert is identified by four fields — --action, --severity (info, warning, error or critical), and optionally --type and --id for the resource. Copy them from hoststack alerts list --json.
| Command | Usage and what it does |
|---|---|
| alerts list |
What is on fire: every open alert, with repeats of the same alert collapsed into one row. |
| alerts resolve |
Say the condition has ended, for an alert nothing on the platform will close by itself — a certificate failure for a domain since removed, a deploy failure on a deleted service. |
| alerts ack |
Say only that you have seen it. The alert stays open; it is muted for |
| alerts unack |
Remove an acknowledgement (alias: |
| alerts channels |
Where alerts are delivered — Slack, Discord or email — with webhook URLs masked and the number of events each channel subscribes to. An active channel with no events delivers nothing (alias: |
| alerts channels add |
Create a channel. |
| alerts channels update |
Rename a channel, switch it on or off, or change its events. |
| alerts channels test |
Send a test event and report whether the provider accepted it. Exits 1 when it was not delivered. |
| alerts channels delete |
Delete a channel. Alerts subscribed only to it stop being delivered anywhere. |
| alerts events |
Every event a channel can subscribe to — the values |
Activity log
| Command | Usage and what it does |
|---|---|
| activity list |
Who changed what, and when. |
Uptime checks
Every command takes a service id, or --site <site-id> to watch a site HostStack does not host. Only services with a public URL — web services and static sites — can be checked, and a site’s domain must be verified first with hoststack analytics verify.
| Command | Usage and what it does |
|---|---|
| uptime get |
The check and its last result (alias: |
| uptime set |
Create or update the check: the path, the expected HTTP status, the interval in seconds, the timeout in milliseconds, and how many failures in a row raise an alert. A change resets the check’s state to unknown (alias: |
| uptime disable |
Keep the configuration and stop probing. |
| uptime rm |
Delete the check (aliases: |
Analytics
Cookieless traffic analytics for any site you own, hosted on HostStack or not. <domain> is the site’s domain or its public id. Stats ranges are 24h, 7d (the default), 30d, 90d and 12mo. Guide: Site analytics.
| Command | Usage and what it does |
|---|---|
| analytics sites |
Every site the team tracks (alias: |
| analytics add |
Start tracking a domain. |
| analytics set |
Change a site’s allowed origins, name or retention in days. |
| analytics check |
Why a site shows no traffic, without generating any: a stale key, a refused origin, the hourly quota, events blocked in the browser, or simply no visitors yet. |
| analytics stats |
Traffic for one site, or every site side by side when you omit the domain. |
| analytics search |
Google Search Console for a linked site: clicks, impressions, top queries and pages, pages that lost their impressions, and sitemap URLs Google has not indexed. Link a site first with |
| analytics gsc |
Link sites to Google Search Console. |
| analytics bing |
Bing Webmaster Tools. |
| analytics snippet |
The script tag to paste into the site’s |
| analytics verify |
Prove you own the domain with a DNS record — needed for an uptime check on it, not for analytics. Without |
| analytics rotate |
Issue a new site key. The old one keeps working for 30 days. |
| analytics rm |
Delete a site and every event recorded for it. |
GitHub
| Command | Usage and what it does |
|---|---|
| github repos |
Connected repositories, with the id |
| github sync |
Re-read the repositories of your connected GitHub installations. Run it after creating a repo so HostStack can see it. |
Support
| Command | Usage and what it does |
|---|---|
| report |
Report a fault in the platform to the HostStack team — not a bug in your own code. |
Config as code
Guide: hoststack.yaml.
| Command | Usage and what it does |
|---|---|
| init |
Write a starter |
| validate |
Check the |
Infrastructure operators
hoststack infra runs the operator steps of an infrastructure machine’s cutover and releases. It does not use your API key: it reads a token a HostStack operator mints for one project, from HOSTSTACK_INFRA_OPERATOR_TOKEN (hsiot_…) or the narrower HOSTSTACK_RELEASE_PLAN_TOKEN (hsrpt_…), and never saves either to the config file. Run hoststack infra for its commands.
Next steps
Was this page helpful?