API Overview
MOSES exposes a set of REST APIs for machine data ingestion, health monitoring, and machine provisioning. All endpoints are authenticated and return JSON.
Authentication
The ingest API uses a static API key passed as a Bearer token:
Authorization: Bearer your-ingest-api-key-here
Other APIs use session-based authentication via NextAuth. Machine provisioning and health endpoints require a valid session or API key.
POST /api/ingest
Receives telemetry from IVM gateways or N8N flows. Accepts batch payloads.
POST /api/ingest
Authorization: Bearer <INGEST_API_KEY>
Content-Type: application/json
{
"batch": [
{
"machine_id": 1001,
"virtual_status": 1,
"output_count": 4823,
"tag_temp": 72.4,
"tag_energy": 14.2,
"tag_vibration": 2.1,
"tag_pressure": 3.8,
"tag_rpm": 1450,
"ist": "15/05/2026, 09:42:33"
}
]
}The ist field accepts timestamps in DD/MM/YYYY, HH:MM:SS format and converts them to UTC automatically.
GET /api/health
Always returns HTTP 200. Check the JSON body for actual health status.
GET /api/health
200 OK
{
"status": "ok", // "ok" | "degraded"
"db": "connected", // "connected" | "disconnected"
"version": "0.1.0",
"ts": "2026-05-15T09:42:33.000Z"
}GET /api/machines
Returns the list of provisioned machines for the portal instance.
GET /api/machines
Authorization: Bearer <INGEST_API_KEY>
200 OK
{
"machines": [
{
"id": "1001",
"name": "Press Line 01",
"type": "hydraulic-press",
"line": "Line A",
"plant": "Pune Plant"
}
]
}POST /api/machines
Provisions a new machine. Requires super-admin session or management layer API key.
POST /api/machines
Content-Type: application/json
{
"id": "1051",
"name": "Injection Moulding 03",
"type": "injection-moulding",
"line": "Line C",
"plant": "Chennai Plant"
}