API docs
API reference

Events and live stream

Everything that happens in Ochio is written once, in order, to an event log. Read it page by page, follow it live, or export it.

The event object

Webhooks, the live stream, the log and the export all carry the same envelope:

FieldHolds
idThe event's id, evt_…. Use it to skip events you've already handled.
seqIts place in the log: 1, 2, 3… Order by it.
typeWhat happened, like mission.status_changed.
timeWhen.
actorWho or what caused it: sensor:<id>, rule:<id>, key:<name>, vehicle:<id> or core (Ochio itself).
subjectThe id of the record it's about.
dataThe details, by type: see below.
A detection.created event
{
  "id": "evt_0bbe51e79257",
  "seq": 29,
  "type": "detection.created",
  "time": "2026-10-19T21:33:47.392Z",
  "actor": "vehicle:drone-2",
  "subject": "det_ff3034b71f11",
  "data": {
    "class": "person",
    "confidence": 0.83,
    "location": {
      "lat": 38.5007,
      "lon": -97.9953
    },
    "zone_id": "east-gate",
    "mission_id": "msn_e58e7523d2b5",
    "vehicle_id": "drone-2",
    "distance_m": 34,
    "expires_at": "2026-10-19T21:43:47.392Z"
  }
}

Event types

Click a type to see a real example from the sandbox.

alert.receivedAn alert arrives.

Data: The alert's fields, with its id as alert_id.

alert.received · example
{
  "id": "evt_6e3c03826ded",
  "seq": 9,
  "type": "alert.received",
  "time": "2026-10-19T21:33:03.882Z",
  "actor": "sensor:east-gate-pir-02",
  "subject": "alt_5037deb6aeee",
  "data": {
    "alert_id": "alt_5037deb6aeee",
    "source": "east-gate-pir-02",
    "source_alert_id": "pir02-000412",
    "version": 1,
    "type": "motion",
    "priority": "high",
    "location": {
      "lat": 38.5005,
      "lon": -97.995
    },
    "zone_id": "east-gate",
    "status": "open",
    "mission_id": null,
    "time": "2026-10-19T21:33:03.000Z",
    "title": "Motion at the east gate",
    "description": null,
    "media_url": null,
    "data": null
  }
}
alert.updatedAn alert changes.

Data: The same fields, and change: version for a new version, status when a mission takes it or lets it go (with a reason).

alert.updated · example
{
  "id": "evt_930f5bbc41b2",
  "seq": 13,
  "type": "alert.updated",
  "time": "2026-10-19T21:33:06.092Z",
  "actor": "sensor:east-gate-pir-02",
  "subject": "alt_5037deb6aeee",
  "data": {
    "alert_id": "alt_5037deb6aeee",
    "source": "east-gate-pir-02",
    "source_alert_id": "pir02-000412",
    "version": 2,
    "type": "motion",
    "priority": "critical",
    "location": {
      "lat": 38.5005,
      "lon": -97.995
    },
    "zone_id": "east-gate",
    "status": "responding",
    "mission_id": "msn_e58e7523d2b5",
    "time": "2026-10-19T21:33:03.000Z",
    "title": "Motion at the east gate",
    "description": "The camera at the gate shows two people.",
    "media_url": null,
    "data": null,
    "change": "version"
  }
}
alert.resolvedThe alert's mission completes.

Data: alert_id, source, mission_id, detections.

alert.resolved · example
{
  "id": "evt_5099ee454683",
  "seq": 40,
  "type": "alert.resolved",
  "time": "2026-10-19T21:34:46.141Z",
  "actor": "vehicle:drone-2",
  "subject": "alt_5037deb6aeee",
  "data": {
    "alert_id": "alt_5037deb6aeee",
    "source": "east-gate-pir-02",
    "mission_id": "msn_e58e7523d2b5",
    "detections": 1
  }
}
alert.dismissedA person dismisses the alert.

Data: alert_id, source, reason, mission_id.

