env0 <command> --help to print the flags of the version you have installed. To install the CLI and run a first deployment, see env zero CLI.
Global flags and environment variables
Every command accepts these flags:
The CLI also reads these environment variables:
Each value resolves in this order: flag, then environment variable, then stored context, then default. In CI and agents, set the environment variables so each run is explicit and does not depend on stored state.
Sign-in and stored context
env0 login stores credentials and a default host, organization, and project, so later commands need no flags.
- Browser sign-in. With no API key set and a terminal attached,
loginopens a browser sign-in and asks you to confirm a short code.--no-browserprints the URL instead. - API key. When
--api-key-idand--api-key-secret(orENV0_API_KEY_IDandENV0_API_KEY_SECRET) are set,loginvalidates and stores that key. - No key and no terminal.
loginexits3. CI and agents should set the API key environment variables and skiplogin.
login then asks you to pick an organization and project. Without a terminal, it stores the --organization and --project you pass.
Credentials are stored in the OS keychain. If the keychain write fails, the CLI writes them to a plain-text file readable only by your user, prints a warning: line on stderr naming the file, and still exits 0. env0 logout removes that file.
Credentials are scoped to the API host they were issued for. Signing in to a second host does not sign you out of the first, and a host you have not signed in to exits 3 even when another host is authenticated. The host, organization, and project are stored once, in config.json, so switching hosts means running login again.
Browser sign-in works out which env zero tenant to use from the API host. For a host outside env0.com, it exits 64 unless you pass --tenant. API keys work against any host.
Output
Every command prints one JSON envelope, exceptenv0 skill show (raw Markdown) and env0 deployment logs --follow (a log stream). Data goes to stdout and errors go to stderr:
-o jsonprints indented JSON.-o compactprints the same JSON on one line, forjq.-o tableprints aligned columns.- On error, stdout is empty and the exit code is non-zero, so
env0 ... -o compact | jq .datais safe. - Arrays are always arrays. An empty result is
[], nevernullor a missing key. error.hostnames the host the CLI was pointed at. It is absent forusageerrors and for failures before a host is chosen. Credentials and paths are removed from it.
Pagination
environment list, deployment list, and plan list return at most 100 rows by default and add a page object next to data:
"truncated": true means more rows exist. Pass --all to fetch every page. --limit accepts 1 to 100.
organization list, project list, and template list are not paginated. They return the whole collection and take no --limit or --all.
Exit codes
With
--wait or deployment logs --follow, the exit code reflects the deployment’s final status:
The deployment is printed to stdout in both cases, including
failedCommand and errorMessage when it failed. WAITING_FOR_USER means the deployment needs approval, not that it failed.
context
.data.summary first, then .data.deployments, then deployment logs for the full error.
The output has these keys:
environment: the same objectenvironment getreturns.deployments: recent deployments, newest first.summary: drift status and the latest deployment’s status and type. When that deployment failed (FAILURE,INTERNAL_FAILURE, orTIMEOUT), it also carriesfailedCommand, a truncatederrorMessage, andexitCode. It carriescostEstimationwhen the environment has one.subEnvironments: for a workflow environment, each sub-environment’s alias, plus the revision and status of its latest deployment.
Organizations
organization list
org is an alias for organization.
organization get
organization use
Projects
project list
project get
project create
The new project does not become your stored project. Pass its id (
.data.id) as --project to later commands, or run env0 project use <project-id>. Requires permission to create projects in the organization.
project archive
project get and project list still return it with isArchived: true. The CLI cannot unarchive a project, and archiving a project cannot be undone.
project use
Templates
template list
64.
template get
template create
Requires permission to manage templates in the organization.
template assign
environment create --template only deploys templates assigned to the target project.
template delete
template list. template get can still return the record.
Environments
env is an alias for environment. Actions take an environment id, not a name.
environment list
All filters are optional and combine. The list does not include workflow sub-environments. To see them, run
context on the workflow environment.
environment get
tags, as {} when the environment has none.
environment create
--wait, its environmentId is the new environment’s id.
A
--repository environment gets a single-use template that needs no cleanup. When no cloud credential is assigned to the project, pass provider credentials as --secret, for example --secret AWS_ACCESS_KEY_ID=.... An assigned credential keeps keys out of your shell history and process list.
environment deploy
--manifest, --node, and --run-from-here are covered in Deploy workflows with the CLI.
environment destroy
--yes (or --force) and has no prompt. On an environment that requires approval, the destroy waits at WAITING_FOR_USER like any deployment.
environment archive
destroy first to remove them. See mark an environment as inactive.
environment tag list
{"team": ["eng", "payments"]}. Without one, prints every tag key and value used in the organization. tags is an alias for tag.
environment tag set
team=eng team=payments. Prints the updated environment.
environment tag remove
KEY=VALUE exits 64.
Tag limits and permissions are listed in Environment tags. Tags are visible to anyone who can view the environment, so do not put secrets in them.
environment ttl set
ttl set <environment-id> 2h can bring the end forward. The minimum is 1h. Read the new end from lifespanEndAt in the output: env zero truncates it to the minute.
environment ttl extend
2. extend reads the current end and then writes a new one, so a TTL change someone makes in between is overwritten.
environment ttl clear
lifespanEndAt disappears from the output. For default and maximum TTLs, see Configure policy TTL.
Waiting for a deployment
--wait polls the deployment until it reaches a final status, then exits with the code for that status. It retries 5xx and 429 responses. A deployment that reaches WAITING_FOR_USER stops the wait with exit 0. Approve it with deployment approve.
While it waits, the deployment’s step logs stream to stderr. Stdout still receives only the final deployment, so --wait -o compact | jq works. Logs keep their color on a terminal and lose it when redirected. Secrets are redacted before the logs reach the CLI.
Deployments
deployment list
deployment get
errorMessage, failedCommand, and exitCode for a failed deployment.
deployment logs
--follow, prints the deployment’s captured output and full errorMessage, with color codes removed. Use it for the root cause of a failure.
With --follow (-f), streams the logs to stdout until the deployment finishes, then exits like --wait. The stream is text grouped by step. With -o json or -o compact it is newline-delimited JSON, one {"step", "level", "message", "timestamp"} object per line, with no envelope. --poll-interval defaults to 3s.
deployment approve
WAITING_FOR_USER. The status changes a few seconds later. Approving a deployment that has already moved on exits 2 and is harmless. Approval rights do not approve your own deployments automatically.
deployment cancel
QUEUED deployment, or rejects one at WAITING_FOR_USER.
deployment abort
IN_PROGRESS deployment.
approve, cancel, and abort return right away and take no --wait. To follow a resumed deployment, poll deployment get until its status leaves WAITING_FOR_USER, then run deployment logs <deployment-id> --follow.
Plans
plan list
plan get
planAvailable first: most deployments, including those at WAITING_FOR_USER, store no plan. With no plan, resourceChanges and outputChanges are [], the same as a plan with no changes.
resourceChanges[].actionshowsdeleteandrecreateonly when a plan is stored.- The deployment’s
planSummarycounts can be higher than the entries inresourceChanges. UseresourceChangesfor the actual resources. - To see what drifted, run
plan geton the latest deployment withtypedriftDetection. See Drift detection.
Cost estimation
environment get, context (under summary), plan get, and deployment get include costEstimation: totalMonthlyCost and the deployment’s monthlyCostDiff, as numbers with no currency. The table output assumes USD. The field is null when cost estimation is off for the organization or the deployment produced no estimate.
Variables
variable list
var is an alias for variable.
VCS connections
vcs list
id as --vcs-connection-id to template create or environment create for a private repository. Its accessScope, for example Organization:acme, must cover the repository’s owner. --type filters by provider, for example GitHub or GitLab.
API keys
The CLI manages two kinds of API key:
Use an organization key for shared CI. Use a personal key on your own machine, or when actions must be attributed to you.
Both
create commands print apiKeySecret once. No command returns it again. The returned apiKeyId and apiKeySecret are the values for ENV0_API_KEY_ID and ENV0_API_KEY_SECRET. Keys do not expire.
api-key list
lastUsedAt. Custom roles show as their id.
api-key create
No command shows a key’s project roles after creation.
api-key revoke
id field from api-key list, which looks like auth0|abc123, not the apiKeyId field. Quote it, because | is a shell pipe. Revoking cannot be undone. The key leaves the list at once but can keep authenticating for a short time afterwards. --force is an alias for --yes.
personal-api-key list
personal-api-key create
personal-api-key revoke
id field, not apiKeyId. Another user’s key id exits 4.
Sign-in commands
login
See Sign-in and stored context.
status
0. Check .data.authenticated, not the exit code.
logout
Agent skill
skill install
AGENTS.md and the Copilot file are edited only between managed markers, so the rest of the file is kept. Running install again is safe. --global installs in your home directory, for claude and codex. --path writes to a file or directory you choose.
skill show
-o.
skill uninstall
Other commands
Telemetry
The CLI sends anonymous usage events and request traces: the command, output format, detected agent or CI system, authentication method, error type, exit code, CLI version, and organization id. Events use a random per-install id. They never include credentials, arguments, output, resource names or ids, or file paths. Telemetry never blocks or fails a command. To turn off both telemetry and tracing, setENV0_TELEMETRY_DISABLED=1 or DO_NOT_TRACK=1. env0 status shows whether each is on.
Next steps
- env zero CLI - Install the CLI, sign in, and run a first deployment.
- Deploy workflows with the CLI - Deploy workflow sub-environments with per-sub-environment branches and variables.
- CLI troubleshooting - Fix common errors and unexpected results.