Alerts
Sensors and connected systems report incidents as alerts. Ochio places each one in a zone, runs your site's rules on it, and links it to the mission that answers it.
The alert object
One alert per incident. The pair source and source_alert_id identifies it, so a sender can resend or update an alert without making a second one.
alt_….id it sent).motion, door_open, person.low, medium, high or critical.{"lat", "lon"}.sensor:<id> for a signed request, key:<name> for an API key.{
"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": "resolved",
"mission_id": "msn_e58e7523d2b5",
"mission_history": [
"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,
"received_by": "sensor:east-gate-pir-02",
"dismissed_by": null,
"resolved_at": "2026-10-19T21:34:46.141Z",
"created_at": "2026-10-19T21:33:03.882Z",
"updated_at": "2026-10-19T21:34:46.141Z"
}Statuses
| Status | Means |
|---|---|
open | Waiting for a person, or for a mission: no rule matched, a rule is cooling down, or its mission ended without completing. |
responding | A mission has taken it. |
resolved | Its mission completed. |
dismissed | A person closed it without a mission. |
An alert goes back to open if its mission fails, is cancelled, is denied, or is refused at approval, so a person can decide what happens next.
Updates and duplicates
Send the same alert again and Ochio compares its version with the one it has:
| Incoming version | Result | Status | Rules |
|---|---|---|---|
A new source and id | created | 201 | Run |
| Higher | updated | 200 | Run again if it's open with no mission |
| The same | duplicate | 200 | Not run; nothing changes |
| Lower | stale | 200 | Not run; ignored |
So retries are safe. To change an alert, for example to raise its priority when a camera confirms a person, send it again with a higher version.
An update replaces the alert, it doesn't merge, so send every field each time. Fields you leave out take their defaults: priority goes back to medium, location to the sensor's, and title, description, media_url and data are cleared. Only time is kept.
{
"result": "updated",
"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",
"mission_history": [
"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,
"received_by": "sensor:east-gate-pir-02",
"dismissed_by": null,
"resolved_at": null,
"created_at": "2026-10-19T21:33:03.882Z",
"updated_at": "2026-10-19T21:33:06.092Z"
},
"mission": {
"id": "msn_e58e7523d2b5",
"status": "en_route",
"vehicle_id": "drone-2"
},
"rule": {
"rule_id": null,
"outcome": "not_run",
"detail": "The alert already has a mission or is closed."
}
}{
"result": "duplicate",
"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": "responding",
"mission_id": "msn_e58e7523d2b5",
"mission_history": [
"msn_e58e7523d2b5"
],
"time": "2026-10-19T21:33:03.000Z",
"title": "Motion at the east gate",
"description": null,
"media_url": null,
"data": null,
"received_by": "sensor:east-gate-pir-02",
"dismissed_by": null,
"resolved_at": null,
"created_at": "2026-10-19T21:33:03.882Z",
"updated_at": "2026-10-19T21:33:03.883Z"
},
"mission": {
"id": "msn_e58e7523d2b5",
"status": "en_route",
"vehicle_id": "drone-2"
}
}{
"result": "stale",
"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",
"mission_history": [
"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,
"received_by": "sensor:east-gate-pir-02",
"dismissed_by": null,
"resolved_at": null,
"created_at": "2026-10-19T21:33:03.882Z",
"updated_at": "2026-10-19T21:33:06.092Z"
},
"mission": {
"id": "msn_e58e7523d2b5",
"status": "en_route",
"vehicle_id": "drone-2"
}
}What the rules did
The answer to a new or updated alert carries a rule object, so the sender knows at once what Ochio will do:
outcome | Means |
|---|---|
mission_created | A rule matched and requested a mission. mission_status says how it starts: on its way, queued, waiting for approval, or rejected if the safety gate refused it (the alert then stays open, and mission.failed_checks says why). |
joined_active_mission | A mission for the same sensor is already waiting for approval, queued, on its way or over the target, and the alert joins it. An automatic rule doesn't wait behind a mission that's waiting for approval; it starts its own. |
cooldown | A drone looked at this sensor moments ago. The alert stays open; cooldown_left_s says for how long. |
no_match | No rule matched. The alert stays open for a person. |
not_run | An update to an alert that already has a mission or is closed. |
error | A rule matched but couldn't request a mission. detail says why. |
The site's rules are listed by List rules.
{
"result": "created",
"alert": {
"id": "alt_174f5ffd8217",
"source": "north-fence-pir-01",
"source_alert_id": "vms-77120",
"version": 1,
"type": "vehicle",
"priority": "low",
"location": {
"lat": 38.5033,
"lon": -98.0032
},
"zone_id": "north-fence",
"status": "open",
"mission_id": null,
"mission_history": [],
"time": "2026-10-19T21:33:07.201Z",
"title": "Vehicle stopped by the north fence",
"description": null,
"media_url": "https://vms.example.com/clips/77120.mp4",
"data": {
"camera": "NF-CAM-3",
"plate": "unknown"
},
"received_by": "key:partner",
"dismissed_by": null,
"resolved_at": null,
"created_at": "2026-10-19T21:33:07.201Z",
"updated_at": "2026-10-19T21:33:07.201Z"
},
"mission": null,
"rule": {
"rule_id": null,
"outcome": "no_match",
"detail": "No rule matched; the alert stays open."
}
}Send an alert
Reports an incident. A sensor signs the request with its secret. A connected system, such as a camera system or an alarm panel, can send it with an API key that has alerts:write instead.
Ochio places the alert in the zone its location falls in, runs the site's rules, and answers with the alert, the mission it started (if any) and what the rules did.
Headersv1= and the hex HMAC-SHA256 of the timestamp, a dot and the raw body, keyed with the sensor's secret. See Signing sensor requests.Fields Ochio doesn't know are ignored.
source, it identifies the alert.motion, door_open, person, tamper.low, medium, high or critical. Default medium. Rules can require a minimum.201 for a new alert, 200 for one Ochio already had, with:
| Field | Holds |
|---|---|
result | created, updated, duplicate or stale. |
alert | The alert. |
mission | The mission answering it, as {"id", "status", "vehicle_id"}, or null. A refused mission adds failed_checks. |
rule | What the rules did. Only for created and updated. |
| Status | Code | When |
|---|---|---|
401 | invalid_signature | A signed request whose signature doesn't match. Nothing was recorded. |
404 | unknown_sensor | source isn't a registered sensor. |
400 | invalid_json | The body isn't JSON. |
400 | invalid_request | A field is missing or out of range. |
BODY='{"id":"pir02-000412","source":"east-gate-pir-02","type":"motion","priority":"high","time":"2026-10-19T21:33:03Z","title":"Motion at the east gate"}'
TS=$(date +%s)
SIG=$(printf '%s.%s' "$TS" "$BODY" | openssl dgst -sha256 -hmac "$SENSOR_SECRET" | awk '{print $NF}')
curl -X POST "$OCHIO_URL/v1/alerts" \
-H "Content-Type: application/json" \
-H "Ochio-Timestamp: $TS" \
-H "Ochio-Signature: v1=$SIG" \
-d "$BODY"import hashlib, hmac, json, os, time
import requests
secret = os.environ["SENSOR_SECRET"]
body = json.dumps({
"id": "pir02-000412",
"source": "east-gate-pir-02",
"type": "motion",
"priority": "high",
"time": "2026-10-19T21:33:03Z",
"title": "Motion at the east gate"
}).encode()
ts = str(int(time.time()))
sig = hmac.new(secret.encode(), f"{ts}.".encode() + body, hashlib.sha256).hexdigest()
r = requests.post(f"{os.environ['OCHIO_URL']}/v1/alerts", data=body, headers={
"Content-Type": "application/json",
"Ochio-Timestamp": ts,
"Ochio-Signature": f"v1={sig}",
})
print(r.status_code, r.json())import crypto from "node:crypto";
const body = JSON.stringify({
id: "pir02-000412",
source: "east-gate-pir-02",
type: "motion",
priority: "high",
time: "2026-10-19T21:33:03Z",
title: "Motion at the east gate"
});
const ts = Math.floor(Date.now() / 1000).toString();
const sig = crypto.createHmac("sha256", process.env.SENSOR_SECRET).update(`${ts}.${body}`).digest("hex");
const res = await fetch(`${process.env.OCHIO_URL}/v1/alerts`, {
method: "POST",
headers: { "Content-Type": "application/json", "Ochio-Timestamp": ts, "Ochio-Signature": `v1=${sig}` },
body,
});
console.log(res.status, await res.json());{
"result": "created",
"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": "responding",
"mission_id": "msn_e58e7523d2b5",
"mission_history": [
"msn_e58e7523d2b5"
],
"time": "2026-10-19T21:33:03.000Z",
"title": "Motion at the east gate",
"description": null,
"media_url": null,
"data": null,
"received_by": "sensor:east-gate-pir-02",
"dismissed_by": null,
"resolved_at": null,
"created_at": "2026-10-19T21:33:03.882Z",
"updated_at": "2026-10-19T21:33:03.883Z"
},
"mission": {
"id": "msn_e58e7523d2b5",
"status": "en_route",
"vehicle_id": "drone-2"
},
"rule": {
"rule_id": "perimeter-motion",
"outcome": "mission_created",
"mission_id": "msn_e58e7523d2b5",
"mission_status": "en_route"
}
}{
"error": {
"code": "invalid_signature",
"message": "The signature does not match the body. Nothing was recorded."
}
}{
"error": {
"code": "unknown_sensor",
"message": "No registered sensor with id 'no-such-sensor'."
}
}List alerts
Alerts, newest first.
Queryactive for open and responding together.{"data": [...]} with an alert for each.
curl "$OCHIO_URL/v1/alerts?status=active" \
-H "Authorization: Bearer $OCHIO_API_KEY"import os
import requests
r = requests.get(
f"{os.environ['OCHIO_URL']}/v1/alerts",
headers={"Authorization": f"Bearer {os.environ['OCHIO_API_KEY']}"},
params={
"status": "active"
},
)
print(r.status_code, r.json())const res = await fetch(`${process.env.OCHIO_URL}/v1/alerts?status=active`, {
headers: { Authorization: `Bearer ${process.env.OCHIO_API_KEY}` },
});
console.log(res.status, await res.json());{
"data": [
{
"id": "alt_174f5ffd8217",
"source": "north-fence-pir-01",
"source_alert_id": "vms-77120",
"version": 1,
"type": "vehicle",
"priority": "low",
"location": {
"lat": 38.5033,
"lon": -98.0032
},
"zone_id": "north-fence",
"status": "open",
"mission_id": null,
"mission_history": [],
"time": "2026-10-19T21:33:07.201Z",
"title": "Vehicle stopped by the north fence",
"description": null,
"media_url": "https://vms.example.com/clips/77120.mp4",
"data": {
"camera": "NF-CAM-3",
"plate": "unknown"
},
"received_by": "key:partner",
"dismissed_by": null,
"resolved_at": null,
"created_at": "2026-10-19T21:33:07.201Z",
"updated_at": "2026-10-19T21:33:07.201Z"
},
{
"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",
"mission_history": [
"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,
"received_by": "sensor:east-gate-pir-02",
"dismissed_by": null,
"resolved_at": null,
"created_at": "2026-10-19T21:33:03.882Z",
"updated_at": "2026-10-19T21:33:06.092Z"
}
]
}Get an alert
One alert, by Ochio's id.
Pathalt_….The alert.
Errors| Status | Code | When |
|---|---|---|
404 | not_found | No alert with this id. |
curl "$OCHIO_URL/v1/alerts/alt_5037deb6aeee" \
-H "Authorization: Bearer $OCHIO_API_KEY"import os
import requests
r = requests.get(
f"{os.environ['OCHIO_URL']}/v1/alerts/alt_5037deb6aeee",
headers={"Authorization": f"Bearer {os.environ['OCHIO_API_KEY']}"},
)
print(r.status_code, r.json())const res = await fetch(`${process.env.OCHIO_URL}/v1/alerts/alt_5037deb6aeee`, {
headers: { Authorization: `Bearer ${process.env.OCHIO_API_KEY}` },
});
console.log(res.status, await res.json());{
"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",
"mission_history": [
"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,
"received_by": "sensor:east-gate-pir-02",
"dismissed_by": null,
"resolved_at": null,
"created_at": "2026-10-19T21:33:03.882Z",
"updated_at": "2026-10-19T21:33:06.092Z"
}Dismiss an alert
Closes an alert without a mission, for example a delivery van a person recognizes on camera. Dismissing doesn't stop a mission that's already answering it; cancel the mission for that.
PathThe body is optional.
The alert, now dismissed. An alert.dismissed event goes out with the note as its reason.
| Status | Code | When |
|---|---|---|
409 | alert_closed | It's already resolved or dismissed. |
404 | not_found | No alert with this id. |
curl -X POST "$OCHIO_URL/v1/alerts/alt_174f5ffd8217/dismiss" \
-H "Authorization: Bearer $OCHIO_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"note": "Delivery van, expected"
}'import os
import requests
r = requests.post(
f"{os.environ['OCHIO_URL']}/v1/alerts/alt_174f5ffd8217/dismiss",
headers={"Authorization": f"Bearer {os.environ['OCHIO_API_KEY']}"},
json={
"note": "Delivery van, expected"
},
)
print(r.status_code, r.json())const res = await fetch(`${process.env.OCHIO_URL}/v1/alerts/alt_174f5ffd8217/dismiss`, {
method: "POST",
headers: {
Authorization: `Bearer ${process.env.OCHIO_API_KEY}`,
"Content-Type": "application/json",
},
body: JSON.stringify({
note: "Delivery van, expected"
}),
});
console.log(res.status, await res.json());{
"id": "alt_174f5ffd8217",
"source": "north-fence-pir-01",
"source_alert_id": "vms-77120",
"version": 1,
"type": "vehicle",
"priority": "low",
"location": {
"lat": 38.5033,
"lon": -98.0032
},
"zone_id": "north-fence",
"status": "dismissed",
"mission_id": null,
"mission_history": [],
"time": "2026-10-19T21:33:07.201Z",
"title": "Vehicle stopped by the north fence",
"description": null,
"media_url": "https://vms.example.com/clips/77120.mp4",
"data": {
"camera": "NF-CAM-3",
"plate": "unknown"
},
"received_by": "key:partner",
"dismissed_by": "key:operator",
"resolved_at": null,
"created_at": "2026-10-19T21:33:07.201Z",
"updated_at": "2026-10-19T21:34:46.520Z"
}{
"error": {
"code": "alert_closed",
"message": "Alert alt_174f5ffd8217 is already dismissed."
}
}