Skip to content

Add Railway API escape hatch#1008

Draft
m-abdelwahab wants to merge 1 commit into
masterfrom
codex/agent-api-escape-hatch
Draft

Add Railway API escape hatch#1008
m-abdelwahab wants to merge 1 commit into
masterfrom
codex/agent-api-escape-hatch

Conversation

@m-abdelwahab

Copy link
Copy Markdown
Collaborator

Summary

Adds railway api, an authenticated GraphQL escape hatch for querying the Railway public API directly from the CLI.

This is intended primarily for AI agents and advanced automation workflows that need to use public API capabilities before they have first-class CLI commands.

What Changed

  • Added railway api [QUERY] for executing GraphQL documents against the Railway public API.
  • Supports query input via inline argument, stdin, or --file.
  • Supports variables via --variables, --var, and --raw-var.
  • Added --operation-name, --compact, and --allow-errors.
  • Added schema discovery commands:
    • railway api schema
    • railway api schema --refresh
    • railway api search <term>
    • railway api describe <name>
  • Bundled the GraphQL introspection schema for offline search/describe workflows.
  • Skips OAuth refresh for offline schema discovery commands.
  • Added telemetry for API command usage, including action, auth mode, operation name, query hash/document metadata, variable shape, response status, GraphQL errors, and discovery metadata.
  • Added CLI parse and auth-refresh behavior tests.

Why

Agents need a reliable way to discover what the Railway public API supports and then execute precise queries without guessing endpoint/auth details.

The intended workflow is:

railway api search serviceInstance
railway api describe serviceInstance
railway api describe ServiceInstance
railway api 'query { me { id name } }'

Validation

  • cargo fmt --all --check
  • cargo check --bin railway
  • cargo test --bin railway
  • Manually verified:
    • railway api --help
    • railway api schema
    • railway api schema --refresh
    • railway api search
    • railway api describe
    • authenticated read-only queries including me, workspace projects, project by ID, service instance, and deployment by ID

@m-abdelwahab m-abdelwahab added the release/minor Author minor release label Jul 9, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

release/minor Author minor release

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants