Skip to main content
POST
https://api.rotavision.com
/
guardian
/
monitors
/
{monitor_id}
/
inferences
curl -X POST https://api.rotavision.com/v1/guardian/monitors/mon_abc123/inferences \
  -H "Authorization: Bearer rv_live_..." \
  -H "Content-Type: application/json" \
  -d '{
    "input_data": {
      "user_id": "u123",
      "category": "electronics",
      "price_range": "mid",
      "session_duration": 245
    },
    "prediction": {
      "product_ids": ["p456", "p789", "p012"],
      "scores": [0.92, 0.87, 0.81]
    },
    "latency_ms": 45,
    "metadata": {
      "user_segment": "premium",
      "region": "north",
      "platform": "mobile"
    }
  }'
{
  "id": "inf_xyz789",
  "monitor_id": "mon_abc123",
  "logged_at": "2026-02-01T10:30:00Z"
}

Request

monitor_id
string
required
The monitor ID to log to.
input_data
object
Input features for the inference. Used for data drift detection.
prediction
any
required
The model’s prediction output.
actual
any
Ground truth label (if available). Used for accuracy monitoring.
latency_ms
number
Inference latency in milliseconds.
error
object
Error details if the inference failed.
metadata
object
Additional metadata for segmentation and analysis.
timestamp
string
ISO 8601 timestamp. Defaults to current time.
curl -X POST https://api.rotavision.com/v1/guardian/monitors/mon_abc123/inferences \
  -H "Authorization: Bearer rv_live_..." \
  -H "Content-Type: application/json" \
  -d '{
    "input_data": {
      "user_id": "u123",
      "category": "electronics",
      "price_range": "mid",
      "session_duration": 245
    },
    "prediction": {
      "product_ids": ["p456", "p789", "p012"],
      "scores": [0.92, 0.87, 0.81]
    },
    "latency_ms": 45,
    "metadata": {
      "user_segment": "premium",
      "region": "north",
      "platform": "mobile"
    }
  }'
{
  "id": "inf_xyz789",
  "monitor_id": "mon_abc123",
  "logged_at": "2026-02-01T10:30:00Z"
}

Batch Logging

For high-throughput scenarios, use the batch endpoint:
curl -X POST https://api.rotavision.com/v1/guardian/monitors/mon_abc123/inferences/batch \
  -H "Authorization: Bearer rv_live_..." \
  -H "Content-Type: application/json" \
  -d '{
    "inferences": [
      {
        "input_data": {...},
        "prediction": {...},
        "latency_ms": 45,
        "timestamp": "2026-02-01T10:30:00Z"
      },
      {
        "input_data": {...},
        "prediction": {...},
        "latency_ms": 52,
        "timestamp": "2026-02-01T10:30:01Z"
      }
    ]
  }'
Batch endpoint accepts up to 1,000 inferences per request. For very high throughput, consider using async logging with a queue.

Async Logging

For minimal latency impact on your serving path:
from rotavision import Rotavision
from rotavision.logging import AsyncLogger

# Create async logger (uses background thread)
logger = AsyncLogger(
    api_key="rv_live_...",
    monitor_id="mon_abc123",
    batch_size=100,
    flush_interval_ms=1000
)

# In your serving code - returns immediately
logger.log(
    input_data=features,
    prediction=prediction,
    latency_ms=latency
)

# Ensure flushing on shutdown
logger.flush()