Errors
Every error has the same shape: an HTTP status, a code your program can check, and a message a person can read.
The error shape
The body of every error is one error object:
| Field | What it holds |
|---|---|
code | A short, stable code, like safety_check_failed. Check this in your code. |
message | A sentence for a person. It may change, so don't parse it. |
details | Present on some errors: the failed safety checks, the fields that aren't valid, or the scope a key is missing. |
Most requests that aren't valid list each problem in details, with the field it's about.
Response
{
"error": {
"code": "safety_check_failed",
"message": "Refused by the safety gate: Target is inside the Fuel farm no-fly zone.",
"details": {
"mission_id": "msn_d6d5f719f173",
"failed_checks": [
{
"name": "outside_no_fly_zones",
"passed": false,
"detail": "Target is inside the Fuel farm no-fly zone."
}
],
"mission": {
"id": "msn_d6d5f719f173",
"type": "inspect",
"status": "rejected",
"priority": "medium",
"reason": "Check the fuel farm",
"target": {
"kind": "zone",
"zone_id": "fuel-farm",
"location": {
"lat": 38.5004117,
"lon": -98.0068067
},
"name": "Fuel farm"
},
"patrol_points": null,
"vehicle_id": null,
"requested_vehicle_id": null,
"requested_by": "key:operator",
"trigger": {
"kind": "request",
"rule_id": null,
"sensor_id": null,
"alert_ids": [],
"client": null
},
"approval": {
"mode": "auto",
"required": false,
"reasons": [],
"decision": null,
"decided_by": null,
"decided_at": null,
"note": null
},
"safety": {
"result": "refused",
"checks": [
{
"name": "inside_operating_area",
"passed": true,
"detail": "Target is inside the Depot operating area."
},
{
"name": "outside_no_fly_zones",
"passed": false,
"detail": "Target is inside the Fuel farm no-fly zone."
},
{
"name": "vehicle_capable",
"passed": true,
"detail": "2 vehicles with a camera."
},
{
"name": "path_clear",
"passed": null,
"detail": "Not checked: the target is inside a no-fly zone."
},
{
"name": "within_range",
"passed": null,
"detail": "Not checked: no clear path."
},
{
"name": "battery",
"passed": null,
"detail": "Not checked: no vehicle can fly the route."
}
],
"checked_at": "2026-10-19T21:33:07.222Z"
},
"on_scene_s": 15.0,
"progress": {
"phase": "rejected"
},
"history": [
{
"status": "requested",
"time": "2026-10-19T21:33:07.222Z",
"actor": "key:operator",
"note": "Check the fuel farm"
},
{
"status": "rejected",
"time": "2026-10-19T21:33:07.222Z",
"actor": "core",
"note": "outside_no_fly_zones: Target is inside the Fuel farm no-fly zone."
}
],
"alert_ids": [],
"detection_ids": [],
"result": {
"outcome": "rejected",
"reason": "Refused by the safety gate",
"failed_checks": [
"outside_no_fly_zones"
]
},
"report_id": null,
"track": [],
"created_at": "2026-10-19T21:33:07.222Z",
"updated_at": "2026-10-19T21:33:07.222Z",
"started_at": null,
"ended_at": "2026-10-19T21:33:07.222Z"
}
}
}
}{
"error": {
"code": "invalid_request",
"message": "The request is not valid.",
"details": [
{
"field": "type",
"message": "Input should be 'inspect' or 'patrol'"
}
]
}
}{
"error": {
"code": "missing_scope",
"message": "This key does not have the admin scope.",
"details": {
"required_scope": "admin"
}
}
}HTTP statuses
| Status | Means |
|---|---|
200 OK | Done. Also the answer to an alert Ochio already had (updated, duplicate or stale). |
201 Created | A new alert, sensor, mission, webhook or key. |
400 Bad Request | The body or a parameter isn't valid. Fix the request before you send it again. |
401 Unauthorized | No key, a key Ochio doesn't know, or a sensor signature that doesn't check out. |
403 Forbidden | The key is valid but lacks the scope this needs. |
404 Not Found | No such record, or no such endpoint. |
405 Method Not Allowed | The path exists, but not with this method. |
409 Conflict | The request clashes with the record's state: approving a mission that isn't waiting, a sensor id that's taken. |
422 Unprocessable | The safety gate refused the mission. It's recorded as rejected and never flies. |
Error codes
| Code | Status | What happened | What to do |
|---|---|---|---|
invalid_request | 400 | A field is missing, has the wrong type, or is out of range. details usually lists each one. | Fix the fields named in details or the message. |
invalid_json | 400 | The body of an alert or check-in isn't valid JSON. | Send one JSON object. |
invalid_target | 400 | A mission's target doesn't have exactly one of its four kinds, names something that doesn't exist, or a patrol has no zone. | Send one target; patrols need zone_id. |
invalid_vehicle | 400 | vehicle_id names a vehicle that doesn't exist. | Use an id from GET /v1/vehicles. |
unauthorized | 401 | No API key, or not sent as Bearer. | Send Authorization: Bearer <key>. |
invalid_key | 401 | The key isn't valid. | Check the key; ask an admin for a new one. |
missing_signature | 401 | One of the two signature headers is missing. | Send both headers. |
invalid_signature | 401 | The signature doesn't match the body. | Sign the exact bytes you send, with the current secret. |
timestamp_out_of_range | 401 | The signing time is more than 300 seconds off. | Set the sensor's clock, then sign again. |
missing_scope | 403 | The key lacks the scope this needs; on most endpoints details.required_scope names it. | Use a key with that scope. |
not_found | 404 | No record with that id, or no such endpoint. | Check the id and the path. |
unknown_sensor | 404 | An alert, or a signed check-in, names a sensor that isn't registered. | Register it first. |
method_not_allowed | 405 | Wrong method for this path. | Check the method. |
sensor_exists | 409 | A sensor with that id is already registered. | Pick another id, or rotate the existing sensor's secret. |
key_exists | 409 | An API key with that name exists. | Pick another name. |
key_in_use | 409 | A key tried to revoke itself. | Revoke it with another admin key. |
invalid_state | 409 | The mission isn't in a state that allows this: approving one that isn't waiting, or cancelling one that has ended. | Read the mission's status first. |
alert_closed | 409 | The alert is already resolved or dismissed. | Nothing to do. |
idempotency_conflict | 409 | The Idempotency-Key was used before with a different body. | Use a new key for a new mission. |
not_simulated | 409 | A sandbox control was used on a real sensor. | Use it on simulated sensors only. |
safety_check_failed | 422 | The safety gate refused the mission. details.failed_checks says why. | Change the target or the vehicle. Don't retry as is. |
Retrying safely
- Network errors and
5xxanswers are worth retrying, with a growing wait.4xxanswers mean the request itself needs a change. - Alerts are safe to send again: the same
source,idandversionanswerduplicateand change nothing. - Missions are safe to send again with the same
Idempotency-Key: Ochio answers with the first mission instead of starting a second one, for 24 hours. - Approvals, denials and cancels can't happen twice: a second one answers
409 invalid_state. - Webhook deliveries are retried by Ochio. Receivers should skip an event
idthey've already handled.