Skip to main content

CLI Commands

Complete reference for all szc commands.

Global Flags​

These flags are available on all commands:

--output, -o     Output format: table, json, yaml, quiet (default: table)
--json Select specific JSON fields (e.g., --json id,name,status)
--config Config file (default: ~/.szc/config.yaml)
--profile Named profile to use

Authentication​

szc auth login​

Authenticate with Sparbz Cloud.

szc auth login [flags]

Flags:
--api-key string API key for non-interactive login
--no-browser Don't open browser, show URL instead

szc auth logout​

Log out and clear credentials.

szc auth logout

szc auth whoami​

Display current user information.

szc auth whoami

Databases​

Manage fully managed databases (PostgreSQL, MySQL, MongoDB, Redis).

szc database create​

Create a new database instance.

szc database create [flags]

Flags:
-n, --name string Database name (required)
-t, --type string Database type: postgres, mysql, mongodb, redis (default: postgres)
-s, --size string Size: small, medium, large, xlarge (default: medium)
-v, --version string Database version
--if-not-exists Return success if database already exists
--dry-run Preview what would happen without executing
--watch Watch provisioning progress

Aliases: db

Examples:
szc database create --name mydb --type postgres --size medium
szc database create --name cache --type redis --size small
szc db create -n myapp -t mysql -s large --version 8.0

szc database list​

List all databases.

szc database list [flags]

Aliases: ls

Examples:
szc database list
szc database list --output json
szc db ls --json id,name,status

szc database get​

Get database details.

szc database get <id>

Examples:
szc database get a1b2c3d4
szc db get a1b2c3d4 --json id,status,endpoint

szc database credentials​

Get database connection credentials.

szc database credentials <id> [flags]

Flags:
--env Output as environment variables

Examples:
szc database credentials a1b2c3d4
szc database credentials a1b2c3d4 --env
eval $(szc db credentials a1b2c3d4 --env)

szc database delete​

Delete a database.

szc database delete <id> [flags]

Flags:
-f, --force Skip confirmation prompt
--dry-run Preview what would happen
--batch Read IDs from file (use '-' for stdin)
--parallel Number of parallel operations for batch mode

Examples:
szc database delete a1b2c3d4
szc database delete a1b2c3d4 --force
echo '["id1","id2"]' | szc database delete --batch -

Namespaces​

Manage Kubernetes namespaces.

szc namespace create​

Create a new namespace.

szc namespace create [flags]

Flags:
-n, --name string Namespace name (required)
--tier string Tier: free, starter, pro, enterprise (default: free)
--if-not-exists Return success if namespace already exists
--dry-run Preview what would happen
--watch Watch provisioning progress

Aliases: ns

Examples:
szc namespace create --name my-app
szc ns create -n production --tier pro

szc namespace list​

List all namespaces.

szc namespace list

Examples:
szc namespace list
szc ns list --output json

szc namespace get​

Get namespace details.

szc namespace get <id>

Examples:
szc namespace get a1b2c3d4
szc ns get a1b2c3d4 --json status,resources

szc namespace kubeconfig​

Get kubeconfig for a namespace.

szc namespace kubeconfig <id> [flags]

Flags:
--merge Merge into existing kubeconfig
--output Write to file instead of stdout

Examples:
szc namespace kubeconfig a1b2c3d4
szc namespace kubeconfig a1b2c3d4 --merge
szc ns kubeconfig a1b2c3d4 > ~/.kube/my-namespace.yaml

szc namespace delete​

Delete a namespace.

szc namespace delete <id> [flags]

Flags:
-f, --force Skip confirmation prompt
--dry-run Preview what would happen

Storage​

Manage S3-compatible object storage buckets.

szc storage create​

Create a storage bucket.

szc storage create [flags]

Flags:
-n, --name string Bucket name (required)
--public Make bucket publicly readable
--if-not-exists Return success if bucket already exists
--dry-run Preview what would happen

Examples:
szc storage create --name my-assets
szc storage create -n public-files --public

szc storage list​

List all buckets.

szc storage list

Examples:
szc storage list
szc storage list --output json

szc storage get​

Get bucket details.

szc storage get <id>

szc storage credentials​

Get S3 credentials for a bucket.

szc storage credentials <id> [flags]

Flags:
--env Output as environment variables

Examples:
szc storage credentials a1b2c3d4
eval $(szc storage credentials a1b2c3d4 --env)

szc storage delete​

Delete a bucket.

szc storage delete <id> [flags]

Flags:
-f, --force Skip confirmation prompt

Registry​

Manage container registries.

szc registry create​

Create a container registry.

szc registry create [flags]

Flags:
-n, --name string Registry name (required)
--public Make registry publicly pullable
--if-not-exists Return success if registry already exists

