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
| Argument | Required | Description |
|---|---|---|
[key] | Optional | The secret key name to inspect, decrypt, or copy (e.g. DATABASE_URL). |
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 |
-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) |
--search <query>(--query <query>) | string | Filter secret keys by case-insensitive substring match (e.g. --search DB_) |
-r, --raw(--plain) | boolean | Print the raw secret string to stdout without headers, colors, or newline formatting |
--copy | boolean | Copy decrypted secret value directly to the system clipboard |
--reveal | boolean | Display plaintext secret values in the terminal table instead of masking characters |
-b, --base(-t, --team) | boolean | Fetch canonical team environment secrets, ignoring personal workstation overrides (recommended for CI/CD) |
-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. 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_URL2. Reveal plaintext secret value in terminal output
Fetches and displays the unmasked plaintext value directly in the console output.
ray get DATABASE_URL --reveal3. 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 --raw4. 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 --copy5. Output secret details formatted as structured JSON
Emits machine-readable JSON containing the secret key, value, environment, and version metadata.
ray get DATABASE_URL --jsonExit 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.