alert.dismissed · example
{
  "id": "evt_a66bd21f3a58",
  "seq": 42,
  "type": "alert.dismissed",
  "time": "2026-10-19T21:34:46.520Z",
  "actor": "key:operator",
  "subject": "alt_174f5ffd8217",
  "data": {
    "alert_id": "alt_174f5ffd8217",
    "source": "north-fence-pir-01",
    "reason": "Delivery van, expected",
    "mission_id": null
  }
}
sensor.registeredA sensor is added.

Data: sensor_id, name, type, location, zone_id, its check-in settings, simulated, origin.

sensor.registered · example
{
  "id": "evt_9c7127d03086",
  "seq": 7,
  "type": "sensor.registered",
  "time": "2026-10-19T21:33:02.764Z",
  "actor": "key:operator",
  "subject": "east-gate-pir-02",
  "data": {
    "sensor_id": "east-gate-pir-02",
    "name": "East gate motion sensor 2",
    "type": "motion",
    "location": {
      "lat": 38.5005,
      "lon": -97.995
    },
    "zone_id": "east-gate",
    "checkin_interval_s": 10.0,
    "missed_checkins_allowed": 2,
    "simulated": false,
    "origin": "api"
  }
}
sensor.onlineA sensor checks in for the first time.

Data: sensor_id, name, zone_id.

sensor.online · example
{
  "id": "evt_cd582a8642a8",
  "seq": 4,
  "type": "sensor.online",
  "time": "2026-10-19T21:30:10.346Z",
  "actor": "sensor:north-fence-pir-01",
  "subject": "north-fence-pir-01",
  "data": {
    "sensor_id": "north-fence-pir-01",
    "name": "North fence motion sensor",
    "zone_id": "north-fence"
  }
}
sensor.silentA sensor misses its check-ins.

Data: sensor_id, name, zone_id, location, last_seen, its check-in settings.

sensor.silent · example
{
  "id": "evt_cc90bcd23b29",
  "seq": 23,
  "type": "sensor.silent",
  "time": "2026-10-19T21:33:27.266Z",
  "actor": "core",
  "subject": "east-gate-pir-02",
  "data": {
    "sensor_id": "east-gate-pir-02",
    "name": "East gate motion sensor 2",
    "zone_id": "east-gate",
    "location": {
      "lat": 38.5005,
      "lon": -97.995
    },
    "last_seen": "2026-10-19T21:33:07.195Z",
    "checkin_interval_s": 10.0,
    "missed_checkins_allowed": 2
  }
}
sensor.recoveredA silent sensor checks in again.

Data: sensor_id, name, zone_id, silent_for_s.

sensor.recovered · example
{
  "id": "evt_3e5bc84fb7cc",
  "seq": 60,
  "type": "sensor.recovered",
  "time": "2026-10-19T21:34:59.653Z",
  "actor": "sensor:north-fence-pir-01",
  "subject": "north-fence-pir-01",
  "data": {
    "sensor_id": "north-fence-pir-01",
    "name": "North fence motion sensor",
    "zone_id": "north-fence",
    "silent_for_s": 10
  }
}
sensor.removedA sensor is removed.

Data: sensor_id, name.

sensor.removed · example
{
  "id": "evt_4f22dc41a656",
  "seq": 71,
  "type": "sensor.removed",
  "time": "2026-10-19T21:36:08.213Z",
  "actor": "key:operator",
  "subject": "east-gate-pir-02",
  "data": {
    "sensor_id": "east-gate-pir-02",
    "name": "East gate motion sensor 2"
  }
}
rule.suppressedA rule matched, but a guard held the mission back.

Data: rule_id, reason (active_mission or cooldown), sensor_id, alert_id, and mission_id or cooldown_left_s.

rule.suppressed · example
{
  "id": "evt_7c5306df78df",
  "seq": 24,
  "type": "rule.suppressed",
  "time": "2026-10-19T21:33:27.266Z",
  "actor": "rule:silent-sensor",
  "subject": "east-gate-pir-02",
  "data": {
    "rule_id": "silent-sensor",
    "reason": "active_mission",
    "sensor_id": "east-gate-pir-02",
    "alert_id": null,
    "mission_id": "msn_e58e7523d2b5"
  }
}
mission.createdA mission is requested.

Data: mission_id, type, the status it starts in, priority, target, vehicle_id, trigger, approval, safety, reason; in the sandbox, sim_speed.

