Skip to Content
RcmadeDocs
Ray SecretsReferenceCLI ReferenceWorkspace

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 / OptionTypeDescription
-p, --project <id_or_name>stringTarget project ID or slug to link or query, bypassing interactive selection
-e, --env <name>(--environment <name>)stringTarget environment name (e.g. development, staging, production) to read or modify
-f, --file <path>stringPath to the source or destination .env file (defaults to .env in current directory)
-l, --localbooleanTarget local override file (.env.local) instead of default canonical .env file
--format <type>stringFile serialization format for exported secrets (env, json, yaml, csv, shell, docker)
--stdoutbooleanStream decrypted secret content directly to standard output without writing files to disk
--overwritebooleanForce overwrite of existing secrets or local files without interactive confirmation prompts
--template <path>stringCompare pulled secrets against a reference template file (e.g. .env.example) to identify missing keys
-b, --base(-t, --team)booleanFetch canonical team environment secrets, ignoring personal workstation overrides (recommended for CI/CD)
--offlinebooleanRun using encrypted local disk cache without connecting to the remote Ray Secrets API server
--dry-runbooleanSimulate command execution and preview changes without modifying remote vault or local filesystem
-s, --scope <path>stringSubdirectory path or workspace scope to target instead of auto-detecting from the working directory (e.g. apps/web or packages/backend)
--strict(--exit-code)booleanAbort execution immediately with an exit code if any required secret is missing, empty, or drifting
-q, --quietbooleanSilence banners, progress spinners, and status output; only print process output and critical errors
--cibooleanOptimize execution for headless CI/CD runners (disables spinners, prompts, colors, and update checks)
--jsonbooleanFormat 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 pull

2. Download personal developer overrides into .env.local

Downloads personal overrides into .env.local without touching canonical team configuration.

ray pull --local

3. 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.staging

4. 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 --stdout

5. 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 --strict

6. 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/api

Exit Codes

CodeMeaningRecommended Action
0Success. The command completed with no errors.None required.
1Runtime or execution failure. A child process returned non-zero status or a general error occurred.Inspect process output or run with --verbose.
2Authentication failed. Token is missing, expired, or invalid.Run `ray login` or update `RAY_TOKEN`.
3Configuration or binding error. Project or environment context was not found.Run `ray init` or specify `--project` and `--env`.
4Network 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.