RailwayDocs

CLI

The Railway Command Line Interface (CLI) lets you interact with your Railway projects from the command line.

GIF of the CLI in Action

Installing the CLI

The Railway CLI can be installed via Homebrew, npm, Scoop, or directly from the source.

Homebrew (macOS)

npm (macOS, Linux, Windows)

Requires Node.js version 16 or higher.

Shell script (macOS, Linux, Windows via WSL)

On Windows, use Windows Subsystem for Linux with a Bash shell.

Scoop (Windows)

Pre-built binaries

Download pre-built binaries from the GitHub repository.

From source

Build from source using the instructions in the GitHub repository.

Authentication

Before using the CLI, authenticate with your Railway account:

For environments without a browser (e.g., SSH sessions), use browserless login:

Tokens

For CI/CD pipelines, set environment variables instead of interactive login:

  • Project Token: Set RAILWAY_TOKEN for project-level actions
  • Account/Team Token: Set RAILWAY_API_TOKEN for account-level actions

See Tokens for more information.

Available commands

Authentication

login · logout · whoami

Project management

init · link · unlink · list · status · open · project

Deployment

up · deploy · redeploy · restart · down · Deploying Guide

Services

add · service · scale · delete

Variables

variable

Environments

environment

Local development

run · shell · dev

Logs & debugging

logs · ssh · connect

Networking

domain

Volumes

volume

Functions

functions

Utilities

completion · docs · upgrade · starship

Global options

These flags are available across multiple commands:

FlagDescription
-s, --serviceTarget service (name or ID)
-e, --environmentTarget environment (name or ID)
--jsonOutput in JSON format
-y, --yesSkip confirmation prompts
-h, --helpDisplay help information
-V, --versionDisplay CLI version

See Global Options for more details.

SSH

The Railway CLI enables you to start a shell session inside your deployed Railway services:

Copy the exact command from the Railway dashboard by right-clicking on a service and selecting "Copy SSH Command".

See railway ssh for more details.

Contributing

The Railway CLI is open source. Contribute to the development of the Railway CLI by opening an issue or Pull Request on the GitHub Repo.