mission.created · example
{
  "id": "evt_2e1180ee16a0",
  "seq": 10,
  "type": "mission.created",
  "time": "2026-10-19T21:33:03.883Z",
  "actor": "rule:perimeter-motion",
  "subject": "msn_e58e7523d2b5",
  "data": {
    "mission_id": "msn_e58e7523d2b5",
    "type": "inspect",
    "status": "en_route",
    "priority": "high",
    "target": {
      "kind": "alert",
      "alert_id": "alt_5037deb6aeee",
      "sensor_id": "east-gate-pir-02",
      "location": {
        "lat": 38.5005,
        "lon": -97.995
      },
      "zone_id": "east-gate",
      "name": "East gate motion sensor 2"
    },
    "vehicle_id": "drone-2",
    "trigger": {
      "kind": "alert",
      "rule_id": "perimeter-motion",
      "sensor_id": "east-gate-pir-02",
      "alert_ids": [
        "alt_5037deb6aeee"
      ]
    },
    "approval": {
      "mode": "auto",
      "required": false,
      "reasons": [],
      "decision": null,
      "decided_by": null,
      "decided_at": null,
      "note": null
    },
    "safety": {
      "result": "passed",
      "checks": [
        {
          "name": "inside_operating_area",
          "passed": true,
          "detail": "Target is inside the Depot operating area."
        },
        {
          "name": "outside_no_fly_zones",
          "passed": true,
          "detail": "Target is clear of no-fly zones."
        },
        {
          "name": "vehicle_capable",
          "passed": true,
          "detail": "2 vehicles with a camera."
        },
        {
          "name": "path_clear",
          "passed": true,
          "detail": "The straight path from the dock is clear of no-fly zones."
        },
        {
          "name": "within_range",
          "passed": true,
          "detail": "Round trip 1.0 km is within Drone 2's 6.0 km range."
        },
        {
          "name": "battery",
          "passed": true,
          "detail": "Drone 1 has 100% battery."
        }
      ],
      "checked_at": "2026-10-19T21:33:03.883Z"
    },
    "reason": "Motion on the perimeter: motion from East gate motion sensor 2",
    "sim_speed": 1.0
  }
}
mission.status_changedA mission moves to a new status.

Data: mission_id, from, to, type, vehicle_id, target, note.

mission.status_changed · example
{
  "id": "evt_0403913fe48d",
  "seq": 26,
  "type": "mission.status_changed",
  "time": "2026-10-19T21:33:43.164Z",
  "actor": "vehicle:drone-1",
  "subject": "msn_520f729ca856",
  "data": {
    "mission_id": "msn_520f729ca856",
    "from": "en_route",
    "to": "on_scene",
    "type": "patrol",
    "vehicle_id": "drone-1",
    "target": {
      "kind": "zone",
      "zone_id": "north-fence",
      "location": {
        "lat": 38.5037001,
        "lon": -98.0030001
      },
      "name": "North fence"
    },
    "note": "Drone 1 over North fence"
  }
}
vehicle.status_changedA vehicle takes off, arrives, heads home, lands or reports a fault.

Data: vehicle_id, from, to, mission_id, battery_pct, fault.

vehicle.status_changed · example
{
  "id": "evt_6bb7c16d2b43",
  "seq": 11,
  "type": "vehicle.status_changed",
  "time": "2026-10-19T21:33:03.883Z",
  "actor": "vehicle:drone-2",
  "subject": "drone-2",
  "data": {
    "vehicle_id": "drone-2",
    "from": "docked",
    "to": "en_route",
    "mission_id": "msn_e58e7523d2b5",
    "battery_pct": 100.0,
    "fault": null
  }
}
detection.createdA vehicle sees something.

Data: class, confidence, location, zone_id, mission_id, vehicle_id, distance_m from the vehicle, expires_at.

detection.created · example
{
  "id": "evt_0bbe51e79257",
  "seq": 29,
  "type": "detection.created",
  "time": "2026-10-19T21:33:47.392Z",
  "actor": "vehicle:drone-2",
  "subject": "det_ff3034b71f11",
  "data": {
    "class": "person",
    "confidence": 0.83,
    "location": {
      "lat": 38.5007,
      "lon": -97.9953
    },
    "zone_id": "east-gate",
    "mission_id": "msn_e58e7523d2b5",
    "vehicle_id": "drone-2",
    "distance_m": 34,
    "expires_at": "2026-10-19T21:43:47.392Z"
  }
}
report.readyA mission's incident report is written.

