API docs
API reference

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.

Attributes
idstring
Ochio's id for the alert, alt_….
sourcestring
The sensor it's about.
source_alert_idstring
The sender's own id for the incident (the id it sent).
versioninteger
The latest version received.
typestring
What happened, in the sender's words: motion, door_open, person.
prioritystring
low, medium, high or critical.
locationobject
Where it happened: {"lat", "lon"}.
zone_idstringor null
The zone the location falls in.
statusstring
open, responding, resolved or dismissed. See statuses.
mission_idstringor null
The mission answering it now.
mission_historyarray
Every mission that has answered it, oldest first.
timestring
When it happened (the sender's time, or when Ochio received it).
titlestringor null
A short headline from the sender.
descriptionstringor null
More detail from the sender.
media_urlstringor null
A link to a picture or clip from the sender.
dataobjector null
Anything else the sender attached, kept as sent.
received_bystring
Who sent it: sensor:<id> for a signed request, key:<name> for an API key.
dismissed_bystringor null
Who dismissed it.
resolved_atstringor null
When its mission completed.
created_atstring
When Ochio first received it.
updated_atstring
When it last changed.
The alert object
{
  "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

StatusMeans
openWaiting for a person, or for a mission: no rule matched, a rule is cooling down, or its mission ended without completing.
respondingA mission has taken it.
resolvedIts mission completed.
dismissedA 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 versionResultStatusRules
A new source and idcreated201Run
Higherupdated200Run again if it's open with no mission
The sameduplicate200Not run; nothing changes
Lowerstale200Not 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.

Response
{
  "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."
  }
}

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:

outcomeMeans
mission_createdA 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_missionA 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.
cooldownA drone looked at this sensor moments ago. The alert stays open; cooldown_left_s says for how long.
no_matchNo rule matched. The alert stays open for a person.
not_runAn update to an alert that already has a mission or is closed.
errorA rule matched but couldn't request a mission. detail says why.

The site's rules are listed by List rules.

Response
{
  "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

POST/v1/alerts
AccessSensor signatureorAPI key · alerts:write

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.

Headers
Ochio-Timestampstring
Unix time in whole seconds when the request was signed. Needed when a sensor signs the request.
Ochio-Signaturestring
v1= and the hex HMAC-SHA256 of the timestamp, a dot and the raw body, keyed with the sensor's secret. See Signing sensor requests.
Body

Fields Ochio doesn't know are ignored.

idstringrequired
The sender's own id for this incident, up to 128 characters. With source, it identifies the alert.
sourcestringrequired
The id of a registered sensor. A signed request must come from this sensor.
typestringrequired
What happened, in your words, up to 64 characters: motion, door_open, person, tamper.
prioritystring
low, medium, high or critical. Default medium. Rules can require a minimum.
timestring
When it happened: ISO 8601, or Unix seconds or milliseconds, between 2000 and 2100. Default: when Ochio receives it.
locationobject
Where it happened. Default: the sensor's location.
latnumberrequired
Latitude in decimal degrees, -90 to 90.
lonnumberrequired
Longitude in decimal degrees, -180 to 180.
versioninteger
Starts at 1. Send a higher number, with every field again, to update the alert.
titlestring
A short headline for people, up to 200 characters.
descriptionstring
More detail, up to 2,000 characters.
media_urlstring
A link to a picture or clip, up to 2,000 characters.
dataobject
Anything else to keep with the alert, as you send it.
Returns

201 for a new alert, 200 for one Ochio already had, with:

FieldHolds
resultcreated, updated, duplicate or stale.
alertThe alert.
missionThe mission answering it, as {"id", "status", "vehicle_id"}, or null. A refused mission adds failed_checks.
ruleWhat the rules did. Only for created and updated.
Errors
StatusCodeWhen
401invalid_signatureA signed request whose signature doesn't match. Nothing was recorded.
404unknown_sensorsource isn't a registered sensor.
400invalid_jsonThe body isn't JSON.
400invalid_requestA field is missing or out of range.
Request
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"
Response
{
  "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"
  }
}

List alerts

GET/v1/alerts
AccessAPI key · read

Alerts, newest first.

Query
statusstring
One status, or active for open and responding together.
limitinteger
How many to return, 1 to 1,000. Default 100.
Returns

{"data": [...]} with an alert for each.

Request
curl "$OCHIO_URL/v1/alerts?status=active" \
  -H "Authorization: Bearer $OCHIO_API_KEY"
Response
{
  "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

GET/v1/alerts/{alert_id}
AccessAPI key · read

One alert, by Ochio's id.

Path
alert_idstringrequired
The alert's id, alt_….
Returns

The alert.

Errors
StatusCodeWhen
404not_foundNo alert with this id.
Request
curl "$OCHIO_URL/v1/alerts/alt_5037deb6aeee" \
  -H "Authorization: Bearer $OCHIO_API_KEY"
Response
{
  "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

POST/v1/alerts/{alert_id}/dismiss
AccessAPI key · missions:approve

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.

Path
alert_idstringrequired
The alert's id.
Body

The body is optional.

notestring
A short note kept with the decision, up to 500 characters.
Returns

The alert, now dismissed. An alert.dismissed event goes out with the note as its reason.

Errors
StatusCodeWhen
409alert_closedIt's already resolved or dismissed.
404not_foundNo alert with this id.
Request
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"
  }'
Response
{
  "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"
}