API Overview
EGOS Cloud provides a comprehensive REST API for managing games, components, devices, and more.
Base URL
https://your-egos-instance.com/api
For local development:
http://localhost:3000/api
Authentication
All API requests require authentication using JWT tokens:
curl -H "Authorization: Bearer YOUR_TOKEN" \
https://your-egos-instance.com/api/games
Note
Obtain tokens through the AWS Amplify authentication flow.
Response Format
All responses follow a consistent format:
Success Response
{
"success": true,
"data": { ... }
}
Error Response
{
"success": false,
"error": {
"code": "VALIDATION_ERROR",
"message": "Invalid game ID format"
}
}
Available Endpoints
Games API
| Method | Endpoint | Description |
|---|---|---|
| GET | /api/games | List all games |
| POST | /api/games | Create a new game |
| GET | /api/games/:id | Get game details |
| PUT | /api/games/:id | Update game |
| DELETE | /api/games/:id | Delete game |
Components API
| Method | Endpoint | Description |
|---|---|---|
| GET | /api/components | List components |
| POST | /api/components | Create component |
| GET | /api/components/:id | Get component |
| PUT | /api/components/:id | Update component |
| DELETE | /api/components/:id | Delete component |
Devices API
| Method | Endpoint | Description |
|---|---|---|
| GET | /api/devices | List registered devices |
| GET | /api/devices/:id | Get device details |
| POST | /api/devices/:id/command | Send command |
Rate Limits
| Tier | Requests/minute |
|---|---|
| Free | 60 |
| Pro | 600 |
| Enterprise | Unlimited |
Warning
Exceeding rate limits will result in 429 (Too Many Requests) responses.
WebSocket API
For real-time updates, connect via MQTT over WebSocket:
const client = mqtt.connect('wss://your-instance.com:9001');
client.on('connect', () => {
client.subscribe('game/+/state');
});
client.on('message', (topic, message) => {
console.log('State update:', JSON.parse(message));
});
SDKs
Official SDKs are available for:
- JavaScript/TypeScript
- Python (coming soon)
- C# (coming soon)
Next Steps
Explore specific API endpoints:
- Games API (coming soon)
- Components API (coming soon)
- Devices API (coming soon)