# Railway on boxd

> Railway is a deployment platform for building and shipping applications with instant deployments, automatic scaling, and managed infrastructure.

- Page: https://boxd.sh/integrations/railway/
- CLI: `run railway` (18 commands)
- SDK: `import { railway } from "@boxd/run"`; every parameter and response type is at `@boxd/run/railway`
- Triggers: none
- Connect: `run auth railway` (API key), or https://app.boxd.sh/integrations/detail/railway
- All integrations: https://boxd.sh/integrations/ (Markdown: https://boxd.sh/integrations/index.md)

## From the shell

```sh
run auth railway      # once: prints a link to connect your account
run railway           # list its commands
run railway list-api-tokens
```

Parameters are flags (`--flag value`); object and array parameters take a JSON string. Output is YAML, or JSON with `--json`. Calls use your own connection; `--scope <name>` uses a connection shared with your team.

## From a script

```ts
import { every, railway } from "@boxd/run";

every("1 hour", async () => {
  const result = await railway.listApiTokens();
  console.log(result);
});
```

Run it with `run railway.run.ts`. Railway has no triggers; `every()` polls on a schedule, keeps the script running as a job, and wakes the machine when it is due.

## Commands

Required flags are listed; `run railway <command> --help` lists the optional ones. "common" marks what `run railway` shows without `--all`.

| Command | SDK method | Required flags | Optional | Description |
|---|---|---|---|---|
| `create-plugin` | `railway.createPlugin()` | `--name` `--projectId` | 0 | Creates a new plugin in Railway for the specified project |
| `delete-variable` | `railway.deleteVariable()` | `--environment-id` `--name` `--project-id` | 1 | Delete a Railway environment variable |
| `delete-volume` | `railway.deleteVolume()` | `--volume-id` | 0 | Permanently delete a persistent volume and all its associated data from Railway |
| `delete-workspace` | `railway.deleteWorkspace()` | `--id` | 0 | Delete a Railway workspace and all data associated with it |
| `disconnect-user-discord` | `railway.disconnectUserDiscord()` | — | 0 | Disconnects the authenticated user's Railway account from Discord |
| `get-deployment-logs` | `railway.getDeploymentLogs()` | `--deployment-id` | 1 | Retrieve runtime logs for a deployment |
| `get-environment` | `railway.getEnvironment()` | `--id` | 0 | Get details of a specific Railway environment by its ID, including service instances and deployment information |
| `get-git-hub-pr-info` | `railway.getGitHubPrInfo()` | `--prNumber` `--serviceId` | 0 | Get information for a GitHub pull request associated with a Railway service |
| `get-user-kickback-earnings` | `railway.getUserKickbackEarnings()` | — | 0 | Get the total kickback earnings for the authenticated Railway user |
| `list-api-tokens` | `railway.listApiTokens()` | — | 0 | Retrieve all API tokens for the authenticated user from Railway |
| `list-environment-patches` | `railway.listEnvironmentPatches()` | `--environment-id` | 2 | Retrieve all patches for a Railway environment using the GraphQL API |
| `list-git-hub-repos` | `railway.listGitHubRepos()` | — | 0 | Retrieve a list of GitHub repositories that Railway has access to |
| `list-git-hub-writable-scopes` | `railway.listGitHubWritableScopes()` | — | 0 | Retrieve the list of GitHub scopes the user has installed the installation to |
| `list-integration-auths` | `railway.listIntegrationAuths()` | — | 0 | Retrieve all integration auths for the authenticated user from Railway |
| `list-notification-deliveries` | `railway.listNotificationDeliveries()` | — | 0 | Retrieve notification deliveries for the authenticated user |
| `list-trusted-domains` | `railway.listTrustedDomains()` | — | 1 | Fetch all trusted domains for the authenticated Railway workspace |
| `update-project` | `railway.updateProject()` | `--id` `--input` | 0 | Update project settings and configuration on Railway |
| `update-service-instance` | `railway.updateServiceInstance()` | `--environment-id` `--input` `--service-id` | 0 | Update build/deploy settings for a service in a specific environment on Railway |

## Docs

- [run CLI](https://docs.boxd.sh/cli/run): Call connected integrations from the shell, connect new ones, and run automations.
- [Quickstart](https://docs.boxd.sh/guides/integrations/quickstart): Connect an integration, call it from the shell, and turn a script into an automation.
- [Connections](https://docs.boxd.sh/guides/integrations/connections): Connect an account once, for yourself or for your whole organization.
- [Scripts](https://docs.boxd.sh/guides/automations/scripts): Typed integrations, triggers, schedules and state in a .run.ts file.
- [Jobs](https://docs.boxd.sh/guides/automations/jobs): How a script becomes a background job: states, retries, sleep and wake.
- [Beyond the catalog](https://docs.boxd.sh/guides/automations/beyond-the-catalog): Reach your own APIs, databases and cloud accounts from a script.
