ray pull
Download decrypted secrets for an environment and save them to a file or stdout
Download decrypted secrets for an environment and save them to a file or stdout
Synopsis
ray pull [options]Flags & Options
| Flag / Option | Type | Description |
|---|---|---|
-p, --project <id_or_name> | string | Target project ID or slug to link or query, bypassing interactive selection |
-e, --env <name>(--environment <name>) | string | Target environment name (e.g. development, staging, production) to read or modify |
-f, --file <path> | string | Path to the source or destination .env file (defaults to .env in current directory) |
-l, --local | boolean | Target local override file (.env.local) instead of default canonical .env file |
--format <type> | string | File serialization format for exported secrets (env, json, yaml, csv, shell, docker) |
--stdout | boolean | Stream decrypted secret content directly to standard output without writing files to disk |
--overwrite | boolean | Force overwrite of existing secrets or local files without interactive confirmation prompts |
--template <path> | string | Compare pulled secrets against a reference template file (e.g. .env.example) to identify missing keys |
-b, --base(-t, --team) | boolean | Fetch canonical team environment secrets, ignoring personal workstation overrides (recommended for CI/CD) |
--offline | boolean | Run using encrypted local disk cache without connecting to the remote Ray Secrets API server |
--dry-run | boolean | Simulate command execution and preview changes without modifying remote vault or local filesystem |
-s, --scope <path> | string | Subdirectory path or workspace scope to target instead of auto-detecting from the working directory (e.g. apps/web or packages/backend) |
--strict(--exit-code) | boolean | Abort execution immediately with an exit code if any required secret is missing, empty, or drifting |
-q, --quiet | boolean | Silence banners, progress spinners, and status output; only print process output and critical errors |
--ci | boolean | Optimize execution for headless CI/CD runners (disables spinners, prompts, colors, and update checks) |
--json | boolean | Format command output as structured JSON for scripting, automation, and piping |
Common Examples
1. Download decrypted secrets to default .env file
Fetches decrypted environment secrets and non-destructively merges them into .env, preserving local comments.
ray pull2. Download personal developer overrides into .env.local
Downloads personal overrides into .env.local without touching canonical team configuration.
ray pull --local3. Target specific environment and custom output file
Downloads staging secrets and writes them to a dedicated .env.staging file.
ray pull --env staging --file .env.staging4. Stream JSON output to stdout for automation pipelines
Emits formatted JSON directly to stdout without writing files to disk, ideal for piping into jq or containers.
ray pull --format json --stdout5. Strict template verification against .env.example in CI/CD
Verifies that all required keys declared in .env.example exist remotely, exiting with code 1 if any key is missing.
ray pull --template .env.example --strict6. Download secrets scoped to a specific microservice directory
Filters downloaded secrets to only include variables scoped to a specific application or package folder.
ray pull --scope apps/apiExit Codes
| Code | Meaning | Recommended Action |
|---|---|---|
| 0 | Success. The command completed with no errors. | None required. |
| 1 | Runtime or execution failure. A child process returned non-zero status or a general error occurred. | Inspect process output or run with --verbose. |
| 2 | Authentication failed. Token is missing, expired, or invalid. | Run `ray login` or update `RAY_TOKEN`. |
| 3 | Configuration or binding error. Project or environment context was not found. | Run `ray init` or specify `--project` and `--env`. |
| 4 | Network or API failure. Failed to reach the Ray Secrets vault. | Check internet connection or run `ray doctor`. |
Ready to eliminate plaintext secrets?
Create a workspace to organize environments, invite your team, and generate scoped Service Tokens for CI/CD.