Automate with the Coolify CLI

The CLI supports multiple Coolify instances, structured output, and nonzero exit statuses for failed commands. These features let scripts and CI jobs inspect resources and start deployments without parsing human-readable tables.

Configure separate contexts

Save a context for each Coolify instance:

coolify context add production https://coolify.example.com <production-token>
coolify context add staging https://staging-coolify.example.com <staging-token>
coolify context use production

Use another context for one command without changing the default:

coolify --context staging resource list

Verify every context before using it in automation:

coolify --context production context verify
coolify --context staging context verify

Request structured output

Use compact JSON for scripts:

coolify --format json resource list

Use formatted JSON while developing or debugging a script:

coolify --format pretty deploy list

table is the default for interactive terminal use. Do not parse table columns in automation because their display can change.

Deploy several resources

Start a batch deployment with comma-separated resource names:

coolify --context production deploy batch api,worker,frontend

Add --force only when every named resource must deploy without detected changes:

coolify --context production deploy batch api,worker,frontend --force

Verify the resulting deployments:

coolify --context production --format json deploy list

Handle failures safely

A failed CLI command returns a nonzero exit status, so shell scripts and CI jobs can stop immediately:

set -e

coolify --context production context verify
coolify --context production deploy name api

Keep these restrictions in automated environments:

  • Store API tokens in the CI secret manager, not in repository files or command arguments.
  • Do not use --show-sensitive in shared logs.
  • Use --debug only during diagnosis because it adds operational details to output.
  • Give the context token only the permissions required by the job.

On this page