Examples:
szc registry create --name my-images
szc registry create -n public-images --public

szc registry list​

List all registries.

szc registry list

szc registry get​

Get registry details.

szc registry get <id>

szc registry credentials​

Get registry credentials.

szc registry credentials <id> [flags]

Flags:
--env Output as environment variables
--docker Output as docker login command

Examples:
szc registry credentials a1b2c3d4
eval $(szc registry credentials a1b2c3d4 --docker)

szc registry delete​

Delete a registry.

szc registry delete <id> [flags]

Flags:
-f, --force Skip confirmation prompt

Kafka​

Manage Apache Kafka clusters.

szc kafka cluster create​

Create a Kafka cluster.

szc kafka cluster create [flags]

Flags:
-n, --name string Cluster name (required)
--size string Size: small, medium, large (default: small)
--version string Kafka version (default: 3.7.0)
--if-not-exists Return success if cluster already exists
--watch Watch provisioning progress

Examples:
szc kafka cluster create --name events
szc kafka cluster create -n logs --size medium

szc kafka cluster list​

List Kafka clusters.

szc kafka cluster list

szc kafka cluster get​

Get Kafka cluster details.

szc kafka cluster get <id>

szc kafka cluster delete​

Delete a Kafka cluster.

szc kafka cluster delete <id> [flags]

Flags:
-f, --force Skip confirmation prompt

szc kafka topic create​

Create a topic in a cluster.

szc kafka topic create [flags]

Flags:
--cluster string Cluster ID (required)
-n, --name string Topic name (required)
--partitions int Number of partitions (default: 3)
--replication int Replication factor (default: 2)

Examples:
szc kafka topic create --cluster abc123 --name events --partitions 6

szc kafka topic list​

List topics in a cluster.

szc kafka topic list --cluster <id>

szc kafka topic delete​

Delete a topic.

szc kafka topic delete <topic-id> [flags]

Flags:
-f, --force Skip confirmation prompt

szc kafka user create​

Create a Kafka user for authentication.

szc kafka user create [flags]

Flags:
--cluster string Cluster ID (required)
-n, --name string Username (required)

Examples:
szc kafka user create --cluster abc123 --name producer-app

szc kafka user list​

List Kafka users.

szc kafka user list --cluster <id>

szc kafka credentials​

Get Kafka connection credentials.

szc kafka credentials <cluster-id> [flags]

Flags:
--env Output as environment variables

Vault​

Manage HashiCorp Vault secrets.

szc vault secret set​

Store a secret in Vault.

szc vault secret set <path> [flags]

Flags:
--key string Secret key name
--value string Secret value
--file string Read value from file
--json Store JSON object

Examples:
szc vault secret set apps/myapp/db --key password --value secret123
szc vault secret set apps/myapp/config --file config.json --json

szc vault secret get​

Retrieve a secret from Vault.

szc vault secret get <path> [flags]

Flags:
--key string Specific key to retrieve (optional)
--version int Secret version (default: latest)

Examples:
szc vault secret get apps/myapp/db
szc vault secret get apps/myapp/db --key password

szc vault secret list​

List secrets at a path.

szc vault secret list <path>

Examples:
szc vault secret list apps/myapp/

szc vault secret delete​

Delete a secret.

szc vault secret delete <path> [flags]

Flags:
-f, --force Skip confirmation prompt

Stacks​

Infrastructure as Code deployments.

szc stack create​

Create a new stack from a template.

szc stack create [flags]

Flags:
-n, --name string Stack name (required)
-f, --file string Template file (required)
--dry-run Preview what would be created

Examples:
szc stack create --name my-app --file stack.yaml
szc stack create -n production -f prod-stack.yaml --dry-run

szc stack list​

List all stacks.

szc stack list

szc stack get​

Get stack details.

szc stack get <id>

szc stack apply​

Apply stack changes.

szc stack apply <id> [flags]

Flags:
--watch Watch deployment progress

Examples:
szc stack apply abc123
szc stack apply abc123 --watch

szc stack plan​

Preview stack changes (dry-run).

szc stack plan <id>

Examples:
szc stack plan abc123

szc stack outputs​

Get stack outputs.

szc stack outputs <id>

Examples:
szc stack outputs abc123
szc stack outputs abc123 --json api_endpoint,db_host

szc stack destroy​

Destroy a stack and all its resources.

szc stack destroy <id> [flags]

Flags:
-f, --force Skip confirmation prompt

Examples:
szc stack destroy abc123
szc stack destroy abc123 --force

VPC​

Manage Virtual Private Clouds.

szc vpc create​

Create a VPC.

szc vpc create [flags]

Flags:
-n, --name string VPC name (required)
--cidr string CIDR block (default: 10.0.0.0/16)
--if-not-exists Return success if VPC already exists

