Overview
Orphelix provides a RESTful API for managing Kubernetes resources and accessing cluster data. All API endpoints are server-side Next.js API routes that communicate with the Kubernetes API.Resources
Deployments, Pods, Nodes, Services, ConfigMaps, Secrets
Real-time
Server-Sent Events for live updates
GitHub
Repository browsing and PR creation
AI Features
File matching and troubleshooting
Base URL
Authentication
GitHub OAuth
Most endpoints work without authentication. GitHub integration requires OAuth:next-auth.session-token(httpOnly, secure)
Kubernetes Access
API uses kubeconfig from server’s filesystem:~/.kube/config- Or
$KUBECONFIGenvironment variable
Request Format
Query Parameters
All resource endpoints accept:Headers
Response Format
Success Response
Error Response
HTTP Status Codes
| Code | Meaning |
|---|---|
| 200 | Success |
| 201 | Created |
| 400 | Bad Request |
| 401 | Unauthorized |
| 403 | Forbidden (RBAC) |
| 404 | Not Found |
| 500 | Internal Server Error |
| 503 | Service Unavailable |
Rate Limiting
No rate limiting currently implemented. For production deployments, consider:- nginx rate limiting
- API gateway
- Custom middleware
Pagination
Not currently implemented. All list endpoints return full results. For large clusters:- Use namespace filtering
- Implement label selectors
- Future: Add
limitandoffsetparams
Error Handling
Kubernetes API Errors
Connection Errors
Demo Mode
When app is in demo mode, API returns mock data:- No kubeconfig required
- Realistic mock data
- All endpoints functional
- Perfect for testing
API Endpoints Overview
Resources
| Endpoint | Method | Description |
|---|---|---|
/api/deployments | GET | List deployments |
/api/deployments/[name] | GET | Get deployment details |
/api/deployments/[name]/restart | POST | Restart deployment |
/api/deployments/[name]/pods | GET | Get deployment pods |
/api/deployments/[name]/events | GET | Get deployment events |
/api/pods | GET | List pods |
/api/pods/[name] | GET | Get pod details |
/api/pods/[name]/logs | GET | Stream pod logs |
/api/pods/[name]/restart | POST | Delete pod (restart) |
/api/pods/[name]/events | GET | Get pod events |
/api/nodes | GET | List nodes |
/api/nodes/[name] | GET | Get node details |
/api/nodes/[name]/pods | GET | Get node pods |
/api/nodes/[name]/events | GET | Get node events |
/api/services | GET | List services |
/api/services/[name] | GET | Get service details |
/api/configmaps | GET | List ConfigMaps |
/api/configmaps/[name] | GET | Get ConfigMap details |
/api/secrets | GET | List Secrets |
/api/secrets/[name] | GET | Get Secret details |
/api/events | GET | List all events |
/api/hpa | GET | List HPAs |
/api/statefulsets | GET | List StatefulSets |
/api/daemonsets | GET | List DaemonSets |
/api/jobs | GET | List Jobs |
/api/cronjobs | GET | List CronJobs |
/api/ingress | GET | List Ingress |
/api/namespaces | GET | List namespaces |
/api/namespaces/[name] | GET | Get namespace details |
Dashboard
| Endpoint | Method | Description |
|---|---|---|
/api/dashboard/summary | GET | Cluster summary stats |
/api/cluster-health | GET | Cluster health score |
Real-time
| Endpoint | Method | Description |
|---|---|---|
/api/stream | GET | SSE for live updates |
GitHub
| Endpoint | Method | Description |
|---|---|---|
/api/github/repos | GET | List repositories |
/api/github/tree | GET | Browse repository files |
/api/github/file | GET | Get file content |
/api/github/branches | GET | List branches |
/api/github/create-pr | POST | Create pull request |
/api/github/create-multi-file-pr | POST | Create multi-file PR |
/api/github/match-file | POST | AI file matching |
AI
| Endpoint | Method | Description |
|---|---|---|
/api/ai/match-file | POST | Match deployment to file |
/api/ai/troubleshoot | POST | Troubleshoot issues |
Settings
| Endpoint | Method | Description |
|---|---|---|
/api/settings | GET | Get user settings |
/api/settings | POST | Update settings |
/api/settings | DELETE | Reset settings |
/api/contexts | GET | List kubeconfig contexts |
/api/test-connection | GET | Test cluster connection |
Common Patterns
Listing Resources
Getting Resource Details
Updating Resources
SDK / Client Libraries
Official SDK: Coming soon Manual Implementation:WebSocket Alternative
Orphelix uses Server-Sent Events (SSE) instead of WebSocket for real-time updates. Why SSE:- Simpler protocol (HTTP)
- Automatic reconnection
- One-way communication (sufficient for monitoring)
- Built into browsers
API Versioning
Current version: v1 (implicit) No versioning prefix currently used. Future versions may use:OpenAPI Specification
Coming soon: OpenAPI 3.0 spec for automatic client generation Will be available at:Examples
cURL
JavaScript (fetch)
Python
Rate Limits & Best Practices
Recommendations
- Use SSE for real-time updates - Don’t poll
- Cache responses - Use
staleTimein React Query - Batch requests - Fetch related data together
- Use namespaces - Filter by namespace when possible
- Handle errors gracefully - Retry with exponential backoff