Sentinel API v1

From your first API call to production

Monitors

Define what matters, not internal sessions

A Monitor is a durable mission bound to a Source and a natural-language prompt. Its public mon_* ID survives runtime restart and internal session recreation.

Create a Monitor

curl -X POST http://localhost:8000/v1/monitors \
  -H "Authorization: Bearer $SENTINEL_API_KEY" \
  -H "Content-Type: application/json" \
  -H "Idempotency-Key: loading-dock-after-hours" \
  -d '{
    "name": "After-hours loading dock",
    "source_id": "src_01...",
    "prompt": "Notify when a person enters the loading area after hours.",
    "enabled": true
  }'

One API, many use cases

After-hours intrusion, restricted zones, falls, loitering, and loading safety are not separate products. They share the same Source, Monitor, Event, and Webhook contract; the current API varies the prompt, inference cadence, and metadata.

{
  "name": "Restricted area",
  "source_id": "src_01...",
  "prompt": "Notify when a person enters the restricted area.",
  "language": "en",
  "inference_window_ms": 5000,
  "inference_frames_per_window": 1,
  "analytics": {
    "enabled": true,
    "show_boxes": true,
    "show_count": true,
    "local_tracking": true,
    "show_dwell": true,
    "use_as_ai_context": false,
    "traffic": {
      "enabled": true,
      "subject_labels": ["person"],
      "stopped_seconds_threshold": 5,
      "event_release_seconds": 10,
      "motion_threshold": 0.015,
      "optical_flow_enabled": false,
      "road_roi_polygons": [],
      "exclusion_polygons": [],
      "tripwires": []
    }
  },
  "enabled": true
}

The current create/patch schema includes prompt, language, inference cadence, analytics, and metadata. Analytics configures the detector, local tracking, traffic ROIs, exclusion zones, tripwires, dwell threshold, and optical flow; fields not listed in the schema are not public contract fields.

Desired state and runtime state

enabled: true | false
desired_state: running | stopped
runtime_state: stopped | starting | running | waiting_for_source |
               waiting_for_model | degraded | failed

Temporary Source/provider failure does not delete a Monitor. The runtime retains desired state and reconciles after dependency recovery or node restart.

Control and test

POST /v1/monitors/{monitor_id}/start
POST /v1/monitors/{monitor_id}/stop
POST /v1/monitors/{monitor_id}/test

test exercises real Monitor validation and reports whether it can run; it does not fabricate provider success. Start/stop changes desired state. Closing the optional UI is not a stop operation.

Prompts are configuration, not the public event schema. Downstream code should use Event type, severity, state, and attributes—not parse prompts or model prose.

Next: consume Events and images →