Skip to Content
RcmadeDocs
Ray SecretsReferenceCLI ReferenceSecrets

ray get

Fetch and display or extract a secret value by key

Fetch and display or extract a secret value by key

Synopsis

ray get [options] [key]

Positional Arguments

ArgumentRequiredDescription
[key]OptionalThe secret key name to inspect, decrypt, or copy (e.g. DATABASE_URL).

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
-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)
--search <query>(--query <query>)stringFilter secret keys by case-insensitive substring match (e.g. --search DB_)
-r, --raw(--plain)booleanPrint the raw secret string to stdout without headers, colors, or newline formatting
--copybooleanCopy decrypted secret value directly to the system clipboard
--revealbooleanDisplay plaintext secret values in the terminal table instead of masking characters
-b, --base(-t, --team)booleanFetch canonical team environment secrets, ignoring personal workstation overrides (recommended for CI/CD)
-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. Fetch and display a masked secret in terminal table

Retrieves a single secret by key name and prints it in a masked format.

ray get DATABASE_URL

2. Reveal plaintext secret value in terminal output

Fetches and displays the unmasked plaintext value directly in the console output.

ray get DATABASE_URL --reveal

3. Output raw secret string for shell scripting and pipes

Prints only the raw decrypted secret string with no formatting, perfect for subshell evaluation.

ray get API_KEY --raw

4. Copy decrypted secret value directly to system clipboard

Places the decrypted value on the OS clipboard without printing plaintext to the terminal.

ray get STRIPE_SECRET --copy

5. Output secret details formatted as structured JSON

Emits machine-readable JSON containing the secret key, value, environment, and version metadata.

ray get DATABASE_URL --json

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.