Authorization: Bearer <token>. A project token (from a
project’s settings) works with tokenKind: 'project' in the plugin
options and reaches only that project’s environment.
- One operation per GraphQL field. Every query and mutation of
Railway’s public API (
backboard.railway.com/graphql/v2) is an operation; its input is the field’s arguments, mostly aninputobject for mutations. The plugin sends a fixed document per operation that selects the result’s scalar and enum fields and the scalars of each nested object. Fields that need arguments, connections inside a result (a project’s services come from their own list operation) and fields API tokens can’t read (User.platformFeatureFlags) are left out. - Lists. Relay connections (projects, deployments, environments, …)
take
first/after(orlast/before) and return{ items, pageInfo }; passpageInfo.endCursorasafterfor the next page. A few lists page their own way (cloudAgentTasks.listreturnsnextCursorand takescursor): their output says which fields to use. - Errors. Railway answers most failures with HTTP 200 and a GraphQL
errorslist; the plugin raises them asRailwayGraphQLErrorwith a status (403 for “Not Authorized”, 404 for a missing record, 429 for “too many requests” or “too quickly”, 400 otherwise). When the only errors are inside the result (an audit log entry whose project was deleted), the call succeeds and those nested fields come back null. - Risk. Queries are
read. Deletes, deploys, redeploys, restarts, rollbacks, template and repo deploys, new services, environments, volumes, buckets, sandboxes and cloud agents (all use credits), tokens and credential resets, invitations (they send email), billing and usage limits, restores and transfers aredestructive; other mutations arewrite. - Not wrapped: Railway’s CLI telemetry and login-session fields, its staff and careers fields, the dashboard’s landing and X-agent claim state, email change and second-factor/passkey setup (they need a person at the dashboard), and fields Railway marks deprecated. Railway’s project webhooks are not signed, so the plugin has no webhook handlers.
- 394 typed API operations
Setup
1
Install
2
Add the plugin
corsair.ts
multiTenancy: true, scope calls with corsair.withTenant(id). See Quick start for KEK + Hub keys, and Multi-tenancy for account isolation.3
Choose authentication
- API Key (Recommended)
Store the Railway API key before the first call: More: API Key
pnpm corsair setup --plugin=railway --tenant=acme api_key=<your-key> (leave out --tenant without multiTenancy), or pass it as key in the plugin options. With Hub, each tenant enters their own key on the connect page. See API key auth.4
Connect a tenant
Mint a connect link and send the tenant to it. Hub hosts the page and delivers the result to your app — see Connect / OAuth.
Example API calls
List projectsWhat’s next
API reference
Every
railway.api.* operation with input and output types.Connect / OAuth
createLink, Hub delivery, and tenant connect flows.
Use with agents
Expose this plugin’s operations as MCP tools.