railway delete commands accept --2fa-code for non-interactive verification
Introduced 2026-01-26 · score 0.95
HOW TO USE IT
When 2FA is enabled and deletion runs non-interactively, provide a verification code with `--2fa-code`. Use the matching delete command and `--yes` to skip confirmation.
railway delete --project <project-name-or-id> --yes --2fa-code <CODE>railway environment delete <environment> --yes --2fa-code <CODE>railway volume delete --volume <volume-name-or-id> --yes --2fa-code <CODE>WHY THIS HELPS
When deleting a project, environment, or volume in a Railway account with 2FA enabled, run the delete command non-interactively with a verification code.
BEFORE THIS CHANGE
With 2FA enabled, non-interactive destructive commands failed with “2FA is enabled. This operation requires interactive mode.”
REQUIREMENTS AND LIMITATIONS
- Version: v4.27.2
- --2fa-code <CODE>: 2FA verification code; required when 2FA is enabled and running non-interactively.
- --yes: Skip the confirmation dialog; needed to avoid a confirmation prompt in non-interactive mode.
- --project <project-name-or-id>: Project ID or name to delete; required when project deletion runs without a terminal.
- <environment> (required): Environment name or ID to delete.
- --volume <volume-name-or-id>: Volume ID or name to delete; command uses the linked project and environment when not otherwise specified.
- Prerequisite: Authenticate the Railway CLI with a Railway account before use.
- Prerequisite: For volume deletion, the CLI requires a linked project and environment.
- Applies to destructive operations when 2FA is enabled on a Railway account.
- The flag supports deleting projects, environments, and volumes.
FIRST-PARTY EVIDENCE
- https://github.com/railwayapp/cli/releases/tag/v4.27.2
- https://github.com/railwayapp/cli/pull/773
- https://github.com/railwayapp/cli/blob/v4.27.2/src/commands/delete.rs
- https://github.com/railwayapp/cli/blob/v4.27.2/src/commands/environment/delete.rs
- https://github.com/railwayapp/cli/blob/v4.27.2/src/commands/volume.rs
- https://docs.railway.com/cli/environment
- https://docs.railway.com/cli
Check the installed version and the source before using it. Entry JSON