CLI reference
Every command runs with npx. No install, no SDK.
Last updated: 2026-09-20
Global options
Auth: npx getmyenv login (paste a dashboard CLI token once), or paste when a command asks. Commands that talk to the API accept --api-url. Default is https://getmyenv.com.
npx getmyenv login
# Optional localhost API
npx getmyenv login --api-url http://localhost:3000
npx getmyenv status --api-url http://localhost:3000login
Paste a dashboard CLI token and save it on this machine. Later commands reuse it. If env files are found, login may ask to run migrate next. Use logout to clear the token.
npx getmyenv login
npx getmyenv login --api-url http://localhost:3000
npx getmyenv logoutinit
Scan the current directory for expected environment variable names. Writes .getmyenv/requirements.json (names only). Does not create a remote project. When a linked project is set, also creates dashboard placeholders for those names (both environments). Asks for a CLI token if none is saved yet.
npx getmyenv initmigrate
Read a local env file, encrypt each value, create a project if needed, and upload them as secrets. Searches under this folder for .env* (including sample/example files) and lists candidates when there are several. Use --file for an explicit path. Environments are lowercase: development or production. If the project already exists in the dashboard, use link instead.
npx getmyenv migrate
npx getmyenv migrate --file .env.production -e productionlink
Point this folder at an existing hosted project. Lists your projects and writes local link metadata so run, export, status, and add work without running migrate.
npx getmyenv link
npx getmyenv link <projectId>
npx getmyenv link --name my-app
npx getmyenv unlinkadd
Add a single secret, or bulk-import every KEY=VALUE from an env file with --from. When several .env* files exist and you omit --from with no name, the CLI lists them and asks which to use. Requires a linked project (link or migrate).
npx getmyenv add OPENAI_API_KEY
npx getmyenv add --from .env
npx getmyenv add --from .env.production -e productionstatus
Compare local requirements to secrets on the server for the selected environment. Placeholders (no value yet) show as not ready.
npx getmyenv status
npx getmyenv status -e productionrun
Run a command with secrets injected as environment variables. Your code still reads environment variables the usual way. No SDK, no code changes.
# Node
npx getmyenv run -- npm start
npx getmyenv run -- node server.js
# Python
npx getmyenv run -- python app.py
# Ruby
npx getmyenv run -- ruby app.rb
# Rust
npx getmyenv run -- cargo run
# Go
npx getmyenv run -- go run .
# PHP
npx getmyenv run -- php app.phpexport
Same job as dashboard Export with plain .env. Writes a plaintext file. Prompts for your Vault password. Use -o for the path (default .env). Do not redirect stdout.
npx getmyenv export -o .env
npx getmyenv export -e production -o .env.productionbackup
Same job as dashboard Export with encrypted .getmyenv. Writes ciphertext and the wrapped key. No Vault password prompt when creating the file. Use -o for the path.
npx getmyenv backup -o project.getmyenvrestore
Same job as dashboard Restore on Projects. Reads an encrypted .getmyenv file. Prompts for the Vault password used for that backup. With a linked project in the current directory, secrets are restored into that project; otherwise a project is created.
npx getmyenv restore project.getmyenv