ray delete
Delete one or more secrets from an environment
Delete one or more secrets from an environment
Synopsis
ray delete [options] [keys...]Positional Arguments
| Argument | Required | Description |
|---|---|---|
[keys...] | Optional | One or more secret key names to delete from the environment vault (e.g. TEMP_TOKEN). |
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) |
-o, --override | boolean | Save or update secrets as personal developer overrides without modifying shared team values |
-y, --yes(--force) | boolean | Automatically answer yes to all confirmation prompts (ideal for automated CI/CD scripts) |
--sync-local | boolean | Synchronize the updated secret value into the corresponding local .env file on disk |
--dry-run | boolean | Simulate command execution and preview changes without modifying remote vault or local filesystem |
-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. Delete a single secret key with confirmation prompt
Prompts for confirmation before permanently deleting the secret from the remote vault.
ray delete TEMP_KEY2. Delete multiple secret keys in a single invocation
Deletes a batch of secrets from the target environment in one command.
ray delete OLD_KEY_1 OLD_KEY_23. Non-interactive deletion for CI/CD automation
Bypasses the confirmation prompt for automated scripts and headless runners.
ray delete STALE_TOKEN --yes4. Clear personal developer override, restoring shared team value
Removes your personal override, immediately restoring the shared team base secret.
ray delete DATABASE_URL --override5. Delete secret from remote vault and purge from local .env file
Deletes the secret remotely and synchronizes the change to local disk files.
ray delete DEPRECATED_SECRET --sync-localExit 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.