|Docs

CLI

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

Installing the CLI

Install the Railway CLI with agent support configured in one step (macOS, Linux, Windows via WSL):

This installs the CLI to ~/.railway/bin and runs railway setup agent to configure detected agent tools.

To install the CLI without agent configuration:

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

Other installation methods

Homebrew (macOS)

npm (macOS, Linux, Windows)

Requires Node.js version 16 or higher.

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/Workspace 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 · deployment · templates · Deploying Guide

Services

add · service · scale · delete

Variables

variable

Environments

environment

Local development

run · shell · dev

Logs & debugging

logs · ssh · connect · metrics

Networking

domain

Volumes

volume

Buckets

bucket

Functions

functions

AI & agents

agent · setup · mcp · skills

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.