Skip to main content

POST /ingest

Ingest a single sensor event with validation, server-side power computation, and persistence to InfluxDB.

Request

event_id
string
required
UUID v4 identifier for the event
timestamp
string
required
ISO 8601 timestamp (e.g., 2026-01-12T00:00:00Z)
asset
object
required
Asset information
signals
object
required
Sensor measurements
context
object
required
Operational context

Response

status
string
accepted if ingestion succeeded
event_id
string
Echo of the request event_id
timestamp
string
Echo of the request timestamp
signals
object
Signals with computed power_kw
message
string
Human-readable success message

Example

cURL
curl -X POST https://predictive-maintenance-uhlb.onrender.com/ingest \
  -H "Content-Type: application/json" \
  -d '{
    "event_id": "550e8400-e29b-41d4-a716-446655440000",
    "timestamp": "2026-03-02T10:30:00Z",
    "asset": {
      "asset_id": "Motor-01",
      "asset_type": "motor"
    },
    "signals": {
      "voltage_v": 230.5,
      "current_a": 12.3,
      "power_factor": 0.92,
      "vibration_g": 0.15
    },
    "context": {
      "operating_state": "RUNNING",
      "source": "modbus_rtu"
    }
  }'
Response
{
  "status": "accepted",
  "event_id": "550e8400-e29b-41d4-a716-446655440000",
  "timestamp": "2026-03-02T10:30:00Z",
  "asset": {
    "asset_id": "Motor-01",
    "asset_type": "motor"
  },
  "signals": {
    "voltage_v": 230.5,
    "current_a": 12.3,
    "power_factor": 0.92,
    "vibration_g": 0.15,
    "power_kw": 2.6048
  },
  "context": {
    "operating_state": "RUNNING",
    "source": "modbus_rtu"
  },
  "message": "Event ingested successfully"
}

Status Codes

  • 200 - Event ingested successfully
  • 422 - Validation error (invalid payload)
  • 503 - InfluxDB unavailable
Do NOT include power_kw in the request. The server computes this field. If provided by the client, the request will be rejected with a 422 error.

Server-Side Processing

When you POST to /ingest, the backend:
  1. Validates all fields against schemas
  2. Computes power_kw = voltage_v × current_a × power_factor / 1000
  3. Persists to InfluxDB sensor_data measurement
  4. Triggers feature engineering (rolling means, spike detection)
  5. Runs anomaly detection if baseline exists
  6. Updates Cumulative Degradation Index (DI)
See Sensor Ingestion for the complete data flow.

Build docs developers (and LLMs) love