|Docs

railway service

Link a service to the current project and manage service operations.

Usage

railway service [SERVICE] [COMMAND]

Subcommands

SubcommandAliasesDescription
listlsList services in the current environment
linkLink a service to the current project
deleteremove, rmDelete a service from an environment
statusShow deployment status for services
logsView logs from a service
redeployRedeploy the latest deployment
restartRestart the latest deployment
scaleScale a service across regions
sourceConnect or disconnect a service source
filesfileManage files in a service filesystem

Examples

railway service

Prompts you to select a service to link.

railway service backend

Show service status

railway service status

Show all services status

railway service status --all

View service logs

railway service logs

Redeploy service

railway service redeploy

Restart service

railway service restart

Scale service

railway service scale us-west=2

Connect a GitHub source

railway service source connect --repo owner/repo --branch main --service web

Connects the service to a GitHub repository. Use --branch to set the branch that deploys.

Connect a Docker image source

railway service source connect --image nginx:latest --service web

Connects the service to a Docker image.

Disconnect a source

railway service source disconnect --service web

Disconnects the service from its current GitHub repository or Docker image source.

Browse service files

railway service files browse /app

Opens an interactive TUI for browsing, downloading, uploading, editing, renaming, and deleting files in the service filesystem.

List service files

railway service files list /app

Download a file from a service

railway service files download /app/data.db ./data.db

Upload a file to a service

railway service files upload ./seed.db /app/seed.db

Rename a file in a service

railway service files rename /app/data.db /app/data-old.db

Delete a file from a service

railway service files delete /app/data.db

Options for

FlagDescription
-a, --allShow status for all services in the environment
--jsonOutput in JSON format

Options for

FlagDescription
-d, --deploymentShow deployment logs
-b, --buildShow build logs
-n, --lines <N>Number of log lines to fetch (disables streaming)
-f, --filter <QUERY>Filter logs using Railway's query syntax
--latestShow logs from latest deployment (even if failed/building)
-S, --since <TIME>Show logs since a specific time
-U, --until <TIME>Show logs until a specific time
--jsonOutput logs in JSON format

See railway logs for detailed usage and examples.

Options for

FlagDescription
-y, --yesSkip confirmation dialog
--jsonOutput in JSON format

Options for

FlagDescription
-y, --yesSkip confirmation dialog
--jsonOutput in JSON format

Options for

ArgumentDescription
REGION=REPLICASOne or more replica assignments by region.
FlagDescription
--jsonOutput in JSON format

See railway scale for available regions and detailed usage.

Manage service sources

Use railway service source to connect a service to a GitHub repository or Docker image, or to disconnect the service from its current source.

SubcommandDescription
source connectConnect a service to a GitHub repository or Docker image
source disconnectDisconnect the service from its current source

Options for

FlagDescription
-s, --service <SERVICE>Service name or ID
-e, --environment <ENVIRONMENT>Environment to use
-p, --project <PROJECT_ID>Project ID to use
--repo <REPO>GitHub repository in owner/repo format
--branch <BRANCH>Branch to deploy from when connecting a GitHub repository
--image <IMAGE>Docker image to connect
--jsonOutput in JSON format

Pass either --repo or --image. These source options are mutually exclusive.

Options for

FlagDescription
-s, --service <SERVICE>Service name or ID
-e, --environment <ENVIRONMENT>Environment to use
-p, --project <PROJECT_ID>Project ID to use
--jsonOutput in JSON format

Manage files

Use railway service files to manage files in a running service filesystem. The command uses the linked service by default. Pass --service, --environment, or --project to select a different target.

SubcommandAliasesDescription
listlsList files in a directory
browsebrowserBrowse files interactively
downloadDownload a file or directory
uploadUpload a file or directory
deleterm, removeDelete a file
renamemvRename a file

Options for

FlagDescription
-s, --service <SERVICE>Service name or ID
-e, --environment <ENVIRONMENT>Environment to use
-p, --project <PROJECT_ID>Project ID to use

Options for

Argument or flagDescription
[REMOTE_PATH]Directory path to list. Defaults to /
--jsonOutput in JSON format

Options for

Argument or flagDescription
<REMOTE_PATH>Remote file or directory to download
[LOCAL_PATH]Local destination. Defaults to the current directory
--overwrite, --overrideReplace the local path if it already exists
--concurrency <N>Concurrent file downloads when downloading a directory. Defaults to 32
--jsonOutput in JSON format

Options for

Argument or flagDescription
<LOCAL_PATH>Local file or directory to upload
<REMOTE_PATH>Remote destination path
--overwriteReplace the remote path if it already exists
--concurrency <N>Concurrent file uploads when uploading a directory. Defaults to 32
--jsonOutput in JSON format

Options for

Argument or flagDescription
<REMOTE_PATH>Remote file to delete
-y, --yesSkip confirmation
--jsonOutput in JSON format

railway service files delete refuses to run when invoked by an AI agent and must be run by a human.

Options for

Argument or flagDescription
<OLD_REMOTE_PATH>Existing remote path
<NEW_REMOTE_PATH>New remote path
--jsonOutput in JSON format

Options for

Argument or flagDescription
[REMOTE_PATH]Directory path to open. Defaults to /
--editor <COMMAND>Editor command to use when editing files
--concurrency <N>Concurrent file downloads. Defaults to 32