Data: report_id, mission_id, outcome, summary, detections, and the printable report's url.

report.ready · example
{
  "id": "evt_0afc92ec29cc",
  "seq": 41,
  "type": "report.ready",
  "time": "2026-10-19T21:34:46.141Z",
  "actor": "core",
  "subject": "rpt_ba61bdbb7b36",
  "data": {
    "report_id": "rpt_ba61bdbb7b36",
    "mission_id": "msn_e58e7523d2b5",
    "outcome": "completed",
    "summary": "Drone 2 checked a critical motion alert from East gate motion sensor 2 and saw 1 person. It landed back on its dock with 90% battery after flying 1.0 km.",
    "detections": 1,
    "url": "/v1/reports/rpt_ba61bdbb7b36?format=html"
  }
}
webhook.testSomeone asks for a test delivery.

Data: webhook_id, message. Sent only to that subscription.

webhook.test · example
{
  "id": "evt_3e86ddc85305",
  "seq": 49,
  "type": "webhook.test",
  "time": "2026-10-19T21:34:46.537Z",
  "actor": "key:partner",
  "subject": "whk_1cee4f976d10",
  "data": {
    "webhook_id": "whk_1cee4f976d10",
    "message": "Test delivery from Ochio core."
  }
}
vehicle.telemetryEvery second, on the live stream only. Not stored, no id or seq.

Data: vehicles (each one's id, lat, lon, alt_m, heading_deg, ground_speed_mps, battery_pct, status, mission_id, fault) and missions (each active one's id, status, vehicle_id, progress).

vehicle.telemetry · example
{
  "type": "vehicle.telemetry",
  "time": "2026-10-19T21:33:04.105Z",
  "data": {
    "vehicles": [
      {
        "id": "drone-1",
        "lat": 38.499,
        "lon": -98.001,
        "alt_m": 0.0,
        "heading_deg": 0.0,
        "ground_speed_mps": 0.0,
        "battery_pct": 100.0,
        "status": "docked",
        "mission_id": null,
        "fault": null
      },
      {
        "id": "drone-2",
        "lat": 38.4990139,
        "lon": -98.0006473,
        "alt_m": 40.0,
        "heading_deg": 71.4,
        "ground_speed_mps": 12.0,
        "battery_pct": 100.0,
        "status": "en_route",
        "mission_id": "msn_e58e7523d2b5",
        "fault": null
      }
    ],
    "missions": [
      {
        "id": "msn_e58e7523d2b5",
        "status": "en_route",
        "vehicle_id": "drone-2",
        "progress": {
          "phase": "en_route",
          "distance_to_target_m": 518,
          "eta_s": 43,
          "battery_pct": 100.0,
          "distance_flown_m": 5,
          "detections": 0
        }
      }
    ]
  }
}

Choosing events

Webhooks, the stream and the log take a list of event types. Each item is an exact type, a prefix like mission.*, or * for everything. In a query string, separate them with commas: ?types=mission.*,report.ready.

List events

GET/v1/events
AccessAPI key · read

Pages through the log in order. Start at after=0, then pass the next_after of each answer until has_more is false. Or ask for the newest few with tail.

Query
afterinteger
Return events after this seq. Default 0.
typesstring
Only these types, comma separated.
limitinteger
Events per page, 1 to 1,000. Default 100.
tailinteger
Return the newest N events instead (1 to 1,000), oldest first.
Returns

data (the events, oldest first), next_after (the last seq returned) and has_more.

Request
curl "$OCHIO_URL/v1/events?after=0&limit=3" \
  -H "Authorization: Bearer $OCHIO_API_KEY"
