railway-api
π―Skillfrom adaptationio/skrillz
Automates Railway.com GraphQL API interactions for managing projects, services, deployments, and environment variables programmatically.
Installation
npx skills add https://github.com/adaptationio/skrillz --skill railway-apiSkill Details
Railway.com GraphQL API automation for projects, services, deployments, and environment variables. Use when automating Railway operations, querying project data, managing deployments, setting variables via API, or integrating Railway into workflows.
Overview
# Railway API
Comprehensive reference for Railway.com GraphQL API v2 automation including authentication, queries, mutations, and workflow automation.
Overview
The Railway GraphQL API enables programmatic access to all Railway platform features:
- Project and service management
- Environment variable configuration
- Deployment triggering and monitoring
- Team and resource management
- Usage and billing queries
API Endpoint: https://backboard.railway.com/graphql/v2
Quick Start
1. Authentication Setup
Railway supports three token types with different scopes:
| Token Type | Header | Scope | Use Case |
|------------|--------|-------|----------|
| Account | Authorization: Bearer | All user resources | Personal automation |
| Team | Team-Access-Token: | Team-specific resources | Team workflows |
| Project | Project-Access-Token: | Single project only | CI/CD, project automation |
Get tokens: Use the railway-auth skill or Railway dashboard β Account Settings β Tokens
2. Basic Query Example
```bash
curl https://backboard.railway.com/graphql/v2 \
-H "Authorization: Bearer
-H "Content-Type: application/json" \
-d '{"query": "query { me { name email } }"}'
```
3. Basic Mutation Example
```bash
curl https://backboard.railway.com/graphql/v2 \
-H "Authorization: Bearer
-H "Content-Type: application/json" \
-d '{
"query": "mutation($input: VariableUpsertInput!) { variableUpsert(input: $input) }",
"variables": {
"input": {
"projectId": "project-id",
"environmentId": "env-id",
"name": "API_KEY",
"value": "secret-value"
}
}
}'
```
Common Operations
User & Account Information
```graphql
query {
me {
id
name
avatar
isAdmin
}
}
```
List Projects
```graphql
query {
projects {
edges {
node {
id
name
description
createdAt
updatedAt
}
}
}
}
```
Get Project Details with Services
```graphql
query GetProject($projectId: String!) {
project(id: $projectId) {
id
name
description
services {
edges {
node {
id
name
serviceInstances {
edges {
node {
id
environmentId
serviceId
}
}
}
}
}
}
environments {
edges {
node {
id
name
}
}
}
}
}
```
Get Environment Variables
```graphql
query GetVariables($projectId: String!, $environmentId: String!) {
variables(projectId: $projectId, environmentId: $environmentId) {
edges {
node {
name
value
}
}
}
}
```
Set/Update Variable
```graphql
mutation SetVariable($input: VariableUpsertInput!) {
variableUpsert(input: $input)
}
# Variables:
{
"input": {
"projectId": "your-project-id",
"environmentId": "your-env-id",
"name": "DATABASE_URL",
"value": "postgresql://..."
}
}
```
Trigger Deployment
```graphql
mutation TriggerDeployment($serviceId: String!, $environmentId: String!) {
deploymentTrigger(serviceId: $serviceId, environmentId: $environmentId) {
id
status
createdAt
}
}
```
Architecture
Progressive Disclosure Structure
- SKILL.md (this file): Quick reference and common operations
- references/: Detailed documentation
- graphql-endpoint.md - Complete API endpoint documentation
- authentication.md - Comprehensive authentication guide
- common-queries.md - 15+ query examples with responses
- common-mutations.md - 15+ mutation examples with patterns
- scripts/: Automation tools
- query-project.py - Python script for querying Railway API
- set-variables.ts - TypeScript script for variable management
Error Handling
Railway API returns errors in this format:
```json
{
"errors": [
{
"message": "Error message",
"extensions": {
"code": "ERROR_CODE"
}
}
]
}
```
Common errors:
UNAUTHORIZED- Invalid or expired tokenFORBIDDEN- Insufficient permissions for resourceNOT_FOUND- Resource doesn't existVALIDATION_ERROR- Invalid input data
Best practices:
- Always check for
errorsfield in response - Use appropriate token type for operation scope
- Handle rate limiting (429 responses)
- Validate input before mutations
- Use variables for parameterized queries
Integration Patterns
CI/CD Pipeline
```bash
# Get project token from railway-auth
# Set deployment variables
# Trigger deployment
# Monitor deployment status
```
See scripts/ for complete automation examples.
Infrastructure as Code
```typescript
// Define Railway resources in code
// Apply changes via GraphQL mutations
// Track state and changes
```
Monitoring & Alerts
```python
# Query deployment status
# Check resource usage
# Alert on failures
```
Cross-References
- railway-auth: Token generation and management
- railway-deployment: High-level deployment workflows
- railway-troubleshooting: API error debugging
Learning Path
- Start: Read
references/graphql-endpoint.mdfor endpoint details - Authentication: Study
references/authentication.mdfor token setup - Queries: Explore
references/common-queries.mdfor data retrieval - Mutations: Review
references/common-mutations.mdfor operations - Automation: Use scripts in
scripts/for workflow examples - Advanced: Combine patterns for complex automation
Quick Reference
Essential Queries
- Get user info:
query { me { name email } } - List projects:
query { projects { edges { node { id name } } } } - Get variables: Use
variablesquery with projectId and environmentId - Deployment status: Query
deploymentswith filters
Essential Mutations
- Set variable:
variableUpsertmutation - Trigger deploy:
deploymentTriggermutation - Create service:
serviceCreatemutation - Delete variable:
variableDeletemutation
Rate Limits
- Account tokens: 100 requests/minute
- Team tokens: 500 requests/minute
- Project tokens: 1000 requests/minute
Notes
- All timestamps are in ISO 8601 format (UTC)
- IDs are opaque strings, don't parse or construct them
- Pagination uses cursor-based edges/nodes pattern
- Use GraphQL variables for all dynamic values
- Production mutations should use Project tokens for security
Known API Limitations
Some GraphQL queries return "Problem processing request" even with valid tokens. This is a Railway API limitation, not a token issue.
Affected queries: deployment(id:), deploymentLogs, buildLogs, me.teams, teams
Workaround: Use Railway CLI for these operations:
```bash
railway list --json # Projects/teams
railway logs # Deployment/build logs
```
See [api-limitations.md](references/api-limitations.md) for full details.
---
References
- [common-queries.md](references/common-queries.md) - 31 query examples
- [common-mutations.md](references/common-mutations.md) - 37 mutation examples
- [api-limitations.md](references/api-limitations.md) - Known limitations and workarounds
- [authentication.md](references/authentication.md) - Token types and headers
- [graphql-endpoint.md](references/graphql-endpoint.md) - Endpoint details
---
Resources
- Railway API Documentation: https://docs.railway.com/reference/public-api
- GraphQL Explorer: https://backboard.railway.com/graphql/v2 (with GraphiQL)
- Token Management: Use railway-auth skill
More from this repository10
Performs comprehensive analysis of code, skills, processes, and data to extract actionable insights, identify patterns, and drive data-driven improvements.
Automatically diagnoses and resolves Auto-Claude installation, configuration, and runtime issues across different platforms and environments.
Authenticates and configures xAI Grok API access using Twitter/X account credentials, enabling seamless integration with OpenAI-compatible SDK methods.
Retrieve and integrate xAI Grok sentiment with financial data APIs to generate comprehensive market insights and analysis.
xai-crypto-sentiment skill from adaptationio/skrillz
Retrieves comprehensive financial market data including stocks, forex, crypto, and technical indicators using the Twelve Data API.
Enables real-time Twitter/X searches using Grok API to extract insights, track trends, monitor accounts, and analyze social discussions.
Enables autonomous agents to search X, web, execute code, and analyze documents with server-side tool management.
Optimizes Claude AI performance by reducing token usage, managing API costs, and improving build speed through intelligent model and context selection.
Automates comprehensive installation and setup of Auto-Claude across Windows, macOS, Linux, and WSL with multi-platform support and dependency management.