> ## Documentation Index
> Fetch the complete documentation index at: https://private-7c7dfe99-mintlify-8c05c8a2.mintlify.site/llms.txt
> Use this file to discover all available pages before exploring further.

# ClickHouse CLI

> Use the ClickHouse CLI to manage ClickHouse Cloud services and local ClickHouse instances

The ClickHouse CLI (`clickhousectl`) is a unified command-line tool for managing ClickHouse Cloud resources and local development with ClickHouse. It also manages [ClickHouse Cloud Postgres](/products/managed-postgres/overview) services.

<h2 id="installation">
  Installation
</h2>

```bash theme={null}
curl https://clickhouse.com/cli | sh
```

A `chctl` alias is also created automatically for convenience.

<h2 id="cloud-management">
  Cloud management
</h2>

Authenticate with ClickHouse Cloud and manage your services directly from the command line.

<h3 id="authentication">
  Authentication
</h3>

```bash theme={null}
clickhousectl cloud auth
```

This prompts for your API key and secret, and saves them to `.clickhouse/credentials.json` (project-local, git-ignored).

You can also use environment variables:

```bash theme={null}
export CLICKHOUSE_CLOUD_API_KEY=your-key
export CLICKHOUSE_CLOUD_API_SECRET=your-secret
```

<h3 id="services">
  Services
</h3>

```bash theme={null}
# List services
clickhousectl cloud service list

# Create a service
clickhousectl cloud service create --name my-service \
  --provider aws \
  --region us-east-1

# Get service details
clickhousectl cloud service get <service-id>

# Scale a service
clickhousectl cloud service scale <service-id> \
  --min-replica-memory-gb 24 \
  --max-replica-memory-gb 48 \
  --num-replicas 3

# Start/stop a service
clickhousectl cloud service start <service-id>
clickhousectl cloud service stop <service-id>

# Delete a service
clickhousectl cloud service delete <service-id>
```

<h3 id="postgres-services">
  Postgres services (beta)
</h3>

Create and manage [ClickHouse Cloud Postgres](/products/managed-postgres/overview) services.

```bash theme={null}
# List Postgres services
clickhousectl cloud postgres list

# Create a Postgres service
clickhousectl cloud postgres create \
  --name my-pg \
  --region us-east-1 \
  --size c6gd.xlarge \
  --pg-version 18

# Get service details
clickhousectl cloud postgres get <pg-id>

# Update a service
clickhousectl cloud postgres update <pg-id> --size c6gd.2xlarge --add-tag env=prod

# Reset the password
clickhousectl cloud postgres reset-password <pg-id> --generate

# Read replicas and point-in-time restore
clickhousectl cloud postgres read-replica create <pg-id> --name replica-1
clickhousectl cloud postgres restore <pg-id> --name restored --restore-target 2026-04-16T12:00:00Z

# Delete a service
clickhousectl cloud postgres delete <pg-id>
```

<h3 id="organizations">
  Organizations
</h3>

```bash theme={null}
clickhousectl cloud org list
clickhousectl cloud org get <org-id>
```

<h3 id="api-keys">
  API keys
</h3>

```bash theme={null}
clickhousectl cloud key list
clickhousectl cloud key create --name ci-key --role-id <role-id>
clickhousectl cloud key delete <key-id>
```

<h3 id="members-and-invitations">
  Members and invitations
</h3>

```bash theme={null}
clickhousectl cloud member list
clickhousectl cloud invitation create --email dev@example.com --role-id <role-id>
```

<h3 id="backups">
  Backups
</h3>

```bash theme={null}
clickhousectl cloud backup list <service-id>
clickhousectl cloud backup get <service-id> <backup-id>
```

<h3 id="json-output">
  JSON output
</h3>

Use the `--json` flag to get JSON-formatted responses from any cloud command:

```bash theme={null}
clickhousectl cloud --json service list
```

<h2 id="local-development">
  Local development
</h2>

The CLI also manages local ClickHouse installations and servers. See the [clickhousectl (CLI)](/get-started/setup/self-managed/clickhousectl) page for getting started with local development.

<h2 id="requirements">
  Requirements
</h2>

* macOS (aarch64, x86\_64) or Linux (aarch64, x86\_64)
* Cloud commands require a [ClickHouse Cloud API key](/products/cloud/features/admin-features/api/openapi)