Response
{
  "data": [
    {
      "id": "evt_19ba21710b70",
      "seq": 1,
      "type": "sensor.registered",
      "time": "2026-10-19T21:30:10.072Z",
      "actor": "core",
      "subject": "north-fence-pir-01",
      "data": {
        "sensor_id": "north-fence-pir-01",
        "name": "North fence motion sensor",
        "type": "motion",
        "location": {
          "lat": 38.5033,
          "lon": -98.0032
        },
        "zone_id": "north-fence",
        "checkin_interval_s": 10.0,
        "missed_checkins_allowed": 2,
        "simulated": true,
        "origin": "site"
      }
    },
    {
      "id": "evt_41d81835bed4",
      "seq": 2,
      "type": "sensor.registered",
      "time": "2026-10-19T21:30:10.072Z",
      "actor": "core",
      "subject": "east-gate-cam-01",
      "data": {
        "sensor_id": "east-gate-cam-01",
        "name": "East gate camera",
        "type": "camera",
        "location": {
          "lat": 38.5009,
          "lon": -97.9944
        },
        "zone_id": "east-gate",
        "checkin_interval_s": 10.0,
        "missed_checkins_allowed": 2,
        "simulated": true,
        "origin": "site"
      }
    },
    {
      "id": "evt_4a9fd83f915e",
      "seq": 3,
      "type": "sensor.registered",
      "time": "2026-10-19T21:30:10.072Z",
      "actor": "core",
      "subject": "generator-yard-door-01",
      "data": {
        "sensor_id": "generator-yard-door-01",
        "name": "Generator yard door",
        "type": "door",
        "location": {
          "lat": 38.4979,
          "lon": -98.0047
        },
        "zone_id": "generator-yard",
        "checkin_interval_s": 10.0,
        "missed_checkins_allowed": 2,
        "simulated": true,
        "origin": "site"
      }
    }
  ],
  "next_after": 3,
  "has_more": true
}

Stream events

GET/v1/events/stream
AccessAPI key · readheader, or ?key= for browsers

Every event as it happens, as Server-Sent Events. Each frame carries the event's seq as its id and its type as the SSE event name.

The stream also sends a vehicle.telemetry frame every second with each vehicle's position, speed, battery and status, and each active mission's progress. Telemetry frames have no id and aren't stored in the log.

Query
typesstring
Only these types, comma separated. Leave out to get everything, telemetry included. Add vehicle.telemetry to a filter to keep the telemetry.
afterinteger
Send the log's events after this seq first, then live ones.
keystring
The API key, for browsers: EventSource can't send headers. Prefer the header everywhere else.
Headers
Last-Event-IDstring
On reconnect, the last id you received. Ochio sends what you missed, then carries on live. Browsers send it for you.
Returns

text/event-stream. The first frame tells clients to reconnect after 3 seconds. A client that falls far behind is disconnected, and picks up where it left off when it reconnects with Last-Event-ID.

A comment line keeps the connection open after 15 seconds with nothing to send, but telemetry counts even when your filter drops it, so a filtered stream can stay silent between events. Don't treat silence as a dropped connection, or add vehicle.telemetry to the filter to get a frame every second.

Request
curl -N "$OCHIO_URL/v1/events/stream?types=mission.*,vehicle.telemetry" \
  -H "Authorization: Bearer $OCHIO_API_KEY"
Response
retry: 3000

id: 10
event: mission.created
data: {"id":"evt_2e1180ee16a0","seq":10,"type":"mission.created","time":"2026-10-19T21:33:03.883Z","actor":"rule:perimeter-motion","subject":"msn_e58e7523d2b5","data":{"mission_id":"msn_e58e7523d2b5","type":"inspect","status":"en_route","priority":"high","target":{"kind":"alert","alert_id":"alt_5037deb6aeee","sensor_id":"east-gate-pir-02","location":{"lat":38.5005,"lon":-97.995},"zone_id":"east-gate","name":"East gate motion sensor 2"},"vehicle_id":"drone-2","trigger":{"kind":"alert","rule_id":"perimeter-motion","sensor_id":"east-gate-pir-02","alert_ids":["alt_5037deb6aeee"]},"approval":{"mode":"auto","required":false,"reasons":[],"decision":null,"decided_by":null,"decided_at":null,"note":null},"safety":{"result":"passed","checks":[{"name":"inside_operating_area","passed":true,"detail":"Target is inside the Depot operating area."},{"name":"outside_no_fly_zones","passed":true,"detail":"Target is clear of no-fly zones."},{"name":"vehicle_capable","passed":true,"detail":"2 vehicles with a camera."},{"name":"path_clear","passed":true,"detail":"The straight path from the dock is clear of no-fly zones."},{"name":"within_range","passed":true,"detail":"Round trip 1.0 km is within Drone 2's 6.0 km range."},{"name":"battery","passed":true,"detail":"Drone 1 has 100% battery."}],"checked_at":"2026-10-19T21:33:03.883Z"},"reason":"Motion on the perimeter: motion from East gate motion sensor 2","sim_speed":1.0}}

