DBHost CLI is published as @dbhost-app/cli for Pro and Business accounts.
Install
Run the CLI directly with npx:
Or install it globally:
DBHost CLI supports macOS and Linux with Node.js 18 or later.
Authenticate
Create an API key from Settings in the dashboard, then log in:
The CLI stores the API key locally so you do not need to pass it on every command.
Paid plans support two API key scopes:
Selected databases limits the key to only the databases you choose
Full account access can create and manage every database in your account
Selected databases is the recommended default. A Full account access key is required for database creation, collaborator/member/invitation administration, and webhook administration.
Selected-database keys only list the databases they can access. If you use a database-specific command against an out-of-scope database, the API responds as if the resource were missing.
If you prefer environment variables:
Local tests and smoke runs for mutating commands must set DBHOST_API_URL to
an explicit local test server. They fail closed rather than using the
production default. This rule does not authorize a production CLI mutation.
Common commands
List databases:
Use the id column from the list output with dbhost databases get <id>.
Create a database:
Or pass the display name as the second argument:
Trigger a backup:
Download a backup file:
Delete a backup file:
Reset a database password:
Repair ownership after a pg_dump restore (fixes permission denied from the app role):
Wait for an asynchronous operation:
Manage lifecycle and environment metadata:
Use dbhost backups list <database-id> to discover the filename value before you download or delete a specific backup. Downloads save to ./<filename> by default; pass --output to write the file somewhere else.
JSON output
Add --json to any command for machine-readable output:
Supported commands
dbhost auth login [--api-key KEY] [--base-url URL]
dbhost auth logout
dbhost databases list [--json]
dbhost databases get <id> [--json]
dbhost databases create <name> [display-name] [--display-name "My App"] [--json]
dbhost databases start|stop|restart <id> [--json]
dbhost databases environment <id> <production|staging|development|other|none> [--json]
dbhost databases reset-password <id> [--json]
dbhost databases repair-ownership <id> [--json]
dbhost backups list <database-id> [--json]
dbhost backups trigger <database-id> [--no-wait] [--json]
dbhost backups download <database-id> <filename> [--output PATH] [--json]
dbhost backups delete <database-id> <filename> [--yes] [--json]
dbhost operations get|wait <operation-id> [--timeout SECONDS] [--json]
dbhost network list <database-id> [--json]
dbhost network add <database-id> <cidr> [label] [--json]
dbhost network remove <database-id> <entry-id> [--json]
dbhost members list <database-id> [--json]
dbhost members add <database-id> <email> <admin|developer|viewer> [--json]
dbhost members update <database-id> <membership-id> <role> [--json]
dbhost members remove <database-id> <membership-id> [--json]
dbhost invitations list <database-id> [--json]
dbhost invitations resend|revoke <database-id> <invitation-id> [--json]
dbhost webhooks list [--json]
dbhost webhooks create <https-url> [database-id] [--json]
dbhost webhooks rotate|disable <webhook-id> [--json]