API Reference
OpenMoni provides a REST API for managing hosts, checks, platforms, and users. All endpoints except authentication and health require a valid JWT token.
Authentication
Include the JWT token in the Authorization header:
Authorization: Bearer <jwt_token>
Obtain a token from:
POST /api/auth/register
POST /api/auth/login
GET /api/auth/oauth/google (OAuth flow)
Auth endpoints
| Method |
Endpoint |
Description |
POST |
/api/auth/register |
Register a new user |
POST |
/api/auth/login |
Log in with email and password |
POST |
/api/auth/logout |
Log out current session |
GET |
/api/auth/me |
Get current user info |
GET |
/api/auth/oauth/google |
Start Google OAuth |
GET |
/api/auth/oauth/google/callback |
OAuth callback |
POST |
/api/auth/forgot-password |
Request password reset |
POST |
/api/auth/reset-password |
Reset password with token |
Hosts
| Method |
Endpoint |
Description |
GET |
/api/hosts |
List hosts for the current user |
POST |
/api/hosts |
Create a new host |
GET |
/api/hosts/{hostId} |
Get host details |
PATCH |
/api/hosts/{hostId} |
Update a host |
DELETE |
/api/hosts/{hostId} |
Delete a host |
POST |
/api/hosts/{hostId}/check |
Trigger an immediate check |
GET |
/api/hosts/{hostId}/checks |
Get check history |
GET |
/api/hosts/{hostId}/metrics |
Get performance metrics |
POST |
/api/hosts/{hostId}/pause |
Pause monitoring |
POST |
/api/hosts/{hostId}/resume |
Resume monitoring |
Create a host
curl -X POST http://localhost:8080/api/hosts \
-H "Content-Type: application/json" \
-H "Authorization: Bearer <jwt_token>" \
-d '{
"name": "My API",
"platform_id": "uuid-of-platform",
"project_directory": "https://api.example.com/health",
"log_directory": "/var/log/app"
}'
Platforms
| Method |
Endpoint |
Description |
GET |
/api/platforms |
List connected platforms |
GET |
/api/platforms/railway/projects |
List Railway projects |
POST |
/api/platforms/railway/sync |
Sync Railway services |
Dashboard
| Method |
Endpoint |
Description |
GET |
/api/dashboard/stats |
Overall statistics |
GET |
/api/dashboard/overview |
Dashboard overview |
GET |
/api/dashboard/uptime |
Uptime data |
GET |
/api/dashboard/incidents |
Incidents list |
GET |
/api/dashboard/performance |
Performance data |
Health
| Method |
Endpoint |
Description |
GET |
/health |
Server health status |
Errors
API errors return a JSON body with an error message and the appropriate HTTP status code. Common codes:
400 — Bad request
401 — Unauthorized
403 — Forbidden
404 — Not found
500 — Internal server error