event: vehicle.telemetry
data: {"type":"vehicle.telemetry","time":"2026-10-19T21:33:04.105Z","data":{"vehicles":[{"id":"drone-1","lat":38.499,"lon":-98.001,"alt_m":0.0,"heading_deg":0.0,"ground_speed_mps":0.0,"battery_pct":100.0,"status":"docked","mission_id":null,"fault":null},{"id":"drone-2","lat":38.4990139,"lon":-98.0006473,"alt_m":40.0,"heading_deg":71.4,"ground_speed_mps":12.0,"battery_pct":100.0,"status":"en_route","mission_id":"msn_e58e7523d2b5","fault":null}],"missions":[{"id":"msn_e58e7523d2b5","status":"en_route","vehicle_id":"drone-2","progress":{"phase":"en_route","distance_to_target_m":518,"eta_s":43,"battery_pct":100.0,"distance_flown_m":5,"detections":0}}]}}

id: 18
event: mission.status_changed
data: {"id":"evt_cb43503a50dc","seq":18,"type":"mission.status_changed","time":"2026-10-19T21:33:07.216Z","actor":"key:operator","subject":"msn_ac7bd7106919","data":{"mission_id":"msn_ac7bd7106919","from":"pending_approval","to":"queued","type":"inspect","vehicle_id":null,"target":{"kind":"zone","zone_id":"generator-yard","location":{"lat":38.4976991,"lon":-98.0047977},"name":"Generator yard"},"note":"Approved: Go ahead. Waiting for a free vehicle."}}

Export events

GET/v1/events/export
AccessAPI key · read

The log as one file, one JSON event per line (NDJSON), up to the newest 100,000 events. Keep it as a record, or load it into a fresh sandbox with the replay tool to run the same night again.

Returns

application/x-ndjson, as the download export.ndjson.

Request
curl "$OCHIO_URL/v1/events/export" \
  -H "Authorization: Bearer $OCHIO_API_KEY" \
  -o export.ndjson
Response
HTTP/1.1 200 OK
Content-Disposition: attachment; filename="export.ndjson"

{"id":"evt_19ba21710b70","seq":1,"type":"sensor.registered","time":"2026-10-19T21:30:10.072Z","actor":"core","subject":"north-fence-pir-01","data":{"sensor_id":"north-fence-pir-01","name":"North fence motion sensor","type":"motion","location":{"lat":38.5033,"lon":-98.0032},"zone_id":"north-fence","checkin_interval_s":10.0,"missed_checkins_allowed":2,"simulated":true,"origin":"site"}}
{"id":"evt_41d81835bed4","seq":2,"type":"sensor.registered","time":"2026-10-19T21:30:10.072Z","actor":"core","subject":"east-gate-cam-01","data":{"sensor_id":"east-gate-cam-01","name":"East gate camera","type":"camera","location":{"lat":38.5009,"lon":-97.9944},"zone_id":"east-gate","checkin_interval_s":10.0,"missed_checkins_allowed":2,"simulated":true,"origin":"site"}}
{"id":"evt_4a9fd83f915e","seq":3,"type":"sensor.registered","time":"2026-10-19T21:30:10.072Z","actor":"core","subject":"generator-yard-door-01","data":{"sensor_id":"generator-yard-door-01","name":"Generator yard door","type":"door","location":{"lat":38.4979,"lon":-98.0047},"zone_id":"generator-yard","checkin_interval_s":10.0,"missed_checkins_allowed":2,"simulated":true,"origin":"site"}}