CLI API Reference
The following commands are available in the CLI
Add
Add a plugin to your project
Completion
Generate a shell-completions for the following shells: bash
, elvish
, fish
, and powershell
Connect
Connect to a plugin's shell (psql
for Postgres, mongosh
for MongoDB, etc.)
This requires you to have the plugin's appropriate shell/client installed in your $PATH
:
- Postgres:
psql
(https://www.postgresql.org/docs/current/app-psql.html) - Redis:
redis-cli
(https://redis.io/docs/ui/cli/) - MongoDB:
mongosh
(https://www.mongodb.com/docs/mongodb-shell/) - MySQL:
mysql
(https://dev.mysql.com/doc/refman/8.0/en/mysql.html)
Delete
Interactively delete a plugin
You will be prompted to select a plugin to delete, and if you have 2FA enabled, you will be prompted to enter your 2FA code.
Domain
Create a domain for a service
Docs
Open the Railway documentation site in the default browser
Down
Remove the most recent deployment
Environment
Change which environment you are using
View environment docs for more information.
If you run railway environment
without specifying a name, you will be prompted
with an environment selector that lists all your environments for the project.
Help
Help command reference
Init
Create a new Project from the CLI
Link
Connect to an existing Railway project
Running link
with no project ID will prompt you to select a team and project.
List
List all projects in your Railway account
Login
Login to your Railway account
This will open the browser to https://railway.app/cli-login
.
Browserless
If you are in an environment where the terminal cannot open a web browser, (i.e. SSH session or Codespaces), you can perform a browserless login.
This will prompt you to go to a URL (you can copy and paste) and present you with a 4 word code that you need to verify. If the codes match, click "Verify" and you will be logged in.
Logout
Logout of your Railway account
Logs
View logs for the most recent deployment
Open
Open your current Railway project in the browser
Run
Run a command using the Railway environment
This also injects all environment variables associated with the plugins you have installed in your project.
Service
Link a service to the current project
Shell
Create a subshell (based on $SHELL
) with all the variables from your project/environment/service loaded and accessible
Status
View the status of your Railway project and user
Unlink
Disconnects the current directory from Railway
You will need to rerun railway link
to use railway
in this directory again.
Up
Deploy a directory to your Railway project
If no path is provided, the top linked directory is deployed. The currently selected environment is used.
Variables
View a table of all the environment variables associated with your project and environment
Whoami
View what user is currently authenticated with Railway
Edit this file on GitHub