Examples:
szc vpc create --name production
szc vpc create -n staging --cidr 10.1.0.0/16

szc vpc list​

List VPCs.

szc vpc list

szc vpc get​

Get VPC details.

szc vpc get <id>

szc vpc delete​

Delete a VPC.

szc vpc delete <id> [flags]

Flags:
-f, --force Skip confirmation prompt

NFS​

Manage NFS storage volumes.

szc nfs create​

Create an NFS volume.

szc nfs create [flags]

Flags:
-n, --name string Volume name (required)
--size string Size (e.g., 10Gi, 100Gi) (required)
--if-not-exists Return success if volume already exists

Examples:
szc nfs create --name shared-data --size 50Gi

szc nfs list​

List NFS volumes.

szc nfs list

szc nfs get​

Get NFS volume details.

szc nfs get <id>

szc nfs resize​

Resize an NFS volume.

szc nfs resize <id> --size <new-size>

Examples:
szc nfs resize abc123 --size 100Gi

szc nfs delete​

Delete an NFS volume.

szc nfs delete <id> [flags]

Flags:
-f, --force Skip confirmation prompt

Backups​

Manage backup schedules and snapshots.

szc backup create​

Create a backup.

szc backup create [flags]

Flags:
--resource-type string Resource type: database, namespace, storage
--resource-id string Resource ID to backup
-n, --name string Backup name

Examples:
szc backup create --resource-type database --resource-id abc123 --name daily-backup

szc backup list​

List backups.

szc backup list [flags]

Flags:
--resource-id string Filter by resource ID

szc backup restore​

Restore from a backup.

szc backup restore <backup-id> [flags]

Flags:
--target-name string Name for restored resource

Examples:
szc backup restore backup123 --target-name restored-db

szc backup delete​

Delete a backup.

szc backup delete <id> [flags]

Flags:
-f, --force Skip confirmation prompt

Organizations​

Manage organizations.

szc organization list​

List organizations you belong to.

szc organization list

Aliases: org

szc organization get​

Get organization details.

szc organization get <id>

szc organization switch​

Switch active organization context.

szc organization switch <id>

Examples:
szc org switch abc123

Projects​

Manage projects within an organization.

szc project create​

Create a project.

szc project create [flags]

Flags:
-n, --name string Project name (required)
-d, --description string Project description

Examples:
szc project create --name backend-services

szc project list​

List projects.

szc project list

szc project get​

Get project details.

szc project get <id>

szc project delete​

Delete a project.

szc project delete <id> [flags]

Flags:
-f, --force Skip confirmation prompt

API Keys​

Manage API keys for programmatic access.

szc apikey create​

Create an API key.

szc apikey create [flags]

Flags:
-n, --name string Key name (required)
--expires-in string Expiration duration (e.g., 30d, 1y)
--scopes string Comma-separated scopes

Examples:
szc apikey create --name ci-deploy --expires-in 90d
szc apikey create -n readonly --scopes read:databases,read:namespaces

szc apikey list​

List API keys.

szc apikey list

szc apikey revoke​

Revoke an API key.

szc apikey revoke <id>

Examples:
szc apikey revoke abc123

Billing​

View billing and usage information.

szc billing usage​

View current usage.

szc billing usage [flags]

Flags:
--month string Month to view (YYYY-MM format)

Examples:
szc billing usage
szc billing usage --month 2024-01

szc billing invoices​

List invoices.

szc billing invoices

szc billing subscription​

View subscription details.

szc billing subscription

Logs​

View logs from resources.

szc logs​

Stream logs from a resource.

szc logs <resource-type> <resource-id> [flags]

Flags:
-f, --follow Follow log output
--tail int Number of lines to show (default: 100)
--since string Show logs since duration (e.g., 5m, 1h)

Examples:
szc logs namespace abc123 -f
szc logs database def456 --tail 500 --since 1h

Agent-Friendly Features​

The CLI includes features designed for automation and AI agents:

Idempotent Operations​

Use --if-not-exists for safe retries:

szc database create --name mydb --if-not-exists
# Returns success and existing resource if already created

Dry Run​

Preview changes before executing:

szc database create --name mydb --dry-run
szc stack apply abc123 --dry-run

JSON Field Selection​

Select specific fields for parsing:

szc database list --json id,name,status
szc namespace get abc123 --json status,endpoint

Batch Operations​

Process multiple resources at once:

echo '["id1","id2","id3"]' | szc database delete --batch - --parallel 3

Watch Mode​

Monitor long-running operations:

szc database create --name mydb --watch
szc stack apply abc123 --watch

Structured Exit Codes​

CodeMeaning
0Success
1General error
2Invalid input
3Resource not found
4Conflict (already exists)
5Permission denied
6Timeout
7Rate limited