CLI API Reference

The following commands are available in the CLI


Add a plugin to your project


Generate a shell-completions for the following shells: bash, zsh, fish, PowerShell.

Run railway completion --help to for information on how to install the completions for your specific shell.


Open an interactive shell for one of your databases.

If you don't specify a plugin, you will be prompted to select a plugin to connect to.


  • postgresql/postgres/psql
  • mysql
  • redis
  • mongodb/mongo


Open the Railway documentation (this website) in the default browser.


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 about any command


Create a new Railway project.

Running init will prompt you to create a new project or a select from one of our featured templates.

Connect to an existing Railway project.

Running link with no project ID will prompt you to select an existing project from your Railway account.


Delete a Railway project.

If 2FA is enabled on your account you will be prompted to delete the project from the dashboard.


List all projects in your Railway account


Login to your Railway account.

This will open the browser to


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 of your Railway account.


View logs for the most recent deployment


Open your current Railway project in the browser.


Run a command using the Railway environment.

This injects all environment variables associated with the plugins you have installed in your project. If you run railway run without specifying a command, it will try to run the Dockerfile in the current directory, if it can find one.


  • -e, -environment: Specify the environment to use


View the status of your Railway project and user.

Disconnects the current directory from Railway. You will need to rerun railway init to use railway in this directory again.


Deploy a directory to your Railway project. If no path is provided the current directory is deployed. The currently selected environment is used.


  • -d, --detach: Detach from cloud build/deploy logs
  • -e, --environment: Specify the environment to use
  • -s, --service: Specify the service to use (e.g., --service my-service)


View all the environment variables associated with your project and environment.


Get the current version of the Railway CLI


View what user is currently authenticated with Railway


This will create a subshell (based on $SHELL) with all the variables from your project/environment/service loaded and accessible.

Edit this file on GitHub