{
  "openapi": "3.1.0",
  "info": {
    "title": "Ochio API",
    "version": "1.0.0",
    "summary": "Alerts in, drone missions inside safety limits, results out.",
    "description": "Send alerts from any sensor or security system, start drone missions inside your site's safety limits, and get every result back the moment it happens. Ochio runs on premise or in your cloud: each site's API is served by its own Ochio server. Apps authenticate with an API key (`Authorization: Bearer ochio_…`); sensors sign each request with their own secret (`Ochio-Timestamp` and `Ochio-Signature`).",
    "contact": {
      "name": "Ochio",
      "email": "contact@ochio.ai"
    }
  },
  "servers": [
    {
      "url": "{baseUrl}",
      "description": "Your Ochio server",
      "variables": {
        "baseUrl": {
          "default": "http://127.0.0.1:8700",
          "description": "The address of your Ochio server, or the sandbox"
        }
      }
    }
  ],
  "security": [
    {
      "apiKey": []
    }
  ],
  "tags": [
    {
      "name": "Sensors",
      "description": "A sensor is anything that raises alerts and checks in: a motion sensor, a door contact, a camera, a radar. One that goes quiet is treated as an event, because a cut or jammed sensor is a warning in itself."
    },
    {
      "name": "Alerts",
      "description": "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."
    },
    {
      "name": "Missions",
      "description": "A mission is a task for one vehicle. Rules, Mission Control, Claude and your own apps all start missions through the same endpoint, and every one of them passes the safety gate."
    },
    {
      "name": "Site and fleet",
      "description": "Read the site the way Mission Control sees it: its status at a glance, the vehicles, the zones on the map, and the rules that turn alerts into missions."
    },
    {
      "name": "Detections and reports",
      "description": "What the drones saw, and the incident report Ochio writes the moment each mission ends."
    },
    {
      "name": "Events and live stream",
      "description": "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."
    },
    {
      "name": "Webhooks",
      "description": "Ochio sends the events you choose to your own URL, signed, as they happen, and keeps trying until you answer."
    },
    {
      "name": "API keys",
      "description": "Give each app or connected system its own key, with only the scopes it needs, and revoke it when it's done."
    },
    {
      "name": "Sandbox",
      "description": "A copy of Ochio that runs on your computer, with a simulated site, drones and sensors behind the real API. Build and test your integration against it before it meets a real site."
    }
  ],
  "paths": {
    "/v1/sensors": {
      "post": {
        "tags": [
          "Sensors"
        ],
        "summary": "Register a sensor",
        "operationId": "register_a_sensor",
        "description": "Adds a sensor and gives it its secret. The answer is the only time Ochio shows the secret: give it to the sensor, which signs its requests with it. Needs the `sensors:write` scope.",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/SensorCreate"
              },
              "example": {
                "id": "east-gate-pir-02",
                "name": "East gate motion sensor 2",
                "type": "motion",
                "location": {
                  "lat": 38.5005,
                  "lon": -97.995
                },
                "checkin_interval_s": 10,
                "missed_checkins_allowed": 2
              }
            }
          }
        },
        "responses": {
          "201": {
            "description": "Created",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/SensorWithSecret"
                },
                "examples": {
                  "created": {
                    "summary": "Created",
                    "value": {
                      "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,
                      "status": "pending",
                      "last_seen": null,
                      "expires_at": null,
                      "battery_pct": null,
                      "reported_status": null,
                      "simulated": false,
                      "origin": "api",
                      "created_at": "2026-10-19T21:33:02.764Z",
                      "updated_at": "2026-10-19T21:33:02.764Z",
                      "secret": "ssk_test_example_secret_000000000001"
                    }
                  }
                }
              }
            }
          },
          "400": {
            "description": "invalid_request: A field is missing or out of range.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "409": {
            "description": "sensor_exists: A sensor with this id exists. To give it a new secret, rotate it instead.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                },
                "examples": {
                  "sensor_exists": {
                    "value": {
                      "error": {
                        "code": "sensor_exists",
                        "message": "A sensor with id 'east-gate-pir-02' already exists. POST /v1/sensors/east-gate-pir-02/rotate-secret issues a new secret."
                      }
                    }
                  }
                }
              }
            }
          }
        }
      },
      "get": {
        "tags": [
          "Sensors"
        ],
        "summary": "List sensors",
        "operationId": "list_sensors",
        "description": "Every registered sensor, with its status. Needs the `read` scope.",
        "parameters": [
          {
            "name": "status",
            "in": "query",
            "required": false,
            "description": "Only sensors in this status: pending , online or silent .",
            "schema": {
              "type": "string",
              "enum": [
                "pending",
                "online",
                "silent"
              ]
            }
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/SensorList"
                },
                "examples": {
                  "ok": {
                    "summary": "OK",
                    "value": {
                      "data": [
                        {
                          "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,
                          "status": "silent",
                          "last_seen": "2026-10-19T21:39:43.634Z",
                          "expires_at": "2026-10-19T21:40:03.634Z",
                          "battery_pct": null,
                          "reported_status": null,
                          "simulated": true,
                          "origin": "site",
                          "created_at": "2026-10-19T21:30:10.072Z",
                          "updated_at": "2026-10-19T21:40:03.755Z"
                        }
                      ]
                    }
                  }
                }
              }
            }
          }
        }
      }
    },
    "/v1/sensors/{sensor_id}/heartbeat": {
      "post": {
        "tags": [
          "Sensors"
        ],
        "summary": "Check in",
        "operationId": "check_in",
        "description": "The sensor's regular sign of life, signed with its secret. Send it every checkin_interval_s seconds. An alert from the sensor counts as a check-in too. Needs the `alerts:write` scope.",
        "parameters": [
          {
            "name": "sensor_id",
            "in": "path",
            "required": true,
            "description": "The sensor's id.",
            "schema": {
              "type": "string"
            }
          }
        ],
        "security": [
          {
            "sensorTimestamp": [],
            "sensorSignature": []
          },
          {
            "apiKey": []
          }
        ],
        "requestBody": {
          "required": false,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/Heartbeat"
              },
              "example": {
                "battery_pct": 87,
                "status": "ok"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Checked in",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HeartbeatResult"
                },
                "examples": {
                  "checked_in": {
                    "summary": "Checked in",
                    "value": {
                      "sensor_id": "east-gate-pir-02",
                      "status": "online",
                      "next_checkin_by": "2026-10-19T21:33:12.770Z",
                      "expires_at": "2026-10-19T21:33:22.770Z"
                    }
                  },
                  "repeat": {
                    "summary": "Repeat",
                    "value": {
                      "sensor_id": "east-gate-pir-02",
                      "status": "online",
                      "next_checkin_by": "2026-10-19T21:33:12.770Z",
                      "expires_at": "2026-10-19T21:33:22.770Z",
                      "repeat": true
                    }
                  }
                }
              }
            }
          },
          "401": {
            "description": "invalid_signature: The signature doesn't match. See Signing .",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "404": {
            "description": "unknown_sensor: A signed check-in for a sensor that isn't registered. · not_found: The same, sent with an API key.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      }
    },
    "/v1/sensors/{sensor_id}": {
      "get": {
        "tags": [
          "Sensors"
        ],
        "summary": "Get a sensor",
        "operationId": "get_a_sensor",
        "description": "One sensor, by id. Needs the `read` scope.",
        "parameters": [
          {
            "name": "sensor_id",
            "in": "path",
            "required": true,
            "description": "The sensor's id.",
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Sensor"
                },
                "examples": {
                  "ok": {
                    "summary": "OK",
                    "value": {
                      "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,
                      "status": "online",
                      "last_seen": "2026-10-19T21:33:03.876Z",
                      "expires_at": "2026-10-19T21:33:23.876Z",
                      "battery_pct": 87.0,
                      "reported_status": "ok",
                      "simulated": false,
                      "origin": "api",
                      "created_at": "2026-10-19T21:33:02.764Z",
                      "updated_at": "2026-10-19T21:33:03.876Z"
                    }
                  }
                }
              }
            }
          },
          "404": {
            "description": "not_found: No sensor with this id.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      },
      "delete": {
        "tags": [
          "Sensors"
        ],
        "summary": "Remove a sensor",
        "operationId": "remove_a_sensor",
        "description": "Removes the sensor. Its alerts stay, and its secret stops working. A sensor.removed event goes out. Needs the `sensors:write` scope.",
        "parameters": [
          {
            "name": "sensor_id",
            "in": "path",
            "required": true,
            "description": "The sensor's id.",
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Deleted"
                },
                "examples": {
                  "ok": {
                    "summary": "OK",
                    "value": {
                      "id": "east-gate-pir-02",
                      "deleted": true
                    }
                  }
                }
              }
            }
          },
          "404": {
            "description": "not_found: No sensor with this id.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      }
    },
    "/v1/sensors/{sensor_id}/rotate-secret": {
      "post": {
        "tags": [
          "Sensors"
        ],
        "summary": "Rotate a sensor's secret",
        "operationId": "rotate_a_sensor_secret",
        "description": "Gives the sensor a new secret. The old one stops working at once, so update the sensor right after. Use it when a secret may have leaked, or when you replace the device. Needs the `sensors:write` scope.",
        "parameters": [
          {
            "name": "sensor_id",
            "in": "path",
            "required": true,
            "description": "The sensor's id.",
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/SensorSecret"
                },
                "examples": {
                  "ok": {
                    "summary": "OK",
                    "value": {
                      "sensor_id": "east-gate-pir-02",
                      "secret": "ssk_test_example_secret_000000000002"
                    }
                  }
                }
              }
            }
          },
          "404": {
            "description": "not_found: No sensor with this id.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      }
    },
    "/v1/alerts": {
      "post": {
        "tags": [
          "Alerts"
        ],
        "summary": "Send an alert",
        "operationId": "send_an_alert",
        "description": "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. Needs the `alerts:write` scope.",
        "security": [
          {
            "sensorTimestamp": [],
            "sensorSignature": []
          },
          {
            "apiKey": []
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/AlertCreate"
              },
              "example": {
                "id": "pir02-000412",
                "source": "east-gate-pir-02",
                "type": "motion",
                "priority": "high",
                "time": "2026-10-19T21:33:03Z",
                "title": "Motion at the east gate"
              }
            }
          }
        },
        "responses": {
          "201": {
            "description": "Created",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/AlertResult"
                },
                "examples": {
                  "created": {
                    "summary": "Created",
                    "value": {
                      "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"
                      }
                    }
                  }
                }
              }
            }
          },
          "400": {
            "description": "invalid_json: The body isn't JSON. · invalid_request: A field is missing or out of range.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "401": {
            "description": "invalid_signature: A signed request whose signature doesn't match. Nothing was recorded.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                },
                "examples": {
                  "invalid_signature": {
                    "value": {
                      "error": {
                        "code": "invalid_signature",
                        "message": "The signature does not match the body. Nothing was recorded."
                      }
                    }
                  }
                }
              }
            }
          },
          "404": {
            "description": "unknown_sensor: source isn't a registered sensor.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                },
                "examples": {
                  "unknown_sensor": {
                    "value": {
                      "error": {
                        "code": "unknown_sensor",
                        "message": "No registered sensor with id 'no-such-sensor'."
                      }
                    }
                  }
                }
              }
            }
          }
        }
      },
      "get": {
        "tags": [
          "Alerts"
        ],
        "summary": "List alerts",
        "operationId": "list_alerts",
        "description": "Alerts, newest first. Needs the `read` scope.",
        "parameters": [
          {
            "name": "status",
            "in": "query",
            "required": false,
            "description": "One status, or active for open and responding together.",
            "schema": {
              "type": "string",
              "enum": [
                "open",
                "responding",
                "resolved",
                "dismissed",
                "active"
              ]
            }
          },
          {
            "name": "limit",
            "in": "query",
            "required": false,
            "description": "How many to return, 1 to 1,000. Default 100.",
            "schema": {
              "type": "integer",
              "default": 100,
              "minimum": 1,
              "maximum": 1000
            }
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/AlertList"
                },
                "examples": {
                  "ok": {
                    "summary": "OK",
                    "value": {
                      "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"
                        }
                      ]
                    }
                  }
                }
              }
            }
          }
        }
      }
    },
    "/v1/alerts/{alert_id}": {
      "get": {
        "tags": [
          "Alerts"
        ],
        "summary": "Get an alert",
        "operationId": "get_an_alert",
        "description": "One alert, by Ochio's id. Needs the `read` scope.",
        "parameters": [
          {
            "name": "alert_id",
            "in": "path",
            "required": true,
            "description": "The alert's id, alt_… .",
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Alert"
                },
                "examples": {
                  "ok": {
                    "summary": "OK",
                    "value": {
                      "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"
                    }
                  }
                }
              }
            }
          },
          "404": {
            "description": "not_found: No alert with this id.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      }
    },
    "/v1/alerts/{alert_id}/dismiss": {
      "post": {
        "tags": [
          "Alerts"
        ],
        "summary": "Dismiss an alert",
        "operationId": "dismiss_an_alert",
        "description": "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. Needs the `missions:approve` scope.",
        "parameters": [
          {
            "name": "alert_id",
            "in": "path",
            "required": true,
            "description": "The alert's id.",
            "schema": {
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "required": false,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/Note"
              },
              "example": {
                "note": "Delivery van, expected"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Dismissed",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Alert"
                },
                "examples": {
                  "dismissed": {
                    "summary": "Dismissed",
                    "value": {
                      "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"
                    }
                  }
                }
              }
            }
          },
          "404": {
            "description": "not_found: No alert with this id.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "409": {
            "description": "alert_closed: It's already resolved or dismissed.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                },
                "examples": {
                  "alert_closed": {
                    "value": {
                      "error": {
                        "code": "alert_closed",
                        "message": "Alert alt_174f5ffd8217 is already dismissed."
                      }
                    }
                  }
                }
              }
            }
          }
        }
      }
    },
    "/v1/missions": {
      "post": {
        "tags": [
          "Missions"
        ],
        "summary": "Request a mission",
        "operationId": "request_a_mission",
        "description": "Asks Ochio to send a vehicle. The safety gate checks the request, the approval rules decide whether it waits for a person, and Ochio picks the vehicle unless you name one. Send an Idempotency-Key so a retry never starts a second drone. Needs the `missions:request` scope.",
        "parameters": [
          {
            "name": "Idempotency-Key",
            "in": "header",
            "required": false,
            "description": "A unique key for this mission, up to 255 characters, like a UUID. The same key and body from the same API key within 24 hours returns the first answer, with Idempotent-Replayed: true , instead of starting another mission.",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "Ochio-Client",
            "in": "header",
            "required": false,
            "description": "The name of your app. Its first 40 characters are kept in trigger.client , so people can see where a mission came from.",
            "schema": {
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/MissionCreate"
              },
              "example": {
                "type": "patrol",
                "target": {
                  "zone_id": "north-fence"
                },
                "priority": "medium",
                "reason": "Evening patrol of the north fence"
              }
            }
          }
        },
        "responses": {
          "201": {
            "description": "Created",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Mission"
                },
                "examples": {
                  "created": {
                    "summary": "Created",
                    "value": {
                      "id": "msn_520f729ca856",
                      "type": "patrol",
                      "status": "en_route",
                      "priority": "medium",
                      "reason": "Evening patrol of the north fence",
                      "target": {
                        "kind": "zone",
                        "zone_id": "north-fence",
                        "location": {
                          "lat": 38.5037001,
                          "lon": -98.0030001
                        },
                        "name": "North fence"
                      },
                      "patrol_points": [
                        {
                          "lat": 38.5025,
                          "lon": -98.0065
                        },
                        {
                          "lat": 38.5047,
                          "lon": -98.0065
                        },
                        {
                          "lat": 38.5049,
                          "lon": -97.9995
                        },
                        {
                          "lat": 38.5027,
                          "lon": -97.9995
                        }
                      ],
                      "vehicle_id": "drone-1",
                      "requested_vehicle_id": null,
                      "requested_by": "key:operator",
                      "trigger": {
                        "kind": "request",
                        "rule_id": null,
                        "sensor_id": null,
                        "alert_ids": [],
                        "client": "night-desk"
                      },
                      "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 2.6 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:07.207Z"
                      },
                      "on_scene_s": 15.0,
                      "progress": {
                        "phase": "en_route",
                        "distance_to_target_m": 432,
                        "eta_s": 36,
                        "battery_pct": 100.0,
                        "distance_flown_m": 0,
                        "detections": 0
                      },
                      "history": [
                        {
                          "status": "requested",
                          "time": "2026-10-19T21:33:07.207Z",
                          "actor": "key:operator",
                          "note": "Evening patrol of the north fence"
                        },
                        {
                          "status": "en_route",
                          "time": "2026-10-19T21:33:07.208Z",
                          "actor": "vehicle:drone-1",
                          "note": "Drone 1 launched"
                        }
                      ],
                      "alert_ids": [],
                      "detection_ids": [],
                      "result": null,
                      "report_id": null,
                      "track": [
                        [
                          38.499,
                          -98.001
                        ]
                      ],
                      "created_at": "2026-10-19T21:33:07.207Z",
                      "updated_at": "2026-10-19T21:33:07.207Z",
                      "started_at": "2026-10-19T21:33:07.208Z",
                      "ended_at": null
                    }
                  },
                  "waits_for_approval": {
                    "summary": "Waits for approval",
                    "value": {
                      "id": "msn_ac7bd7106919",
                      "type": "inspect",
                      "status": "pending_approval",
                      "priority": "medium",
                      "reason": "Check the generator yard before the shift change",
                      "target": {
                        "kind": "zone",
                        "zone_id": "generator-yard",
                        "location": {
                          "lat": 38.4976991,
                          "lon": -98.0047977
                        },
                        "name": "Generator yard"
                      },
                      "patrol_points": null,
                      "vehicle_id": null,
                      "requested_vehicle_id": null,
                      "requested_by": "key:partner",
                      "trigger": {
                        "kind": "request",
                        "rule_id": null,
                        "sensor_id": null,
                        "alert_ids": [],
                        "client": null
                      },
                      "approval": {
                        "mode": "auto",
                        "required": true,
                        "reasons": [
                          "key:partner can request missions but not launch them"
                        ],
                        "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 0.7 km is within Drone 1's 6.0 km range."
                          },
                          {
                            "name": "battery",
                            "passed": true,
                            "detail": "Drone 1 has 100% battery."
                          }
                        ],
                        "checked_at": "2026-10-19T21:33:07.212Z"
                      },
                      "on_scene_s": 15.0,
                      "progress": {
                        "phase": "pending_approval"
                      },
                      "history": [
                        {
                          "status": "requested",
                          "time": "2026-10-19T21:33:07.212Z",
                          "actor": "key:partner",
                          "note": "Check the generator yard before the shift change"
                        },
                        {
                          "status": "pending_approval",
                          "time": "2026-10-19T21:33:07.212Z",
                          "actor": "core",
                          "note": "key:partner can request missions but not launch them"
                        }
                      ],
                      "alert_ids": [],
                      "detection_ids": [],
                      "result": null,
                      "report_id": null,
                      "track": [],
                      "created_at": "2026-10-19T21:33:07.212Z",
                      "updated_at": "2026-10-19T21:33:07.212Z",
                      "started_at": null,
                      "ended_at": null
                    }
                  },
                  "replayed": {
                    "summary": "Replayed",
                    "value": {
                      "id": "msn_520f729ca856",
                      "type": "patrol",
                      "status": "en_route",
                      "priority": "medium",
                      "reason": "Evening patrol of the north fence",
                      "target": {
                        "kind": "zone",
                        "zone_id": "north-fence",
                        "location": {
                          "lat": 38.5037001,
                          "lon": -98.0030001
                        },
                        "name": "North fence"
                      },
                      "patrol_points": [
                        {
                          "lat": 38.5025,
                          "lon": -98.0065
                        },
                        {
                          "lat": 38.5047,
                          "lon": -98.0065
                        },
                        {
                          "lat": 38.5049,
                          "lon": -97.9995
                        },
                        {
                          "lat": 38.5027,
                          "lon": -97.9995
                        }
                      ],
                      "vehicle_id": "drone-1",
                      "requested_vehicle_id": null,
                      "requested_by": "key:operator",
                      "trigger": {
                        "kind": "request",
                        "rule_id": null,
                        "sensor_id": null,
                        "alert_ids": [],
                        "client": "night-desk"
                      },
                      "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 2.6 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:07.207Z"
                      },
                      "on_scene_s": 15.0,
                      "progress": {
                        "phase": "en_route",
                        "distance_to_target_m": 432,
                        "eta_s": 36,
                        "battery_pct": 100.0,
                        "distance_flown_m": 0,
                        "detections": 0
                      },
                      "history": [
                        {
                          "status": "requested",
                          "time": "2026-10-19T21:33:07.207Z",
                          "actor": "key:operator",
                          "note": "Evening patrol of the north fence"
                        },
                        {
                          "status": "en_route",
                          "time": "2026-10-19T21:33:07.208Z",
                          "actor": "vehicle:drone-1",
                          "note": "Drone 1 launched"
                        }
                      ],
                      "alert_ids": [],
                      "detection_ids": [],
                      "result": null,
                      "report_id": null,
                      "track": [
                        [
                          38.499,
                          -98.001
                        ]
                      ],
                      "created_at": "2026-10-19T21:33:07.207Z",
                      "updated_at": "2026-10-19T21:33:07.207Z",
                      "started_at": "2026-10-19T21:33:07.208Z",
                      "ended_at": null
                    }
                  }
                }
              }
            },
            "headers": {
              "Idempotent-Replayed": {
                "description": "true when this answer repeats the first one for the same Idempotency-Key.",
                "schema": {
                  "type": "string"
                }
              }
            }
          },
          "400": {
            "description": "invalid_target: Not exactly one target, an id that doesn't exist, or a patrol without a zone. · invalid_vehicle: vehicle_id doesn't exist. · invalid_request: A field is missing or out of range.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "409": {
            "description": "idempotency_conflict: The Idempotency-Key was used with a different body.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "422": {
            "description": "safety_check_failed: The safety gate refused it; details.failed_checks says why.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                },
                "examples": {
                  "safety_check_failed": {
                    "value": {
                      "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"
                          }
                        }
                      }
                    }
                  }
                }
              }
            }
          }
        }
      },
      "get": {
        "tags": [
          "Missions"
        ],
        "summary": "List missions",
        "operationId": "list_missions",
        "description": "Missions, newest first. Needs the `read` scope.",
        "parameters": [
          {
            "name": "status",
            "in": "query",
            "required": false,
            "description": "One status, active (waiting, queued or flying) or final (ended).",
            "schema": {
              "type": "string",
              "enum": [
                "pending_approval",
                "queued",
                "en_route",
                "on_scene",
                "returning",
                "completed",
                "failed",
                "cancelled",
                "denied",
                "rejected",
                "active",
                "final"
              ]
            }
          },
          {
            "name": "limit",
            "in": "query",
            "required": false,
            "description": "How many to return, 1 to 1,000. Default 100.",
            "schema": {
              "type": "integer",
              "default": 100,
              "minimum": 1,
              "maximum": 1000
            }
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/MissionList"
                },
                "examples": {
                  "ok": {
                    "summary": "OK",
                    "value": {
                      "data": [
                        {
                          "id": "msn_ac7bd7106919",
                          "type": "inspect",
                          "status": "queued",
                          "priority": "medium",
                          "reason": "Check the generator yard before the shift change",
                          "target": {
                            "kind": "zone",
                            "zone_id": "generator-yard",
                            "location": {
                              "lat": 38.4976991,
                              "lon": -98.0047977
                            },
                            "name": "Generator yard"
                          },
                          "patrol_points": null,
                          "vehicle_id": null,
                          "requested_vehicle_id": null,
                          "requested_by": "key:partner",
                          "trigger": {
                            "kind": "request",
                            "rule_id": null,
                            "sensor_id": null,
                            "alert_ids": [],
                            "client": null
                          },
                          "approval": {
                            "mode": "auto",
                            "required": true,
                            "reasons": [
                              "key:partner can request missions but not launch them"
                            ],
                            "decision": "approved",
                            "decided_by": "key:operator",
                            "decided_at": "2026-10-19T21:33:07.215Z",
                            "note": "Go ahead"
                          },
                          "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 0.7 km is within Drone 1's 6.0 km range."
                              },
                              {
                                "name": "battery",
                                "passed": true,
                                "detail": "Drone 1 has 100% battery."
                              }
                            ],
                            "checked_at": "2026-10-19T21:33:07.215Z"
                          },
                          "on_scene_s": 15.0,
                          "progress": {
                            "phase": "queued",
                            "waiting_for": "vehicle",
                            "detail": "Waiting for a free vehicle."
                          },
                          "history": [
                            {
                              "status": "requested",
                              "time": "2026-10-19T21:33:07.212Z",
                              "actor": "key:partner",
                              "note": "Check the generator yard before the shift change"
                            },
                            {
                              "status": "pending_approval",
                              "time": "2026-10-19T21:33:07.212Z",
                              "actor": "core",
                              "note": "key:partner can request missions but not launch them"
                            },
                            {
                              "status": "queued",
                              "time": "2026-10-19T21:33:07.216Z",
                              "actor": "key:operator",
                              "note": "Approved: Go ahead. Waiting for a free vehicle."
                            }
                          ],
                          "alert_ids": [],
                          "detection_ids": [],
                          "result": null,
                          "report_id": null,
                          "track": [],
                          "created_at": "2026-10-19T21:33:07.212Z",
                          "updated_at": "2026-10-19T21:33:07.216Z",
                          "started_at": null,
                          "ended_at": null
                        },
                        {
                          "id": "msn_520f729ca856",
                          "type": "patrol",
                          "status": "en_route",
                          "priority": "medium",
                          "reason": "Evening patrol of the north fence",
                          "target": {
                            "kind": "zone",
                            "zone_id": "north-fence",
                            "location": {
                              "lat": 38.5037001,
                              "lon": -98.0030001
                            },
                            "name": "North fence"
                          },
                          "patrol_points": [
                            {
                              "lat": 38.5025,
                              "lon": -98.0065
                            },
                            {
                              "lat": 38.5047,
                              "lon": -98.0065
                            },
                            {
                              "lat": 38.5049,
                              "lon": -97.9995
                            },
                            {
                              "lat": 38.5027,
                              "lon": -97.9995
                            }
                          ],
                          "vehicle_id": "drone-1",
                          "requested_vehicle_id": null,
                          "requested_by": "key:operator",
                          "trigger": {
                            "kind": "request",
                            "rule_id": null,
                            "sensor_id": null,
                            "alert_ids": [],
                            "client": "night-desk"
                          },
                          "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 2.6 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:07.207Z"
                          },
                          "on_scene_s": 15.0,
                          "progress": {
                            "phase": "en_route",
                            "distance_to_target_m": 432,
                            "eta_s": 36,
                            "battery_pct": 100.0,
                            "distance_flown_m": 0,
                            "detections": 0
                          },
                          "history": [
                            {
                              "status": "requested",
                              "time": "2026-10-19T21:33:07.207Z",
                              "actor": "key:operator",
                              "note": "Evening patrol of the north fence"
                            },
                            {
                              "status": "en_route",
                              "time": "2026-10-19T21:33:07.208Z",
                              "actor": "vehicle:drone-1",
                              "note": "Drone 1 launched"
                            }
                          ],
                          "alert_ids": [],
                          "detection_ids": [],
                          "result": null,
                          "report_id": null,
                          "track": [
                            [
                              38.499,
                              -98.001
                            ]
                          ],
                          "created_at": "2026-10-19T21:33:07.207Z",
                          "updated_at": "2026-10-19T21:33:07.207Z",
                          "started_at": "2026-10-19T21:33:07.208Z",
                          "ended_at": null
                        }
                      ]
                    }
                  }
                }
              }
            }
          }
        }
      }
    },
    "/v1/missions/{mission_id}": {
      "get": {
        "tags": [
          "Missions"
        ],
        "summary": "Get a mission",
        "operationId": "get_a_mission",
        "description": "One mission, with its live progress. Needs the `read` scope.",
        "parameters": [
          {
            "name": "mission_id",
            "in": "path",
            "required": true,
            "description": "The mission's id, msn_… .",
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "En route",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Mission"
                },
                "examples": {
                  "en_route": {
                    "summary": "En route",
                    "value": {
                      "id": "msn_e58e7523d2b5",
                      "type": "inspect",
                      "status": "en_route",
                      "priority": "high",
                      "reason": "Motion on the perimeter: motion from East gate motion sensor 2",
                      "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"
                      },
                      "patrol_points": null,
                      "vehicle_id": "drone-2",
                      "requested_vehicle_id": null,
                      "requested_by": "rule:perimeter-motion",
                      "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"
                      },
                      "on_scene_s": 15.0,
                      "progress": {
                        "phase": "en_route",
                        "distance_to_target_m": 482,
                        "eta_s": 40,
                        "battery_pct": 99.7,
                        "distance_flown_m": 41,
                        "detections": 0
                      },
                      "history": [
                        {
                          "status": "requested",
                          "time": "2026-10-19T21:33:03.883Z",
                          "actor": "rule:perimeter-motion",
                          "note": "Motion on the perimeter: motion from East gate motion sensor 2"
                        },
                        {
                          "status": "en_route",
                          "time": "2026-10-19T21:33:03.883Z",
                          "actor": "vehicle:drone-2",
                          "note": "Drone 2 launched"
                        }
                      ],
                      "alert_ids": [
                        "alt_5037deb6aeee"
                      ],
                      "detection_ids": [],
                      "result": null,
                      "report_id": null,
                      "track": [
                        [
                          38.499,
                          -98.0007
                        ],
                        [
                          38.4990346,
                          -98.0005684
                        ],
                        [
                          38.4990693,
                          -98.0004368
                        ]
                      ],
                      "created_at": "2026-10-19T21:33:03.883Z",
                      "updated_at": "2026-10-19T21:33:03.883Z",
                      "started_at": "2026-10-19T21:33:03.883Z",
                      "ended_at": null
                    }
                  }
                }
              }
            }
          },
          "404": {
            "description": "not_found: No mission with this id.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      }
    },
    "/v1/missions/{mission_id}/approve": {
      "post": {
        "tags": [
          "Missions"
        ],
        "summary": "Approve a mission",
        "operationId": "approve_a_mission",
        "description": "Approves a mission waiting in pending_approval . The safety gate checks it again, then a ready vehicle launches, or it waits in queued . Needs the `missions:approve` scope.",
        "parameters": [
          {
            "name": "mission_id",
            "in": "path",
            "required": true,
            "description": "The mission's id.",
            "schema": {
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "required": false,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/Note"
              },
              "example": {
                "note": "Go ahead"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Approved, queued",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Mission"
                },
                "examples": {
                  "approved_queued": {
                    "summary": "Approved, queued",
                    "value": {
                      "id": "msn_ac7bd7106919",
                      "type": "inspect",
                      "status": "queued",
                      "priority": "medium",
                      "reason": "Check the generator yard before the shift change",
                      "target": {
                        "kind": "zone",
                        "zone_id": "generator-yard",
                        "location": {
                          "lat": 38.4976991,
                          "lon": -98.0047977
                        },
                        "name": "Generator yard"
                      },
                      "patrol_points": null,
                      "vehicle_id": null,
                      "requested_vehicle_id": null,
                      "requested_by": "key:partner",
                      "trigger": {
                        "kind": "request",
                        "rule_id": null,
                        "sensor_id": null,
                        "alert_ids": [],
                        "client": null
                      },
                      "approval": {
                        "mode": "auto",
                        "required": true,
                        "reasons": [
                          "key:partner can request missions but not launch them"
                        ],
                        "decision": "approved",
                        "decided_by": "key:operator",
                        "decided_at": "2026-10-19T21:33:07.215Z",
                        "note": "Go ahead"
                      },
                      "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 0.7 km is within Drone 1's 6.0 km range."
                          },
                          {
                            "name": "battery",
                            "passed": true,
                            "detail": "Drone 1 has 100% battery."
                          }
                        ],
                        "checked_at": "2026-10-19T21:33:07.215Z"
                      },
                      "on_scene_s": 15.0,
                      "progress": {
                        "phase": "queued",
                        "waiting_for": "vehicle",
                        "detail": "Waiting for a free vehicle."
                      },
                      "history": [
                        {
                          "status": "requested",
                          "time": "2026-10-19T21:33:07.212Z",
                          "actor": "key:partner",
                          "note": "Check the generator yard before the shift change"
                        },
                        {
                          "status": "pending_approval",
                          "time": "2026-10-19T21:33:07.212Z",
                          "actor": "core",
                          "note": "key:partner can request missions but not launch them"
                        },
                        {
                          "status": "queued",
                          "time": "2026-10-19T21:33:07.216Z",
                          "actor": "key:operator",
                          "note": "Approved: Go ahead. Waiting for a free vehicle."
                        }
                      ],
                      "alert_ids": [],
                      "detection_ids": [],
                      "result": null,
                      "report_id": null,
                      "track": [],
                      "created_at": "2026-10-19T21:33:07.212Z",
                      "updated_at": "2026-10-19T21:33:07.216Z",
                      "started_at": null,
                      "ended_at": null
                    }
                  }
                }
              }
            }
          },
          "403": {
            "description": "missing_scope: The key lacks missions:approve .",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                },
                "examples": {
                  "missing_scope": {
                    "value": {
                      "error": {
                        "code": "missing_scope",
                        "message": "This key does not have the missions:approve scope.",
                        "details": {
                          "required_scope": "missions:approve"
                        }
                      }
                    }
                  }
                }
              }
            }
          },
          "409": {
            "description": "invalid_state: It isn't waiting for approval.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                },
                "examples": {
                  "invalid_state": {
                    "value": {
                      "error": {
                        "code": "invalid_state",
                        "message": "Mission msn_1e2ffbc6d2f8 is denied; only missions waiting for approval can be approved."
                      }
                    }
                  }
                }
              }
            }
          }
        }
      }
    },
    "/v1/missions/{mission_id}/deny": {
      "post": {
        "tags": [
          "Missions"
        ],
        "summary": "Deny a mission",
        "operationId": "deny_a_mission",
        "description": "Turns down a mission waiting in pending_approval . Its alerts go back to open , and a short report records the decision. Needs the `missions:approve` scope.",
        "parameters": [
          {
            "name": "mission_id",
            "in": "path",
            "required": true,
            "description": "The mission's id.",
            "schema": {
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "required": false,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/Note"
              },
              "example": {
                "note": "The trailer is expected"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Denied",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Mission"
                },
                "examples": {
                  "denied": {
                    "summary": "Denied",
                    "value": {
                      "id": "msn_1e2ffbc6d2f8",
                      "type": "inspect",
                      "status": "denied",
                      "priority": "low",
                      "reason": "Look at the parked trailer",
                      "target": {
                        "kind": "location",
                        "location": {
                          "lat": 38.4975,
                          "lon": -98.004
                        },
                        "zone_id": "generator-yard",
                        "name": "38.49750, -98.00400"
                      },
                      "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": "ask",
                        "required": true,
                        "reasons": [
                          "the request asked for approval"
                        ],
                        "decision": "denied",
                        "decided_by": "key:operator",
                        "decided_at": "2026-10-19T21:33:07.219Z",
                        "note": "The trailer is expected"
                      },
                      "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 0.6 km is within Drone 1's 6.0 km range."
                          },
                          {
                            "name": "battery",
                            "passed": true,
                            "detail": "Drone 1 has 100% battery."
                          }
                        ],
                        "checked_at": "2026-10-19T21:33:07.217Z"
                      },
                      "on_scene_s": 15.0,
                      "progress": {
                        "phase": "denied"
                      },
                      "history": [
                        {
                          "status": "requested",
                          "time": "2026-10-19T21:33:07.217Z",
                          "actor": "key:operator",
                          "note": "Look at the parked trailer"
                        },
                        {
                          "status": "pending_approval",
                          "time": "2026-10-19T21:33:07.217Z",
                          "actor": "core",
                          "note": "the request asked for approval"
                        },
                        {
                          "status": "denied",
                          "time": "2026-10-19T21:33:07.219Z",
                          "actor": "key:operator",
                          "note": "key:operator denied the request (The trailer is expected)"
                        }
                      ],
                      "alert_ids": [],
                      "detection_ids": [],
                      "result": {
                        "outcome": "denied",
                        "reason": "key:operator denied the request (The trailer is expected)",
                        "detections": 0,
                        "battery_end_pct": null,
                        "distance_flown_m": 0,
                        "report_id": "rpt_7e62e7adef23"
                      },
                      "report_id": "rpt_7e62e7adef23",
                      "track": [],
                      "created_at": "2026-10-19T21:33:07.217Z",
                      "updated_at": "2026-10-19T21:33:07.219Z",
                      "started_at": null,
                      "ended_at": "2026-10-19T21:33:07.219Z"
                    }
                  }
                }
              }
            }
          },
          "409": {
            "description": "invalid_state: It isn't waiting for approval.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      }
    },
    "/v1/missions/{mission_id}/cancel": {
      "post": {
        "tags": [
          "Missions"
        ],
        "summary": "Cancel a mission",
        "operationId": "cancel_a_mission",
        "description": "Stops a mission that hasn't ended, whatever its status. A flying vehicle heads home. Its alerts go back to open , and a report records what the drone saw before. Needs the `missions:approve` scope.",
        "parameters": [
          {
            "name": "mission_id",
            "in": "path",
            "required": true,
            "description": "The mission's id.",
            "schema": {
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "required": false,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/Note"
              },
              "example": {
                "note": "Guard is walking the fence"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Cancelled",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Mission"
                },
                "examples": {
                  "cancelled": {
                    "summary": "Cancelled",
                    "value": {
                      "id": "msn_520f729ca856",
                      "type": "patrol",
                      "status": "cancelled",
                      "priority": "medium",
                      "reason": "Evening patrol of the north fence",
                      "target": {
                        "kind": "zone",
                        "zone_id": "north-fence",
                        "location": {
                          "lat": 38.5037001,
                          "lon": -98.0030001
                        },
                        "name": "North fence"
                      },
                      "patrol_points": [
                        {
                          "lat": 38.5025,
                          "lon": -98.0065
                        },
                        {
                          "lat": 38.5047,
                          "lon": -98.0065
                        },
                        {
                          "lat": 38.5049,
                          "lon": -97.9995
                        },
                        {
                          "lat": 38.5027,
                          "lon": -97.9995
                        }
                      ],
                      "vehicle_id": "drone-1",
                      "requested_vehicle_id": null,
                      "requested_by": "key:operator",
                      "trigger": {
                        "kind": "request",
                        "rule_id": null,
                        "sensor_id": null,
                        "alert_ids": [],
                        "client": "night-desk"
                      },
                      "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 2.6 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:07.207Z"
                      },
                      "on_scene_s": 15.0,
                      "progress": {
                        "phase": "cancelled"
                      },
                      "history": [
                        {
                          "status": "requested",
                          "time": "2026-10-19T21:33:07.207Z",
                          "actor": "key:operator",
                          "note": "Evening patrol of the north fence"
                        },
                        {
                          "status": "en_route",
                          "time": "2026-10-19T21:33:07.208Z",
                          "actor": "vehicle:drone-1",
                          "note": "Drone 1 launched"
                        },
                        {
                          "status": "on_scene",
                          "time": "2026-10-19T21:33:43.163Z",
                          "actor": "vehicle:drone-1",
                          "note": "Drone 1 over North fence"
                        },
                        {
                          "status": "cancelled",
                          "time": "2026-10-19T21:34:00.356Z",
                          "actor": "key:operator",
                          "note": "key:operator cancelled it (Guard is walking the fence)"
                        }
                      ],
                      "alert_ids": [],
                      "detection_ids": [],
                      "result": {
                        "outcome": "cancelled",
                        "reason": "key:operator cancelled it (Guard is walking the fence)",
                        "detections": 0,
                        "battery_end_pct": 94.7,
                        "distance_flown_m": 637,
                        "report_id": "rpt_c3d1d1973aca"
                      },
                      "report_id": "rpt_c3d1d1973aca",
                      "track": [
                        [
                          38.499,
                          -98.001
                        ],
                        [
                          38.4991037,
                          -98.000958
                        ],
                        [
                          38.4992072,
                          -98.000916
                        ]
                      ],
                      "created_at": "2026-10-19T21:33:07.207Z",
                      "updated_at": "2026-10-19T21:34:00.356Z",
                      "started_at": "2026-10-19T21:33:07.208Z",
                      "ended_at": "2026-10-19T21:34:00.356Z"
                    }
                  }
                }
              }
            }
          },
          "409": {
            "description": "invalid_state: It has already ended.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      }
    },
    "/v1/status": {
      "get": {
        "tags": [
          "Site and fleet"
        ],
        "summary": "Get the site's status",
        "operationId": "get_status",
        "description": "Everything a dashboard needs at a glance: counts, each vehicle's state, the missions under way, the open alerts and any silent sensors. Needs the `read` scope.",
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Status"
                },
                "examples": {
                  "ok": {
                    "summary": "OK",
                    "value": {
                      "site": {
                        "name": "Demo Depot",
                        "center": {
                          "lat": 38.5005,
                          "lon": -98.0005
                        },
                        "operating_area_id": "depot"
                      },
                      "time": "2026-10-19T21:39:17.000Z",
                      "version": "1.0.0",
                      "instance_id": "inst_72ff46ed59a2",
                      "dev_mode": true,
                      "sim_speed": 1.0,
                      "counts": {
                        "alerts_open": 1,
                        "alerts_responding": 1,
                        "missions_active": 1,
                        "missions_pending_approval": 0,
                        "sensors_online": 3,
                        "sensors_silent": 0,
                        "sensors_pending": 0,
                        "vehicles_ready": 1,
                        "vehicles_flying": 1
                      },
                      "vehicles": [
                        {
                          "id": "drone-1",
                          "name": "Drone 1",
                          "status": "en_route",
                          "battery_pct": 99.4,
                          "ready": false,
                          "mission_id": "msn_ab6c41ad6b73",
                          "fault": null
                        },
                        {
                          "id": "drone-2",
                          "name": "Drone 2",
                          "status": "docked",
                          "battery_pct": 100.0,
                          "ready": true,
                          "mission_id": null,
                          "fault": null
                        }
                      ],
                      "active_missions": [
                        {
                          "id": "msn_ab6c41ad6b73",
                          "type": "inspect",
                          "status": "en_route",
                          "vehicle_id": "drone-1",
                          "target": {
                            "kind": "alert",
                            "alert_id": "alt_214ab1f49295",
                            "sensor_id": "north-fence-pir-01",
                            "location": {
                              "lat": 38.5033,
                              "lon": -98.0032
                            },
                            "zone_id": "north-fence",
                            "name": "North fence motion sensor"
                          },
                          "priority": "high",
                          "progress": {
                            "phase": "en_route",
                            "distance_to_target_m": 443,
                            "eta_s": 37,
                            "battery_pct": 99.4,
                            "distance_flown_m": 72,
                            "detections": 0
                          }
                        }
                      ],
                      "open_alerts": [
                        {
                          "id": "alt_214ab1f49295",
                          "source": "north-fence-pir-01",
                          "type": "motion",
                          "priority": "high",
                          "zone_id": "north-fence",
                          "status": "responding",
                          "mission_id": "msn_ab6c41ad6b73",
                          "created_at": "2026-10-19T21:39:10.997Z"
                        },
                        {
                          "id": "alt_02fcb2845e3a",
                          "source": "generator-yard-door-01",
                          "type": "door_open",
                          "priority": "medium",
                          "zone_id": "generator-yard",
                          "status": "open",
                          "mission_id": null,
                          "created_at": "2026-10-19T21:34:46.531Z"
                        }
                      ],
                      "silent_sensors": []
                    }
                  }
                }
              }
            }
          }
        }
      }
    },
    "/v1/health": {
      "get": {
        "tags": [
          "Site and fleet"
        ],
        "summary": "Check health",
        "operationId": "check_health",
        "description": "Whether Ochio is up. It needs no key, so a load balancer or a monitor can call it.",
        "security": [],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Health"
                },
                "examples": {
                  "ok": {
                    "summary": "OK",
                    "value": {
                      "status": "ok",
                      "version": "1.0.0",
                      "time": "2026-10-19T21:33:02.751Z",
                      "dev_mode": true,
                      "instance_id": "inst_72ff46ed59a2"
                    }
                  }
                }
              }
            }
          }
        }
      }
    },
    "/v1/vehicles": {
      "get": {
        "tags": [
          "Site and fleet"
        ],
        "summary": "List vehicles",
        "operationId": "list_vehicles",
        "description": "Every vehicle, with where it is and what it's doing. Needs the `read` scope.",
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/VehicleList"
                },
                "examples": {
                  "ok": {
                    "summary": "OK",
                    "value": {
                      "data": [
                        {
                          "id": "drone-1",
                          "name": "Drone 1",
                          "type": "quadcopter",
                          "model": "Ochio quad (simulated)",
                          "adapter": "sim",
                          "capabilities": [
                            "camera",
                            "depth"
                          ],
                          "home": {
                            "lat": 38.499,
                            "lon": -98.001
                          },
                          "position": {
                            "lat": 38.4996049,
                            "lon": -98.0013095,
                            "alt_m": 40.0
                          },
                          "heading_deg": 338.2,
                          "ground_speed_mps": 12.0,
                          "speed_mps": 12.0,
                          "range_m": 6000.0,
                          "battery_pct": 99.4,
                          "status": "en_route",
                          "ready": false,
                          "charging": false,
                          "mission_id": "msn_ab6c41ad6b73",
                          "fault": null,
                          "created_at": "2026-10-19T21:30:10.072Z",
                          "updated_at": "2026-10-19T21:39:10.998Z"
                        },
                        {
                          "id": "drone-2",
                          "name": "Drone 2",
                          "type": "quadcopter",
                          "model": "Ochio quad (simulated)",
                          "adapter": "sim",
                          "capabilities": [
                            "camera",
                            "depth"
                          ],
                          "home": {
                            "lat": 38.499,
                            "lon": -98.0007
                          },
                          "position": {
                            "lat": 38.499,
                            "lon": -98.0007,
                            "alt_m": 0.0
                          },
                          "heading_deg": 155.5,
                          "ground_speed_mps": 0.0,
                          "speed_mps": 12.0,
                          "range_m": 6000.0,
                          "battery_pct": 100.0,
                          "status": "docked",
                          "ready": true,
                          "charging": false,
                          "mission_id": null,
                          "fault": null,
                          "created_at": "2026-10-19T21:30:10.072Z",
                          "updated_at": "2026-10-19T21:35:12.126Z"
                        }
                      ]
                    }
                  }
                }
              }
            }
          }
        }
      }
    },
    "/v1/vehicles/{vehicle_id}": {
      "get": {
        "tags": [
          "Site and fleet"
        ],
        "summary": "Get a vehicle",
        "operationId": "get_a_vehicle",
        "description": "One vehicle, by id. Needs the `read` scope.",
        "parameters": [
          {
            "name": "vehicle_id",
            "in": "path",
            "required": true,
            "description": "The vehicle's id.",
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Vehicle"
                },
                "examples": {
                  "ok": {
                    "summary": "OK",
                    "value": {
                      "id": "drone-1",
                      "name": "Drone 1",
                      "type": "quadcopter",
                      "model": "Ochio quad (simulated)",
                      "adapter": "sim",
                      "capabilities": [
                        "camera",
                        "depth"
                      ],
                      "home": {
                        "lat": 38.499,
                        "lon": -98.001
                      },
                      "position": {
                        "lat": 38.4996049,
                        "lon": -98.0013095,
                        "alt_m": 40.0
                      },
                      "heading_deg": 338.2,
                      "ground_speed_mps": 12.0,
                      "speed_mps": 12.0,
                      "range_m": 6000.0,
                      "battery_pct": 99.4,
                      "status": "en_route",
                      "ready": false,
                      "charging": false,
                      "mission_id": "msn_ab6c41ad6b73",
                      "fault": null,
                      "created_at": "2026-10-19T21:30:10.072Z",
                      "updated_at": "2026-10-19T21:39:10.998Z"
                    }
                  }
                }
              }
            }
          },
          "404": {
            "description": "not_found: No vehicle with this id.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      }
    },
    "/v1/zones": {
      "get": {
        "tags": [
          "Site and fleet"
        ],
        "summary": "List zones",
        "operationId": "list_zones",
        "description": "The operating area and every zone, with their outlines. Needs the `read` scope.",
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ZoneList"
                },
                "examples": {
                  "ok": {
                    "summary": "OK",
                    "value": {
                      "data": [
                        {
                          "id": "depot",
                          "name": "Depot operating area",
                          "kind": "operating_area",
                          "polygon": [
                            {
                              "lat": 38.4955,
                              "lon": -98.0085
                            },
                            {
                              "lat": 38.5058,
                              "lon": -98.0085
                            },
                            {
                              "lat": 38.506,
                              "lon": -97.999
                            },
                            {
                              "lat": 38.504,
                              "lon": -97.9915
                            },
                            {
                              "lat": 38.496,
                              "lon": -97.9915
                            },
                            {
                              "lat": 38.4952,
                              "lon": -97.999
                            }
                          ],
                          "center": {
                            "lat": 38.500497,
                            "lon": -98.000295
                          }
                        },
                        {
                          "id": "north-fence",
                          "name": "North fence",
                          "kind": "watch",
                          "polygon": [
                            {
                              "lat": 38.5025,
                              "lon": -98.0065
                            },
                            {
                              "lat": 38.5047,
                              "lon": -98.0065
                            },
                            {
                              "lat": 38.5049,
                              "lon": -97.9995
                            },
                            {
                              "lat": 38.5027,
                              "lon": -97.9995
                            }
                          ],
                          "center": {
                            "lat": 38.5037,
                            "lon": -98.003
                          }
                        }
                      ]
                    }
                  }
                }
              }
            }
          }
        }
      }
    },
    "/v1/rules": {
      "get": {
        "tags": [
          "Site and fleet"
        ],
        "summary": "List rules",
        "operationId": "list_rules",
        "description": "The site's rules, in the order Ochio reads them. Needs the `read` scope.",
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/RuleList"
                },
                "examples": {
                  "ok": {
                    "summary": "OK",
                    "value": {
                      "data": [
                        {
                          "id": "perimeter-motion",
                          "name": "Motion on the perimeter",
                          "order": 1,
                          "when": "alert",
                          "zones": [
                            "north-fence",
                            "east-gate"
                          ],
                          "min_priority": "medium",
                          "mission": "inspect",
                          "approval": "auto",
                          "cooldown_s": 60.0
                        },
                        {
                          "id": "generator-yard-door",
                          "name": "Generator yard door opened",
                          "order": 2,
                          "when": "alert",
                          "zones": [
                            "generator-yard"
                          ],
                          "min_priority": "low",
                          "mission": "inspect",
                          "approval": "ask",
                          "cooldown_s": 60.0
                        },
                        {
                          "id": "silent-sensor",
                          "name": "A sensor went silent",
                          "order": 3,
                          "when": "sensor_silent",
                          "zones": [
                            "*"
                          ],
                          "min_priority": "low",
                          "mission": "inspect",
                          "approval": "auto",
                          "cooldown_s": 120.0
                        }
                      ],
                      "first_match_wins": true
                    }
                  }
                }
              }
            }
          }
        }
      }
    },
    "/v1/detections": {
      "get": {
        "tags": [
          "Detections and reports"
        ],
        "summary": "List detections",
        "operationId": "list_detections",
        "description": "Detections, newest first. A detection.created event announces each one as it happens. Needs the `read` scope.",
        "parameters": [
          {
            "name": "mission_id",
            "in": "query",
            "required": false,
            "description": "Only this mission's detections.",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "limit",
            "in": "query",
            "required": false,
            "description": "How many to return, 1 to 1,000. Default 100.",
            "schema": {
              "type": "integer",
              "default": 100,
              "minimum": 1,
              "maximum": 1000
            }
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/DetectionList"
                },
                "examples": {
                  "ok": {
                    "summary": "OK",
                    "value": {
                      "data": [
                        {
                          "id": "det_ff3034b71f11",
                          "class": "person",
                          "confidence": 0.83,
                          "location": {
                            "lat": 38.5007,
                            "lon": -97.9953
                          },
                          "zone_id": "east-gate",
                          "source": "vehicle:drone-2",
                          "mission_id": "msn_e58e7523d2b5",
                          "vehicle_id": "drone-2",
                          "expired": false,
                          "expires_at": "2026-10-19T21:43:47.392Z",
                          "created_at": "2026-10-19T21:33:47.392Z"
                        }
                      ]
                    }
                  }
                }
              }
            }
          }
        }
      }
    },
    "/v1/reports": {
      "get": {
        "tags": [
          "Detections and reports"
        ],
        "summary": "List reports",
        "operationId": "list_reports",
        "description": "Reports, newest first, in short form. Needs the `read` scope.",
        "parameters": [
          {
            "name": "limit",
            "in": "query",
            "required": false,
            "description": "How many to return, 1 to 1,000. Default 100.",
            "schema": {
              "type": "integer",
              "default": 100,
              "minimum": 1,
              "maximum": 1000
            }
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ReportList"
                },
                "examples": {
                  "ok": {
                    "summary": "OK",
                    "value": {
                      "data": [
                        {
                          "id": "rpt_91632184d289",
                          "mission_id": "msn_ea2ec77fdfaa",
                          "title": "Inspection: North fence motion sensor",
                          "outcome": {
                            "status": "completed",
                            "reason": "Drone 2 landed back on its dock"
                          },
                          "summary": "Drone 2 checked on North fence motion sensor, which had stopped checking in, and saw no one. It landed back on its dock with 20% battery after flying 1.1 km.",
                          "created_at": "2026-10-19T21:35:12.126Z"
                        },
                        {
                          "id": "rpt_97ba18de7a7a",
                          "mission_id": "msn_ac7bd7106919",
                          "title": "Inspection: Generator yard",
                          "outcome": {
                            "status": "completed",
                            "reason": "Drone 1 landed back on its dock"
                          },
                          "summary": "Drone 1 inspected Generator yard after a request from key:partner (Check the generator yard before the shift change) and saw no one. It landed back on its dock with 84% battery after flying 722 m.",
                          "created_at": "2026-10-19T21:35:01.666Z"
                        },
                        {
                          "id": "rpt_3d5775dba56f",
                          "mission_id": "msn_7c755ad98d22",
                          "title": "Inspection: Generator yard door",
                          "outcome": {
                            "status": "cancelled",
                            "reason": "key:operator cancelled it (Maintenance crew on site)"
                          },
                          "summary": "The inspect mission to Generator yard door after a medium door_open alert from Generator yard door was cancelled: key:operator cancelled it (Maintenance crew on site).",
                          "created_at": "2026-10-19T21:34:46.533Z"
                        }
                      ]
                    }
                  }
                }
              }
            }
          }
        }
      }
    },
    "/v1/reports/{report_id}": {
      "get": {
        "tags": [
          "Detections and reports"
        ],
        "summary": "Get a report",
        "operationId": "get_a_report",
        "description": "One report, as JSON, or as a page a person can read and print. See an example page . Needs the `read` scope.",
        "parameters": [
          {
            "name": "report_id",
            "in": "path",
            "required": true,
            "description": "The report's id, rpt_… .",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "format",
            "in": "query",
            "required": false,
            "description": "json (the default) or html for the printable page with a map of the flight.",
            "schema": {
              "type": "string",
              "enum": [
                "json",
                "html"
              ],
              "default": "json"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Report"
                },
                "examples": {
                  "ok": {
                    "summary": "OK",
                    "value": {
                      "id": "rpt_ba61bdbb7b36",
                      "mission_id": "msn_e58e7523d2b5",
                      "title": "Inspection: East gate motion sensor 2",
                      "outcome": {
                        "status": "completed",
                        "reason": "Drone 2 landed back on its dock"
                      },
                      "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.",
                      "trigger": {
                        "kind": "alert",
                        "text": "A critical motion alert from East gate motion sensor 2",
                        "rule_id": "perimeter-motion",
                        "sensor_id": "east-gate-pir-02",
                        "alert_ids": [
                          "alt_5037deb6aeee"
                        ],
                        "requested_by": "rule:perimeter-motion",
                        "time": "2026-10-19T21:33:03.883Z"
                      },
                      "timeline": [
                        {
                          "time": "2026-10-19T21:33:03.882Z",
                          "text": "Motion alert (critical) from East gate motion sensor 2"
                        },
                        {
                          "time": "2026-10-19T21:33:03.883Z",
                          "text": "Mission requested by rule:perimeter-motion"
                        },
                        {
                          "time": "2026-10-19T21:33:03.883Z",
                          "text": "Drone 2 launched toward East gate motion sensor 2"
                        },
                        {
                          "time": "2026-10-19T21:33:47.392Z",
                          "text": "Drone 2 on scene"
                        },
                        {
                          "time": "2026-10-19T21:33:47.392Z",
                          "text": "Person detected (83%), 34 m from the target"
                        },
                        {
                          "time": "2026-10-19T21:34:02.486Z",
                          "text": "Drone 2 heading home"
                        },
                        {
                          "time": "2026-10-19T21:34:46.141Z",
                          "text": "Drone 2 landed; mission complete"
                        }
                      ],
                      "detections": [
                        {
                          "id": "det_ff3034b71f11",
                          "class": "person",
                          "confidence": 0.83,
                          "location": {
                            "lat": 38.5007,
                            "lon": -97.9953
                          },
                          "zone_id": "east-gate",
                          "source": "vehicle:drone-2",
                          "mission_id": "msn_e58e7523d2b5",
                          "vehicle_id": "drone-2",
                          "expired": false,
                          "expires_at": "2026-10-19T21:43:47.392Z",
                          "created_at": "2026-10-19T21:33:47.392Z"
                        }
                      ],
                      "vehicle": {
                        "id": "drone-2",
                        "name": "Drone 2",
                        "battery_start_pct": 100.0,
                        "battery_end_pct": 89.8,
                        "distance_flown_m": 1047,
                        "flight_time_s": 102
                      },
                      "recommendations": [
                        "Have security confirm the 1 person seen near East gate (first sighting at 38.50070, -97.99530, 21:33:47 UTC)."
                      ],
                      "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"
                      },
                      "created_at": "2026-10-19T21:34:46.141Z"
                    }
                  }
                }
              },
              "text/html": {
                "schema": {
                  "type": "string",
                  "description": "The printable page, with ?format=html."
                }
              }
            }
          },
          "404": {
            "description": "not_found: No report with this id.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      }
    },
    "/v1/events": {
      "get": {
        "tags": [
          "Events and live stream"
        ],
        "summary": "List events",
        "operationId": "list_events",
        "description": "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 . Needs the `read` scope.",
        "parameters": [
          {
            "name": "after",
            "in": "query",
            "required": false,
            "description": "Return events after this seq . Default 0.",
            "schema": {
              "type": "integer",
              "default": 0,
              "minimum": 0
            }
          },
          {
            "name": "types",
            "in": "query",
            "required": false,
            "description": "Only these types, comma separated.",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "limit",
            "in": "query",
            "required": false,
            "description": "Events per page, 1 to 1,000. Default 100.",
            "schema": {
              "type": "integer",
              "default": 100,
              "minimum": 1,
              "maximum": 1000
            }
          },
          {
            "name": "tail",
            "in": "query",
            "required": false,
            "description": "Return the newest N events instead (1 to 1,000), oldest first.",
            "schema": {
              "type": "integer",
              "minimum": 1,
              "maximum": 1000
            }
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/EventPage"
                },
                "examples": {
                  "ok": {
                    "summary": "OK",
                    "value": {
                      "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
                    }
                  },
                  "tail_2_types_report_ready": {
                    "summary": "tail=2&types=report.ready",
                    "value": {
                      "data": [
                        {
                          "id": "evt_6d2ab1fce9f4",
                          "seq": 65,
                          "type": "report.ready",
                          "time": "2026-10-19T21:35:01.666Z",
                          "actor": "core",
                          "subject": "rpt_97ba18de7a7a",
                          "data": {
                            "report_id": "rpt_97ba18de7a7a",
                            "mission_id": "msn_ac7bd7106919",
                            "outcome": "completed",
                            "summary": "Drone 1 inspected Generator yard after a request from key:partner (Check the generator yard before the shift change) and saw no one. It landed back on its dock with 84% battery after flying 722 m.",
                            "detections": 0,
                            "url": "/v1/reports/rpt_97ba18de7a7a?format=html"
                          }
                        },
                        {
                          "id": "evt_469cf30d4ad9",
                          "seq": 70,
                          "type": "report.ready",
                          "time": "2026-10-19T21:35:12.127Z",
                          "actor": "core",
                          "subject": "rpt_91632184d289",
                          "data": {
                            "report_id": "rpt_91632184d289",
                            "mission_id": "msn_ea2ec77fdfaa",
                            "outcome": "completed",
                            "summary": "Drone 2 checked on North fence motion sensor, which had stopped checking in, and saw no one. It landed back on its dock with 20% battery after flying 1.1 km.",
                            "detections": 0,
                            "url": "/v1/reports/rpt_91632184d289?format=html"
                          }
                        }
                      ],
                      "next_after": 70,
                      "has_more": false
                    }
                  }
                }
              }
            }
          }
        }
      }
    },
    "/v1/events/stream": {
      "get": {
        "tags": [
          "Events and live stream"
        ],
        "summary": "Stream events",
        "operationId": "stream_events",
        "description": "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. Needs the `read` scope.",
        "parameters": [
          {
            "name": "types",
            "in": "query",
            "required": false,
            "description": "Only these types, comma separated. Leave out to get everything, telemetry included. Add vehicle.telemetry to a filter to keep the telemetry.",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "after",
            "in": "query",
            "required": false,
            "description": "Send the log's events after this seq first, then live ones.",
            "schema": {
              "type": "integer"
            }
          },
          {
            "name": "key",
            "in": "query",
            "required": false,
            "description": "The API key, for browsers: EventSource can't send headers. Prefer the header everywhere else.",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "Last-Event-ID",
            "in": "header",
            "required": false,
            "description": "On reconnect, the last id you received. Ochio sends what you missed, then carries on live. Browsers send it for you.",
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "A stream of Server-Sent Events.",
            "content": {
              "text/event-stream": {
                "schema": {
                  "type": "string"
                },
                "example": "retry: 3000\n\nid: 10\nevent: mission.created\ndata: {\"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}}\n\nevent: vehicle.telemetry\ndata: {\"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}}]}}\n\nid: 18\nevent: mission.status_changed\ndata: {\"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.\"}}"
              }
            }
          }
        }
      }
    },
    "/v1/events/export": {
      "get": {
        "tags": [
          "Events and live stream"
        ],
        "summary": "Export events",
        "operationId": "export_events",
        "description": "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. Needs the `read` scope.",
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/x-ndjson": {
                "schema": {
                  "type": "string"
                },
                "example": "{\"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\"}}\n{\"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\"}}\n{\"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\"}}"
              }
            }
          }
        }
      }
    },
    "/v1/webhooks": {
      "post": {
        "tags": [
          "Webhooks"
        ],
        "summary": "Create a webhook",
        "operationId": "create_a_webhook",
        "description": "Subscribes a URL to events. The answer holds the signing secret, shown once. Needs the `webhooks:write` scope.",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/WebhookCreate"
              },
              "example": {
                "url": "https://desk.example.com/ochio-webhooks",
                "event_types": [
                  "mission.*",
                  "detection.created",
                  "report.ready"
                ],
                "description": "Security desk"
              }
            }
          }
        },
        "responses": {
          "201": {
            "description": "Created",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/WebhookWithSecret"
                },
                "examples": {
                  "created": {
                    "summary": "Created",
                    "value": {
                      "id": "whk_1cee4f976d10",
                      "url": "https://desk.example.com/ochio-webhooks",
                      "event_types": [
                        "mission.*",
                        "detection.created",
                        "report.ready"
                      ],
                      "description": "Security desk",
                      "enabled": true,
                      "owner": "partner",
                      "stats": {
                        "delivered": 0,
                        "failed_attempts": 0,
                        "gave_up": 0,
                        "last_status": null,
                        "last_attempt_at": null
                      },
                      "created_at": "2026-10-19T21:33:02.762Z",
                      "updated_at": "2026-10-19T21:33:02.762Z",
                      "secret": "whsec_test_example_secret_000000000003"
                    }
                  }
                }
              }
            }
          },
          "400": {
            "description": "invalid_request: The URL isn't http or https, an event type is unknown, or the URL points back at Ochio itself.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      },
      "get": {
        "tags": [
          "Webhooks"
        ],
        "summary": "List webhooks",
        "operationId": "list_webhooks",
        "description": "Your key's subscriptions; every subscription for a key with admin . Needs the `read` scope.",
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/WebhookList"
                },
                "examples": {
                  "ok": {
                    "summary": "OK",
                    "value": {
                      "data": [
                        {
                          "id": "whk_1cee4f976d10",
                          "url": "https://desk.example.com/ochio-webhooks",
                          "event_types": [
                            "mission.*",
                            "detection.created",
                            "report.ready"
                          ],
                          "description": "Security desk",
                          "enabled": true,
                          "owner": "partner",
                          "stats": {
                            "delivered": 17,
                            "failed_attempts": 0,
                            "gave_up": 0,
                            "last_status": 200,
                            "last_attempt_at": "2026-10-19T21:34:46.348Z"
                          },
                          "created_at": "2026-10-19T21:33:02.762Z",
                          "updated_at": "2026-10-19T21:33:02.762Z"
                        }
                      ]
                    }
                  }
                }
              }
            }
          }
        }
      }
    },
    "/v1/webhooks/{webhook_id}": {
      "get": {
        "tags": [
          "Webhooks"
        ],
        "summary": "Get a webhook",
        "operationId": "get_a_webhook",
        "description": "One subscription, with its delivery counts. Needs the `read` scope.",
        "parameters": [
          {
            "name": "webhook_id",
            "in": "path",
            "required": true,
            "description": "The webhook's id, whk_… .",
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Webhook"
                },
                "examples": {
                  "ok": {
                    "summary": "OK",
                    "value": {
                      "id": "whk_1cee4f976d10",
                      "url": "https://desk.example.com/ochio-webhooks",
                      "event_types": [
                        "mission.*",
                        "detection.created",
                        "report.ready"
                      ],
                      "description": "Security desk",
                      "enabled": true,
                      "owner": "partner",
                      "stats": {
                        "delivered": 17,
                        "failed_attempts": 0,
                        "gave_up": 0,
                        "last_status": 200,
                        "last_attempt_at": "2026-10-19T21:34:46.348Z"
                      },
                      "created_at": "2026-10-19T21:33:02.762Z",
                      "updated_at": "2026-10-19T21:33:02.762Z"
                    }
                  }
                }
              }
            }
          },
          "404": {
            "description": "not_found: No webhook with this id that this key can see.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      },
      "delete": {
        "tags": [
          "Webhooks"
        ],
        "summary": "Delete a webhook",
        "operationId": "delete_a_webhook",
        "description": "Ends the subscription. Deliveries still waiting are dropped. Needs the `webhooks:write` scope.",
        "parameters": [
          {
            "name": "webhook_id",
            "in": "path",
            "required": true,
            "description": "The webhook's id.",
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Deleted"
                },
                "examples": {
                  "ok": {
                    "summary": "OK",
                    "value": {
                      "id": "whk_1cee4f976d10",
                      "deleted": true
                    }
                  }
                }
              }
            }
          },
          "404": {
            "description": "not_found: No webhook with this id that this key can see.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      }
    },
    "/v1/webhooks/{webhook_id}/deliveries": {
      "get": {
        "tags": [
          "Webhooks"
        ],
        "summary": "List deliveries",
        "operationId": "list_deliveries",
        "description": "Recent delivery attempts, newest first, and what's still waiting to go. Start here when a receiver says it missed something. Ochio keeps the newest 500 attempts per subscription, 200 of them across a restart. Needs the `read` scope.",
        "parameters": [
          {
            "name": "webhook_id",
            "in": "path",
            "required": true,
            "description": "The webhook's id.",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "limit",
            "in": "query",
            "required": false,
            "description": "How many attempts, 1 to 500. Default 100.",
            "schema": {
              "type": "integer",
              "default": 100,
              "minimum": 1,
              "maximum": 500
            }
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/DeliveryList"
                },
                "examples": {
                  "ok": {
                    "summary": "OK",
                    "value": {
                      "data": [
                        {
                          "id": "dlv_15c5d71d2597",
                          "webhook_id": "whk_1cee4f976d10",
                          "event_id": "evt_3e86ddc85305",
                          "event_seq": 49,
                          "event_type": "webhook.test",
                          "attempt": 1,
                          "time": "2026-10-19T21:34:47.151Z",
                          "ok": true,
                          "status_code": 200,
                          "error": null,
                          "duration_ms": 2,
                          "next_retry_at": null
                        },
                        {
                          "id": "dlv_a25bdc341034",
                          "webhook_id": "whk_1cee4f976d10",
                          "event_id": "evt_9606842804d6",
                          "event_seq": 48,
                          "event_type": "report.ready",
                          "attempt": 1,
                          "time": "2026-10-19T21:34:46.951Z",
                          "ok": true,
                          "status_code": 200,
                          "error": null,
                          "duration_ms": 3,
                          "next_retry_at": null
                        },
                        {
                          "id": "dlv_205949bc8cf7",
                          "webhook_id": "whk_1cee4f976d10",
                          "event_id": "evt_c5788d8f7782",
                          "event_seq": 46,
                          "event_type": "mission.status_changed",
                          "attempt": 1,
                          "time": "2026-10-19T21:34:46.750Z",
                          "ok": true,
                          "status_code": 200,
                          "error": null,
                          "duration_ms": 3,
                          "next_retry_at": null
                        }
                      ],
                      "pending": []
                    }
                  }
                }
              }
            }
          }
        }
      }
    },
    "/v1/webhooks/{webhook_id}/test": {
      "post": {
        "tags": [
          "Webhooks"
        ],
        "summary": "Send a test delivery",
        "operationId": "test_a_webhook",
        "description": "Sends a webhook.test event to this subscription only, whatever types it chose. Use it to check your receiver and its signature check. A subscription made with enabled: false gets nothing, this test included. Needs the `webhooks:write` scope.",
        "parameters": [
          {
            "name": "webhook_id",
            "in": "path",
            "required": true,
            "description": "The webhook's id.",
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Queued",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/WebhookTest"
                },
                "examples": {
                  "queued": {
                    "summary": "Queued",
                    "value": {
                      "queued": true,
                      "event": {
                        "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."
                        }
                      }
                    }
                  }
                }
              }
            }
          }
        }
      }
    },
    "/v1/keys": {
      "get": {
        "tags": [
          "API keys"
        ],
        "summary": "List API keys",
        "operationId": "list_api_keys",
        "description": "Every key, without the keys themselves. Needs the `admin` scope.",
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/KeyList"
                },
                "examples": {
                  "ok": {
                    "summary": "OK",
                    "value": {
                      "data": [
                        {
                          "id": "key_9e5cecad4d1f",
                          "name": "operator",
                          "prefix": "ochio_ex02",
                          "scopes": [
                            "read",
                            "alerts:write",
                            "sensors:write",
                            "missions:request",
                            "missions:launch",
                            "missions:approve",
                            "webhooks:write",
                            "admin"
                          ],
                          "created_at": "2026-10-19T21:30:10.072Z",
                          "last_used_at": "2026-10-19T21:34:02.364Z"
                        },
                        {
                          "id": "key_365d1809087d",
                          "name": "partner",
                          "prefix": "ochio_ex01",
                          "scopes": [
                            "read",
                            "alerts:write",
                            "missions:request",
                            "webhooks:write"
                          ],
                          "created_at": "2026-10-19T21:30:10.072Z",
                          "last_used_at": "2026-10-19T21:34:46.535Z"
                        }
                      ]
                    }
                  }
                }
              }
            }
          }
        }
      },
      "post": {
        "tags": [
          "API keys"
        ],
        "summary": "Create an API key",
        "operationId": "create_an_api_key",
        "description": "Makes a key. The answer is the only time Ochio shows it. Needs the `admin` scope.",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/KeyCreate"
              },
              "example": {
                "name": "vms-connector",
                "scopes": [
                  "read",
                  "alerts:write"
                ]
              }
            }
          }
        },
        "responses": {
          "201": {
            "description": "Created",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/KeyWithSecret"
                },
                "examples": {
                  "created": {
                    "summary": "Created",
                    "value": {
                      "id": "key_fbf104143394",
                      "name": "vms-connector",
                      "prefix": "ochio_ex03",
                      "scopes": [
                        "read",
                        "alerts:write"
                      ],
                      "created_at": "2026-10-19T21:34:49.545Z",
                      "last_used_at": null,
                      "key": "ochio_ex03_example_key_not_real_000000"
                    }
                  }
                }
              }
            }
          },
          "400": {
            "description": "invalid_request: An unknown scope, or a name that isn't valid.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "409": {
            "description": "key_exists: A key with this name exists.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      }
    },
    "/v1/keys/{key}": {
      "delete": {
        "tags": [
          "API keys"
        ],
        "summary": "Revoke an API key",
        "operationId": "revoke_an_api_key",
        "description": "Revokes a key at once. A key can't revoke itself; use another admin key. Its webhook subscriptions stay, and keep receiving deliveries: delete them first if they should stop. Subscriptions belong to a key's name, so a new key with the same name takes them over. Needs the `admin` scope.",
        "parameters": [
          {
            "name": "key",
            "in": "path",
            "required": true,
            "description": "The key's id or name.",
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Revoked",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/KeyDeleted"
                },
                "examples": {
                  "revoked": {
                    "summary": "Revoked",
                    "value": {
                      "id": "key_fbf104143394",
                      "name": "vms-connector",
                      "deleted": true
                    }
                  }
                }
              }
            }
          },
          "404": {
            "description": "not_found: No key with this id or name.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "409": {
            "description": "key_in_use: That's the key making the request.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                },
                "examples": {
                  "key_in_use": {
                    "value": {
                      "error": {
                        "code": "key_in_use",
                        "message": "That is the key making this request; delete it with another admin key."
                      }
                    }
                  }
                }
              }
            }
          }
        }
      }
    },
    "/v1/dev/motion": {
      "post": {
        "tags": [
          "Sandbox"
        ],
        "summary": "Simulate an alert",
        "operationId": "dev_motion",
        "description": "A simulated sensor sends an alert, through the same path as a signed one. Optionally, a simulated person appears about 35 m from the sensor, for the drone to find. Needs the `admin` scope.",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/DevMotion"
              },
              "example": {
                "sensor_id": "generator-yard-door-01",
                "type": "door_open",
                "priority": "medium"
              }
            }
          }
        },
        "responses": {
          "201": {
            "description": "Created",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "result": {
                      "type": "string"
                    },
                    "alert": {
                      "type": "object",
                      "properties": {
                        "id": {
                          "type": "string"
                        },
                        "source": {
                          "type": "string"
                        },
                        "source_alert_id": {
                          "type": "string"
                        },
                        "version": {
                          "type": "integer"
                        },
                        "type": {
                          "type": "string"
                        },
                        "priority": {
                          "type": "string"
                        },
                        "location": {
                          "type": "object",
                          "properties": {
                            "lat": {
                              "type": "number"
                            },
                            "lon": {
                              "type": "number"
                            }
                          },
                          "required": [
                            "lat",
                            "lon"
                          ]
                        },
                        "zone_id": {
                          "type": "string"
                        },
                        "status": {
                          "type": "string"
                        },
                        "mission_id": {
                          "type": "string"
                        },
                        "mission_history": {
                          "type": "array",
                          "items": {
                            "type": "string"
                          }
                        },
                        "time": {
                          "type": "string",
                          "format": "date-time"
                        },
                        "title": {
                          "type": "null"
                        },
                        "description": {
                          "type": "null"
                        },
                        "media_url": {
                          "type": "null"
                        },
                        "data": {
                          "type": "null"
                        },
                        "received_by": {
                          "type": "string"
                        },
                        "dismissed_by": {
                          "type": "null"
                        },
                        "resolved_at": {
                          "type": "null"
                        },
                        "created_at": {
                          "type": "string",
                          "format": "date-time"
                        },
                        "updated_at": {
                          "type": "string",
                          "format": "date-time"
                        }
                      },
                      "required": [
                        "created_at",
                        "data",
                        "description",
                        "dismissed_by",
                        "id",
                        "location",
                        "media_url",
                        "mission_history",
                        "mission_id",
                        "priority",
                        "received_by",
                        "resolved_at",
                        "source",
                        "source_alert_id",
                        "status",
                        "time",
                        "title",
                        "type",
                        "updated_at",
                        "version",
                        "zone_id"
                      ]
                    },
                    "mission": {
                      "type": "object",
                      "properties": {
                        "id": {
                          "type": "string"
                        },
                        "status": {
                          "type": "string"
                        },
                        "vehicle_id": {
                          "type": "null"
                        }
                      },
                      "required": [
                        "id",
                        "status",
                        "vehicle_id"
                      ]
                    },
                    "rule": {
                      "type": "object",
                      "properties": {
                        "rule_id": {
                          "type": "string"
                        },
                        "outcome": {
                          "type": "string"
                        },
                        "mission_id": {
                          "type": "string"
                        },
                        "mission_status": {
                          "type": "string"
                        }
                      },
                      "required": [
                        "mission_id",
                        "mission_status",
                        "outcome",
                        "rule_id"
                      ]
                    },
                    "intruder": {
                      "type": "null"
                    }
                  },
                  "required": [
                    "alert",
                    "intruder",
                    "mission",
                    "result",
                    "rule"
                  ]
                },
                "examples": {
                  "created": {
                    "summary": "Created",
                    "value": {
                      "result": "created",
                      "alert": {
                        "id": "alt_02fcb2845e3a",
                        "source": "generator-yard-door-01",
                        "source_alert_id": "bench_e0b6c003",
                        "version": 1,
                        "type": "door_open",
                        "priority": "medium",
                        "location": {
                          "lat": 38.4979,
                          "lon": -98.0047
                        },
                        "zone_id": "generator-yard",
                        "status": "responding",
                        "mission_id": "msn_7c755ad98d22",
                        "mission_history": [
                          "msn_7c755ad98d22"
                        ],
                        "time": "2026-10-19T21:34:46.531Z",
                        "title": null,
                        "description": null,
                        "media_url": null,
                        "data": null,
                        "received_by": "sensor:generator-yard-door-01",
                        "dismissed_by": null,
                        "resolved_at": null,
                        "created_at": "2026-10-19T21:34:46.531Z",
                        "updated_at": "2026-10-19T21:34:46.531Z"
                      },
                      "mission": {
                        "id": "msn_7c755ad98d22",
                        "status": "pending_approval",
                        "vehicle_id": null
                      },
                      "rule": {
                        "rule_id": "generator-yard-door",
                        "outcome": "mission_created",
                        "mission_id": "msn_7c755ad98d22",
                        "mission_status": "pending_approval"
                      },
                      "intruder": null
                    }
                  }
                }
              }
            }
          }
        }
      }
    },
    "/v1/dev/sensors/{sensor_id}/power": {
      "post": {
        "tags": [
          "Sandbox"
        ],
        "summary": "Cut or restore a sensor's power",
        "operationId": "dev_power",
        "description": "Stops or restarts a simulated sensor's check-ins. With its power off, it turns silent once its check-ins expire. Needs the `admin` scope.",
        "parameters": [
          {
            "name": "sensor_id",
            "in": "path",
            "required": true,
            "description": "A simulated sensor.",
            "schema": {
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/DevPower"
              },
              "example": {
                "on": false
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Power off",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "sensor_id": {
                      "type": "string"
                    },
                    "power": {
                      "type": "string"
                    },
                    "status": {
                      "type": "string"
                    },
                    "silent_after": {
                      "type": "string",
                      "format": "date-time"
                    }
                  },
                  "required": [
                    "power",
                    "sensor_id",
                    "silent_after",
                    "status"
                  ]
                },
                "examples": {
                  "power_off": {
                    "summary": "Power off",
                    "value": {
                      "sensor_id": "east-gate-cam-01",
                      "power": "off",
                      "status": "online",
                      "silent_after": "2026-10-19T21:35:01.921Z"
                    }
                  }
                }
              }
            }
          },
          "409": {
            "description": "not_simulated: The sensor is real.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      }
    },
    "/v1/dev/intruders": {
      "post": {
        "tags": [
          "Sandbox"
        ],
        "summary": "Place a simulated person",
        "operationId": "dev_intruders",
        "description": "Puts a simulated person on the map for 15 minutes. A drone on scene or on patrol within 60 m sees them. Needs the `admin` scope.",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/DevIntruder"
              },
              "example": {
                "lat": 38.5007,
                "lon": -97.9953,
                "label": "Person"
              }
            }
          }
        },
        "responses": {
          "201": {
            "description": "Created",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "id": {
                      "type": "string"
                    },
                    "lat": {
                      "type": "number"
                    },
                    "lon": {
                      "type": "number"
                    },
                    "label": {
                      "type": "string"
                    },
                    "zone_id": {
                      "type": "string"
                    },
                    "placed_at": {
                      "type": "string",
                      "format": "date-time"
                    },
                    "expires_at": {
                      "type": "number"
                    }
                  },
                  "required": [
                    "expires_at",
                    "id",
                    "label",
                    "lat",
                    "lon",
                    "placed_at",
                    "zone_id"
                  ]
                },
                "examples": {
                  "created": {
                    "summary": "Created",
                    "value": {
                      "id": "int_f5a3fe19",
                      "lat": 38.5007,
                      "lon": -97.9953,
                      "label": "Person",
                      "zone_id": "east-gate",
                      "placed_at": "2026-10-19T21:33:03.881Z",
                      "expires_at": 1792446483.8811839
                    }
                  }
                }
              }
            }
          }
        }
      },
      "delete": {
        "tags": [
          "Sandbox"
        ],
        "summary": "Clear simulated people",
        "operationId": "dev_intruders_clear",
        "description": "Removes every simulated person. Needs the `admin` scope.",
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "removed": {
                      "type": "integer"
                    }
                  },
                  "required": [
                    "removed"
                  ]
                },
                "examples": {
                  "ok": {
                    "summary": "OK",
                    "value": {
                      "removed": 1
                    }
                  }
                }
              }
            }
          }
        }
      }
    },
    "/v1/dev/vehicles/{vehicle_id}/fault": {
      "post": {
        "tags": [
          "Sandbox"
        ],
        "summary": "Fault a vehicle",
        "operationId": "dev_fault",
        "description": "Makes a vehicle report a fault. A mission it's flying fails, and it flies home. /clear-fault repairs it; /battery sets its battery, as {\"pct\": 25} . Needs the `admin` scope.",
        "parameters": [
          {
            "name": "vehicle_id",
            "in": "path",
            "required": true,
            "description": "The vehicle.",
            "schema": {
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "required": false,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/DevFault"
              },
              "example": {
                "message": "Motor 3 overheating"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Fault",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "id": {
                      "type": "string"
                    },
                    "name": {
                      "type": "string"
                    },
                    "type": {
                      "type": "string"
                    },
                    "model": {
                      "type": "string"
                    },
                    "adapter": {
                      "type": "string"
                    },
                    "capabilities": {
                      "type": "array",
                      "items": {
                        "type": "string"
                      }
                    },
                    "home": {
                      "type": "object",
                      "properties": {
                        "lat": {
                          "type": "number"
                        },
                        "lon": {
                          "type": "number"
                        }
                      },
                      "required": [
                        "lat",
                        "lon"
                      ]
                    },
                    "position": {
                      "type": "object",
                      "properties": {
                        "lat": {
                          "type": "number"
                        },
                        "lon": {
                          "type": "number"
                        },
                        "alt_m": {
                          "type": "number"
                        }
                      },
                      "required": [
                        "alt_m",
                        "lat",
                        "lon"
                      ]
                    },
                    "heading_deg": {
                      "type": "number"
                    },
                    "ground_speed_mps": {
                      "type": "number"
                    },
                    "speed_mps": {
                      "type": "number"
                    },
                    "range_m": {
                      "type": "number"
                    },
                    "battery_pct": {
                      "type": "number"
                    },
                    "status": {
                      "type": "string"
                    },
                    "ready": {
                      "type": "boolean"
                    },
                    "charging": {
                      "type": "boolean"
                    },
                    "mission_id": {
                      "type": "null"
                    },
                    "fault": {
                      "type": "string"
                    },
                    "created_at": {
                      "type": "string",
                      "format": "date-time"
                    },
                    "updated_at": {
                      "type": "string",
                      "format": "date-time"
                    }
                  },
                  "required": [
                    "adapter",
                    "battery_pct",
                    "capabilities",
                    "charging",
                    "created_at",
                    "fault",
                    "ground_speed_mps",
                    "heading_deg",
                    "home",
                    "id",
                    "mission_id",
                    "model",
                    "name",
                    "position",
                    "range_m",
                    "ready",
                    "speed_mps",
                    "status",
                    "type",
                    "updated_at"
                  ]
                },
                "examples": {
                  "fault": {
                    "summary": "Fault",
                    "value": {
                      "id": "drone-2",
                      "name": "Drone 2",
                      "type": "quadcopter",
                      "model": "Ochio quad (simulated)",
                      "adapter": "sim",
                      "capabilities": [
                        "camera",
                        "depth"
                      ],
                      "home": {
                        "lat": 38.499,
                        "lon": -98.0007
                      },
                      "position": {
                        "lat": 38.499,
                        "lon": -98.0007,
                        "alt_m": 0.0
                      },
                      "heading_deg": 251.4,
                      "ground_speed_mps": 0.0,
                      "speed_mps": 12.0,
                      "range_m": 6000.0,
                      "battery_pct": 25.0,
                      "status": "fault",
                      "ready": false,
                      "charging": false,
                      "mission_id": null,
                      "fault": "Motor 3 overheating",
                      "created_at": "2026-10-19T21:30:10.072Z",
                      "updated_at": "2026-10-19T21:34:49.559Z"
                    }
                  }
                }
              }
            }
          }
        }
      }
    },
    "/v1/dev/sim-speed": {
      "post": {
        "tags": [
          "Sandbox"
        ],
        "summary": "Change the simulation speed",
        "operationId": "dev_sim_speed",
        "description": "Flies the drones faster or slower, 0.25 to 20 times. Cooldowns scale with it. Needs the `admin` scope.",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/DevSpeed"
              },
              "example": {
                "speed": 5
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "sim_speed": {
                      "type": "number"
                    }
                  },
                  "required": [
                    "sim_speed"
                  ]
                },
                "examples": {
                  "ok": {
                    "summary": "OK",
                    "value": {
                      "sim_speed": 5.0
                    }
                  }
                }
              }
            }
          }
        }
      }
    },
    "/v1/dev/tampered-alert": {
      "post": {
        "tags": [
          "Sandbox"
        ],
        "summary": "Send a tampered alert",
        "operationId": "dev_tampered",
        "description": "Signs an alert as a sensor, changes the body after signing, and sends it to POST /v1/alerts , to show that Ochio refuses it. Needs the `admin` scope.",
        "requestBody": {
          "required": false,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/DevTamper"
              },
              "example": {
                "sensor_id": "north-fence-pir-01"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "sent": {
                      "type": "string"
                    },
                    "signed": {
                      "type": "string"
                    },
                    "status": {
                      "type": "integer"
                    },
                    "response": {
                      "type": "object",
                      "properties": {
                        "error": {
                          "type": "object",
                          "properties": {
                            "code": {
                              "type": "string"
                            },
                            "message": {
                              "type": "string"
                            }
                          },
                          "required": [
                            "code",
                            "message"
                          ]
                        }
                      },
                      "required": [
                        "error"
                      ]
                    },
                    "alerts_before": {
                      "type": "integer"
                    },
                    "alerts_after": {
                      "type": "integer"
                    },
                    "alert_created": {
                      "type": "boolean"
                    }
                  },
                  "required": [
                    "alert_created",
                    "alerts_after",
                    "alerts_before",
                    "response",
                    "sent",
                    "signed",
                    "status"
                  ]
                },
                "examples": {
                  "ok": {
                    "summary": "OK",
                    "value": {
                      "sent": "{\"id\": \"tamper_a56db0a5\", \"source\": \"north-fence-pir-01\", \"type\": \"motion\", \"priority\": \"critical\"}",
                      "signed": "{\"id\": \"tamper_a56db0a5\", \"source\": \"north-fence-pir-01\", \"type\": \"motion\", \"priority\": \"low\"}",
                      "status": 401,
                      "response": {
                        "error": {
                          "code": "invalid_signature",
                          "message": "The signature does not match the body. Nothing was recorded."
                        }
                      },
                      "alerts_before": 3,
                      "alerts_after": 3,
                      "alert_created": false
                    }
                  }
                }
              }
            }
          }
        }
      }
    },
    "/v1/dev/state": {
      "get": {
        "tags": [
          "Sandbox"
        ],
        "summary": "Read or reset the simulation",
        "operationId": "dev_state_reset",
        "description": "GET /v1/dev/state returns the simulation speed, the simulated people, which sensors have power, and every event type. POST /v1/dev/reset clears alerts, missions, detections, reports and simulated people, and puts the fleet back on its dock, fully charged. POST /v1/dev/inject re-sends one exported event; the replay tool uses it. Needs the `admin` scope.",
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "sim_speed": {
                      "type": "number"
                    },
                    "intruders": {
                      "type": "array",
                      "items": {
                        "type": "object",
                        "properties": {
                          "id": {
                            "type": "string"
                          },
                          "lat": {
                            "type": "number"
                          },
                          "lon": {
                            "type": "number"
                          },
                          "label": {
                            "type": "string"
                          },
                          "zone_id": {
                            "type": "string"
                          },
                          "placed_at": {
                            "type": "string",
                            "format": "date-time"
                          },
                          "expires_at": {
                            "type": "number"
                          }
                        },
                        "required": [
                          "expires_at",
                          "id",
                          "label",
                          "lat",
                          "lon",
                          "placed_at",
                          "zone_id"
                        ]
                      }
                    },
                    "sensor_power": {
                      "type": "object",
                      "properties": {
                        "north-fence-pir-01": {
                          "type": "boolean"
                        },
                        "east-gate-cam-01": {
                          "type": "boolean"
                        },
                        "generator-yard-door-01": {
                          "type": "boolean"
                        }
                      },
                      "required": [
                        "east-gate-cam-01",
                        "generator-yard-door-01",
                        "north-fence-pir-01"
                      ]
                    },
                    "event_types": {
                      "type": "array",
                      "items": {
                        "type": "string"
                      }
                    }
                  },
                  "required": [
                    "event_types",
                    "intruders",
                    "sensor_power",
                    "sim_speed"
                  ]
                },
                "examples": {
                  "ok": {
                    "summary": "OK",
                    "value": {
                      "sim_speed": 1.0,
                      "intruders": [
                        {
                          "id": "int_f5a3fe19",
                          "lat": 38.5007,
                          "lon": -97.9953,
                          "label": "Person",
                          "zone_id": "east-gate",
                          "placed_at": "2026-10-19T21:33:03.881Z",
                          "expires_at": 1792446483.8811839
                        }
                      ],
                      "sensor_power": {
                        "north-fence-pir-01": true,
                        "east-gate-cam-01": true,
                        "generator-yard-door-01": true
                      },
                      "event_types": [
                        "alert.received",
                        "alert.updated",
                        "alert.resolved",
                        "alert.dismissed",
                        "sensor.registered",
                        "sensor.online",
                        "sensor.silent",
                        "sensor.recovered",
                        "sensor.removed",
                        "rule.suppressed",
                        "mission.created",
                        "mission.status_changed",
                        "vehicle.status_changed",
                        "detection.created",
                        "report.ready",
                        "webhook.test"
                      ]
                    }
                  }
                }
              }
            }
          }
        }
      }
    },
    "/v1/dev/reset": {
      "post": {
        "tags": [
          "Sandbox"
        ],
        "summary": "Reset the sandbox",
        "operationId": "reset_the_sandbox",
        "description": "Sandbox only: exists in test mode, and needs the admin scope.",
        "security": [
          {
            "apiKey": []
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object"
                }
              }
            }
          }
        }
      }
    },
    "/v1/dev/inject": {
      "post": {
        "tags": [
          "Sandbox"
        ],
        "summary": "Re-send one exported event",
        "operationId": "re_send_one_exported_event",
        "description": "Sandbox only: exists in test mode, and needs the admin scope.",
        "security": [
          {
            "apiKey": []
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object"
                }
              }
            }
          }
        },
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "description": "One event, as GET /v1/events/export writes it."
              }
            }
          }
        }
      }
    },
    "/v1/dev/vehicles/{vehicle_id}/clear-fault": {
      "post": {
        "tags": [
          "Sandbox"
        ],
        "summary": "Repair a vehicle",
        "operationId": "repair_a_vehicle",
        "description": "Sandbox only: exists in test mode, and needs the admin scope.",
        "security": [
          {
            "apiKey": []
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object"
                }
              }
            }
          }
        },
        "parameters": [
          {
            "name": "vehicle_id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ]
      }
    },
    "/v1/dev/vehicles/{vehicle_id}/battery": {
      "post": {
        "tags": [
          "Sandbox"
        ],
        "summary": "Set a vehicle's battery",
        "operationId": "set_a_vehicle_s_battery",
        "description": "Sandbox only: exists in test mode, and needs the admin scope.",
        "security": [
          {
            "apiKey": []
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object"
                }
              }
            }
          }
        },
        "parameters": [
          {
            "name": "vehicle_id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "required": [
                  "pct"
                ],
                "properties": {
                  "pct": {
                    "type": "number",
                    "minimum": 0,
                    "maximum": 100
                  }
                }
              }
            }
          }
        }
      }
    }
  },
  "components": {
    "securitySchemes": {
      "apiKey": {
        "type": "http",
        "scheme": "bearer",
        "description": "An Ochio API key, `ochio_…`. Each key carries scopes."
      },
      "sensorTimestamp": {
        "type": "apiKey",
        "in": "header",
        "name": "Ochio-Timestamp",
        "description": "Unix time in seconds when the sensor signed the request."
      },
      "sensorSignature": {
        "type": "apiKey",
        "in": "header",
        "name": "Ochio-Signature",
        "description": "v1=<hex HMAC-SHA256 of \"<timestamp>.<raw body>\", keyed with the sensor's secret>."
      }
    },
    "schemas": {
      "LatLon": {
        "type": "object",
        "required": [
          "lat",
          "lon"
        ],
        "properties": {
          "lat": {
            "type": "number",
            "minimum": -90,
            "maximum": 90,
            "description": "Latitude in decimal degrees."
          },
          "lon": {
            "type": "number",
            "minimum": -180,
            "maximum": 180,
            "description": "Longitude in decimal degrees."
          }
        }
      },
      "Error": {
        "type": "object",
        "required": [
          "error"
        ],
        "properties": {
          "error": {
            "type": "object",
            "required": [
              "code",
              "message"
            ],
            "properties": {
              "code": {
                "type": "string",
                "description": "A short, stable code to check in your code."
              },
              "message": {
                "type": "string",
                "description": "A sentence for a person."
              },
              "details": {
                "description": "More detail on some errors: failed checks, fields that aren't valid, a missing scope."
              }
            }
          }
        }
      },
      "SensorWithSecret": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string",
            "description": "The sensor's id: letters, digits, . , _ and - , up to 64 characters."
          },
          "name": {
            "type": "string",
            "description": "A name people read."
          },
          "type": {
            "type": "string",
            "description": "What it is, in your words: motion , door , camera , radar ."
          },
          "location": {
            "type": "object",
            "properties": {
              "lat": {
                "type": "number"
              },
              "lon": {
                "type": "number"
              }
            },
            "required": [
              "lat",
              "lon"
            ],
            "description": "Where it is: {\"lat\", \"lon\"} ."
          },
          "zone_id": {
            "type": "string",
            "description": "The zone it sits in, worked out from its location. null outside the operating area."
          },
          "checkin_interval_s": {
            "type": "number",
            "description": "How often it checks in, in seconds."
          },
          "missed_checkins_allowed": {
            "type": "integer",
            "description": "How many check-ins it may miss before it counts as silent."
          },
          "status": {
            "type": "string",
            "description": "pending , online or silent . See statuses .",
            "enum": [
              "pending",
              "online",
              "silent"
            ]
          },
          "last_seen": {
            "type": "null",
            "description": "When it last checked in or sent an alert."
          },
          "expires_at": {
            "type": "null",
            "description": "When it turns silent if nothing arrives first."
          },
          "battery_pct": {
            "type": "null",
            "description": "The battery level from its last check-in, if it sent one."
          },
          "reported_status": {
            "type": "null",
            "description": "The health word from its last check-in, like ok or degraded ."
          },
          "simulated": {
            "type": "boolean",
            "description": "true for the sandbox's simulated sensors."
          },
          "origin": {
            "type": "string",
            "description": "How it was added: api , site (part of the site's setup) or replay ."
          },
          "created_at": {
            "type": "string",
            "format": "date-time",
            "description": "When it was registered."
          },
          "updated_at": {
            "type": "string",
            "format": "date-time",
            "description": "When it last changed."
          },
          "secret": {
            "type": "string",
            "description": "The sensor's signing secret. Shown once."
          }
        },
        "required": [
          "battery_pct",
          "checkin_interval_s",
          "created_at",
          "expires_at",
          "id",
          "last_seen",
          "location",
          "missed_checkins_allowed",
          "name",
          "origin",
          "reported_status",
          "secret",
          "simulated",
          "status",
          "type",
          "updated_at",
          "zone_id"
        ]
      },
      "HeartbeatResult": {
        "type": "object",
        "properties": {
          "sensor_id": {
            "type": "string"
          },
          "status": {
            "type": "string"
          },
          "next_checkin_by": {
            "type": "string",
            "format": "date-time"
          },
          "expires_at": {
            "type": "string",
            "format": "date-time"
          }
        },
        "required": [
          "expires_at",
          "next_checkin_by",
          "sensor_id",
          "status"
        ]
      },
      "SensorList": {
        "type": "object",
        "properties": {
          "data": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/Sensor"
            }
          }
        },
        "required": [
          "data"
        ]
      },
      "Sensor": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string",
            "description": "The sensor's id: letters, digits, . , _ and - , up to 64 characters."
          },
          "name": {
            "type": "string",
            "description": "A name people read."
          },
          "type": {
            "type": "string",
            "description": "What it is, in your words: motion , door , camera , radar ."
          },
          "location": {
            "type": "object",
            "properties": {
              "lat": {
                "type": "number"
              },
              "lon": {
                "type": "number"
              }
            },
            "required": [
              "lat",
              "lon"
            ],
            "description": "Where it is: {\"lat\", \"lon\"} ."
          },
          "zone_id": {
            "type": "string",
            "description": "The zone it sits in, worked out from its location. null outside the operating area."
          },
          "checkin_interval_s": {
            "type": "number",
            "description": "How often it checks in, in seconds."
          },
          "missed_checkins_allowed": {
            "type": "integer",
            "description": "How many check-ins it may miss before it counts as silent."
          },
          "status": {
            "type": "string",
            "description": "pending , online or silent . See statuses .",
            "enum": [
              "pending",
              "online",
              "silent"
            ]
          },
          "last_seen": {
            "type": "string",
            "format": "date-time",
            "description": "When it last checked in or sent an alert."
          },
          "expires_at": {
            "type": "string",
            "format": "date-time",
            "description": "When it turns silent if nothing arrives first."
          },
          "battery_pct": {
            "type": [
              "number",
              "null"
            ],
            "description": "The battery level from its last check-in, if it sent one."
          },
          "reported_status": {
            "type": [
              "string",
              "null"
            ],
            "description": "The health word from its last check-in, like ok or degraded ."
          },
          "simulated": {
            "type": "boolean",
            "description": "true for the sandbox's simulated sensors."
          },
          "origin": {
            "type": "string",
            "description": "How it was added: api , site (part of the site's setup) or replay ."
          },
          "created_at": {
            "type": "string",
            "format": "date-time",
            "description": "When it was registered."
          },
          "updated_at": {
            "type": "string",
            "format": "date-time",
            "description": "When it last changed."
          }
        },
        "required": [
          "battery_pct",
          "checkin_interval_s",
          "created_at",
          "expires_at",
          "id",
          "last_seen",
          "location",
          "missed_checkins_allowed",
          "name",
          "origin",
          "reported_status",
          "simulated",
          "status",
          "type",
          "updated_at",
          "zone_id"
        ]
      },
      "SensorSecret": {
        "type": "object",
        "properties": {
          "sensor_id": {
            "type": "string"
          },
          "secret": {
            "type": "string"
          }
        },
        "required": [
          "secret",
          "sensor_id"
        ]
      },
      "Deleted": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string"
          },
          "deleted": {
            "type": "boolean"
          }
        },
        "required": [
          "deleted",
          "id"
        ]
      },
      "AlertResult": {
        "type": "object",
        "properties": {
          "result": {
            "type": "string"
          },
          "alert": {
            "type": "object",
            "properties": {
              "id": {
                "type": "string"
              },
              "source": {
                "type": "string"
              },
              "source_alert_id": {
                "type": "string"
              },
              "version": {
                "type": "integer"
              },
              "type": {
                "type": "string"
              },
              "priority": {
                "type": "string"
              },
              "location": {
                "type": "object",
                "properties": {
                  "lat": {
                    "type": "number"
                  },
                  "lon": {
                    "type": "number"
                  }
                },
                "required": [
                  "lat",
                  "lon"
                ]
              },
              "zone_id": {
                "type": "string"
              },
              "status": {
                "type": "string"
              },
              "mission_id": {
                "type": "string"
              },
              "mission_history": {
                "type": "array",
                "items": {
                  "type": "string"
                }
              },
              "time": {
                "type": "string",
                "format": "date-time"
              },
              "title": {
                "type": "string"
              },
              "description": {
                "type": "null"
              },
              "media_url": {
                "type": "null"
              },
              "data": {
                "type": "null"
              },
              "received_by": {
                "type": "string"
              },
              "dismissed_by": {
                "type": "null"
              },
              "resolved_at": {
                "type": "null"
              },
              "created_at": {
                "type": "string",
                "format": "date-time"
              },
              "updated_at": {
                "type": "string",
                "format": "date-time"
              }
            },
            "required": [
              "created_at",
              "data",
              "description",
              "dismissed_by",
              "id",
              "location",
              "media_url",
              "mission_history",
              "mission_id",
              "priority",
              "received_by",
              "resolved_at",
              "source",
              "source_alert_id",
              "status",
              "time",
              "title",
              "type",
              "updated_at",
              "version",
              "zone_id"
            ]
          },
          "mission": {
            "type": "object",
            "properties": {
              "id": {
                "type": "string"
              },
              "status": {
                "type": "string"
              },
              "vehicle_id": {
                "type": "string"
              }
            },
            "required": [
              "id",
              "status",
              "vehicle_id"
            ]
          },
          "rule": {
            "type": "object",
            "properties": {
              "rule_id": {
                "type": "string"
              },
              "outcome": {
                "type": "string"
              },
              "mission_id": {
                "type": "string"
              },
              "mission_status": {
                "type": "string"
              }
            },
            "required": [
              "mission_id",
              "mission_status",
              "outcome",
              "rule_id"
            ]
          }
        },
        "required": [
          "alert",
          "mission",
          "result",
          "rule"
        ]
      },
      "AlertList": {
        "type": "object",
        "properties": {
          "data": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/Alert"
            }
          }
        },
        "required": [
          "data"
        ]
      },
      "Alert": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string",
            "description": "Ochio's id for the alert, alt_… ."
          },
          "source": {
            "type": "string",
            "description": "The sensor it's about."
          },
          "source_alert_id": {
            "type": "string",
            "description": "The sender's own id for the incident (the id it sent)."
          },
          "version": {
            "type": "integer",
            "description": "The latest version received."
          },
          "type": {
            "type": "string",
            "description": "What happened, in the sender's words: motion , door_open , person ."
          },
          "priority": {
            "type": "string",
            "description": "low , medium , high or critical .",
            "enum": [
              "low",
              "medium",
              "high",
              "critical"
            ]
          },
          "location": {
            "type": "object",
            "properties": {
              "lat": {
                "type": "number"
              },
              "lon": {
                "type": "number"
              }
            },
            "required": [
              "lat",
              "lon"
            ],
            "description": "Where it happened: {\"lat\", \"lon\"} ."
          },
          "zone_id": {
            "type": "string",
            "description": "The zone the location falls in."
          },
          "status": {
            "type": "string",
            "description": "open , responding , resolved or dismissed . See statuses .",
            "enum": [
              "open",
              "responding",
              "resolved",
              "dismissed"
            ]
          },
          "mission_id": {
            "type": [
              "string",
              "null"
            ],
            "description": "The mission answering it now."
          },
          "mission_history": {
            "type": "array",
            "items": {
              "type": "string"
            },
            "description": "Every mission that has answered it, oldest first."
          },
          "time": {
            "type": "string",
            "format": "date-time",
            "description": "When it happened (the sender's time, or when Ochio received it)."
          },
          "title": {
            "type": "string",
            "description": "A short headline from the sender."
          },
          "description": {
            "type": [
              "string",
              "null"
            ],
            "description": "More detail from the sender."
          },
          "media_url": {
            "type": [
              "string",
              "null"
            ],
            "description": "A link to a picture or clip from the sender."
          },
          "data": {
            "type": [
              "object",
              "null"
            ],
            "properties": {
              "camera": {
                "type": "string"
              },
              "plate": {
                "type": "string"
              }
            },
            "required": [
              "camera",
              "plate"
            ],
            "description": "Anything else the sender attached, kept as sent."
          },
          "received_by": {
            "type": "string",
            "description": "Who sent it: sensor:<id> for a signed request, key:<name> for an API key."
          },
          "dismissed_by": {
            "type": [
              "string",
              "null"
            ],
            "description": "Who dismissed it."
          },
          "resolved_at": {
            "type": "null",
            "description": "When its mission completed."
          },
          "created_at": {
            "type": "string",
            "format": "date-time",
            "description": "When Ochio first received it."
          },
          "updated_at": {
            "type": "string",
            "format": "date-time",
            "description": "When it last changed."
          }
        },
        "required": [
          "created_at",
          "data",
          "description",
          "dismissed_by",
          "id",
          "location",
          "media_url",
          "mission_history",
          "mission_id",
          "priority",
          "received_by",
          "resolved_at",
          "source",
          "source_alert_id",
          "status",
          "time",
          "title",
          "type",
          "updated_at",
          "version",
          "zone_id"
        ]
      },
      "Mission": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string",
            "description": "The mission's id, msn_… ."
          },
          "type": {
            "type": "string",
            "description": "inspect or patrol .",
            "enum": [
              "inspect",
              "patrol"
            ]
          },
          "status": {
            "type": "string",
            "description": "Where it is in its life cycle ."
          },
          "priority": {
            "type": "string",
            "description": "low to critical . Queued missions launch highest first."
          },
          "reason": {
            "type": "string",
            "description": "Why it was requested, in words."
          },
          "target": {
            "type": "object",
            "properties": {
              "kind": {
                "type": "string"
              },
              "zone_id": {
                "type": "string"
              },
              "location": {
                "type": "object",
                "properties": {
                  "lat": {
                    "type": "number"
                  },
                  "lon": {
                    "type": "number"
                  }
                },
                "required": [
                  "lat",
                  "lon"
                ]
              },
              "name": {
                "type": "string"
              },
              "alert_id": {
                "type": "string"
              },
              "sensor_id": {
                "type": "string"
              }
            },
            "required": [
              "kind",
              "location",
              "name",
              "zone_id"
            ],
            "description": "What it flies to: kind ( location , sensor , zone or alert ), the id it was given, location , zone_id and a name people read."
          },
          "patrol_points": {
            "type": [
              "array",
              "null"
            ],
            "items": {
              "type": "object",
              "properties": {
                "lat": {
                  "type": "number"
                },
                "lon": {
                  "type": "number"
                }
              },
              "required": [
                "lat",
                "lon"
              ]
            },
            "description": "For a patrol, the corners of the zone it flies, in order."
          },
          "vehicle_id": {
            "type": [
              "string",
              "null"
            ],
            "description": "The vehicle flying it, once one is assigned."
          },
          "requested_vehicle_id": {
            "type": "null",
            "description": "The vehicle the request asked for, if any."
          },
          "requested_by": {
            "type": "string",
            "description": "Who asked: key:<name> or rule:<id> ."
          },
          "trigger": {
            "type": "object",
            "properties": {
              "kind": {
                "type": "string"
              },
              "rule_id": {
                "type": [
                  "string",
                  "null"
                ]
              },
              "sensor_id": {
                "type": [
                  "string",
                  "null"
                ]
              },
              "alert_ids": {
                "type": "array",
                "items": {
                  "type": "string"
                }
              },
              "client": {
                "type": [
                  "string",
                  "null"
                ]
              }
            },
            "required": [
              "alert_ids",
              "kind",
              "rule_id",
              "sensor_id"
            ],
            "description": "What started it: kind ( request , alert or sensor_silent ), rule_id , sensor_id , alert_ids , and the client named in the Ochio-Client header."
          },
          "approval": {
            "type": "object",
            "properties": {
              "mode": {
                "type": "string"
              },
              "required": {
                "type": "boolean"
              },
              "reasons": {
                "type": "array",
                "items": {
                  "type": "string"
                }
              },
              "decision": {
                "type": [
                  "string",
                  "null"
                ]
              },
              "decided_by": {
                "type": [
                  "string",
                  "null"
                ]
              },
              "decided_at": {
                "type": [
                  "string",
                  "null"
                ],
                "format": "date-time"
              },
              "note": {
                "type": [
                  "string",
                  "null"
                ]
              }
            },
            "required": [
              "decided_at",
              "decided_by",
              "decision",
              "mode",
              "note",
              "reasons",
              "required"
            ],
            "description": "mode , whether it's required and the reasons , then the decision , decided_by , decided_at and note ."
          },
          "safety": {
            "type": "object",
            "properties": {
              "result": {
                "type": "string"
              },
              "checks": {
                "type": "array",
                "items": {
                  "type": "object",
                  "properties": {
                    "name": {
                      "type": "string"
                    },
                    "passed": {
                      "type": "boolean"
                    },
                    "detail": {
                      "type": "string"
                    }
                  },
                  "required": [
                    "detail",
                    "name",
                    "passed"
                  ]
                }
              },
              "checked_at": {
                "type": "string",
                "format": "date-time"
              }
            },
            "required": [
              "checked_at",
              "checks",
              "result"
            ],
            "description": "The safety gate's result and its checks ."
          },
          "on_scene_s": {
            "type": "number",
            "description": "For an inspection, how long the drone looks, in seconds."
          },
          "progress": {
            "type": "object",
            "properties": {
              "phase": {
                "type": "string"
              },
              "distance_to_target_m": {
                "type": "integer"
              },
              "eta_s": {
                "type": "integer"
              },
              "battery_pct": {
                "type": "number"
              },
              "distance_flown_m": {
                "type": "integer"
              },
              "detections": {
                "type": "integer"
              },
              "waiting_for": {
                "type": "string"
              },
              "detail": {
                "type": "string"
              }
            },
            "required": [
              "phase"
            ],
            "description": "Live numbers for the current phase. See progress ."
          },
          "history": {
            "type": "array",
            "items": {
              "type": "object",
              "properties": {
                "status": {
                  "type": "string"
                },
                "time": {
                  "type": "string",
                  "format": "date-time"
                },
                "actor": {
                  "type": "string"
                },
                "note": {
                  "type": "string"
                }
              },
              "required": [
                "actor",
                "note",
                "status",
                "time"
              ]
            },
            "description": "Every status it has had, each with time , actor and note ."
          },
          "alert_ids": {
            "type": "array",
            "items": {
              "type": "string"
            },
            "description": "Alerts it answers."
          },
          "detection_ids": {
            "type": "array",
            "items": {},
            "description": "What its drone saw."
          },
          "result": {
            "type": [
              "object",
              "null"
            ],
            "properties": {
              "outcome": {
                "type": "string"
              },
              "reason": {
                "type": "string"
              },
              "detections": {
                "type": "integer"
              },
              "battery_end_pct": {
                "type": [
                  "number",
                  "null"
                ]
              },
              "distance_flown_m": {
                "type": "integer"
              },
              "report_id": {
                "type": "string"
              }
            },
            "required": [
              "battery_end_pct",
              "detections",
              "distance_flown_m",
              "outcome",
              "reason",
              "report_id"
            ],
            "description": "Once it ends: outcome , reason , detections , battery_end_pct , distance_flown_m and report_id . A rejected mission has outcome , reason and failed_checks instead."
          },
          "report_id": {
            "type": [
              "string",
              "null"
            ],
            "description": "Its incident report , once it ends. A rejected mission has none."
          },
          "track": {
            "type": "array",
            "description": "The path flown, as [lat, lon] pairs.",
            "items": {
              "type": "array",
              "items": {
                "type": "number"
              },
              "minItems": 2,
              "maxItems": 2
            }
          },
          "created_at": {
            "type": "string",
            "format": "date-time",
            "description": "When it was requested."
          },
          "updated_at": {
            "type": "string",
            "format": "date-time",
            "description": "When it last changed."
          },
          "started_at": {
            "type": [
              "string",
              "null"
            ],
            "format": "date-time",
            "description": "When its vehicle launched."
          },
          "ended_at": {
            "type": [
              "string",
              "null"
            ],
            "format": "date-time",
            "description": "When it ended."
          }
        },
        "required": [
          "alert_ids",
          "approval",
          "created_at",
          "detection_ids",
          "ended_at",
          "history",
          "id",
          "on_scene_s",
          "patrol_points",
          "priority",
          "progress",
          "reason",
          "report_id",
          "requested_by",
          "requested_vehicle_id",
          "result",
          "safety",
          "started_at",
          "status",
          "target",
          "track",
          "trigger",
          "type",
          "updated_at",
          "vehicle_id"
        ]
      },
      "MissionList": {
        "type": "object",
        "properties": {
          "data": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/Mission"
            }
          }
        },
        "required": [
          "data"
        ]
      },
      "Status": {
        "type": "object",
        "properties": {
          "site": {
            "type": "object",
            "properties": {
              "name": {
                "type": "string"
              },
              "center": {
                "type": "object",
                "properties": {
                  "lat": {
                    "type": "number"
                  },
                  "lon": {
                    "type": "number"
                  }
                },
                "required": [
                  "lat",
                  "lon"
                ]
              },
              "operating_area_id": {
                "type": "string"
              }
            },
            "required": [
              "center",
              "name",
              "operating_area_id"
            ]
          },
          "time": {
            "type": "string",
            "format": "date-time"
          },
          "version": {
            "type": "string"
          },
          "instance_id": {
            "type": "string"
          },
          "dev_mode": {
            "type": "boolean"
          },
          "sim_speed": {
            "type": "number"
          },
          "counts": {
            "type": "object",
            "properties": {
              "alerts_open": {
                "type": "integer"
              },
              "alerts_responding": {
                "type": "integer"
              },
              "missions_active": {
                "type": "integer"
              },
              "missions_pending_approval": {
                "type": "integer"
              },
              "sensors_online": {
                "type": "integer"
              },
              "sensors_silent": {
                "type": "integer"
              },
              "sensors_pending": {
                "type": "integer"
              },
              "vehicles_ready": {
                "type": "integer"
              },
              "vehicles_flying": {
                "type": "integer"
              }
            },
            "required": [
              "alerts_open",
              "alerts_responding",
              "missions_active",
              "missions_pending_approval",
              "sensors_online",
              "sensors_pending",
              "sensors_silent",
              "vehicles_flying",
              "vehicles_ready"
            ]
          },
          "vehicles": {
            "type": "array",
            "items": {
              "type": "object",
              "properties": {
                "id": {
                  "type": "string"
                },
                "name": {
                  "type": "string"
                },
                "status": {
                  "type": "string"
                },
                "battery_pct": {
                  "type": "number"
                },
                "ready": {
                  "type": "boolean"
                },
                "mission_id": {
                  "type": [
                    "string",
                    "null"
                  ]
                },
                "fault": {
                  "type": "null"
                }
              },
              "required": [
                "battery_pct",
                "fault",
                "id",
                "mission_id",
                "name",
                "ready",
                "status"
              ]
            }
          },
          "active_missions": {
            "type": "array",
            "items": {
              "type": "object",
              "properties": {
                "id": {
                  "type": "string"
                },
                "type": {
                  "type": "string"
                },
                "status": {
                  "type": "string"
                },
                "vehicle_id": {
                  "type": "string"
                },
                "target": {
                  "type": "object",
                  "properties": {
                    "kind": {
                      "type": "string"
                    },
                    "alert_id": {
                      "type": "string"
                    },
                    "sensor_id": {
                      "type": "string"
                    },
                    "location": {
                      "type": "object",
                      "properties": {
                        "lat": {
                          "type": "number"
                        },
                        "lon": {
                          "type": "number"
                        }
                      },
                      "required": [
                        "lat",
                        "lon"
                      ]
                    },
                    "zone_id": {
                      "type": "string"
                    },
                    "name": {
                      "type": "string"
                    }
                  },
                  "required": [
                    "alert_id",
                    "kind",
                    "location",
                    "name",
                    "sensor_id",
                    "zone_id"
                  ]
                },
                "priority": {
                  "type": "string"
                },
                "progress": {
                  "type": "object",
                  "properties": {
                    "phase": {
                      "type": "string"
                    },
                    "distance_to_target_m": {
                      "type": "integer"
                    },
                    "eta_s": {
                      "type": "integer"
                    },
                    "battery_pct": {
                      "type": "number"
                    },
                    "distance_flown_m": {
                      "type": "integer"
                    },
                    "detections": {
                      "type": "integer"
                    }
                  },
                  "required": [
                    "battery_pct",
                    "detections",
                    "distance_flown_m",
                    "distance_to_target_m",
                    "eta_s",
                    "phase"
                  ]
                }
              },
              "required": [
                "id",
                "priority",
                "progress",
                "status",
                "target",
                "type",
                "vehicle_id"
              ]
            }
          },
          "open_alerts": {
            "type": "array",
            "items": {
              "type": "object",
              "properties": {
                "id": {
                  "type": "string"
                },
                "source": {
                  "type": "string"
                },
                "type": {
                  "type": "string"
                },
                "priority": {
                  "type": "string"
                },
                "zone_id": {
                  "type": "string"
                },
                "status": {
                  "type": "string"
                },
                "mission_id": {
                  "type": [
                    "string",
                    "null"
                  ]
                },
                "created_at": {
                  "type": "string",
                  "format": "date-time"
                }
              },
              "required": [
                "created_at",
                "id",
                "mission_id",
                "priority",
                "source",
                "status",
                "type",
                "zone_id"
              ]
            }
          },
          "silent_sensors": {
            "type": "array",
            "items": {}
          }
        },
        "required": [
          "active_missions",
          "counts",
          "dev_mode",
          "instance_id",
          "open_alerts",
          "silent_sensors",
          "sim_speed",
          "site",
          "time",
          "vehicles",
          "version"
        ]
      },
      "Health": {
        "type": "object",
        "properties": {
          "status": {
            "type": "string"
          },
          "version": {
            "type": "string"
          },
          "time": {
            "type": "string",
            "format": "date-time"
          },
          "dev_mode": {
            "type": "boolean"
          },
          "instance_id": {
            "type": "string"
          }
        },
        "required": [
          "dev_mode",
          "instance_id",
          "status",
          "time",
          "version"
        ]
      },
      "VehicleList": {
        "type": "object",
        "properties": {
          "data": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/Vehicle"
            }
          }
        },
        "required": [
          "data"
        ]
      },
      "Vehicle": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string",
            "description": "The vehicle's id, like drone-1 ."
          },
          "name": {
            "type": "string",
            "description": "A name people read."
          },
          "type": {
            "type": "string",
            "description": "quadcopter , or another kind of vehicle."
          },
          "model": {
            "type": "string",
            "description": "The model."
          },
          "adapter": {
            "type": "string",
            "description": "How Ochio talks to it. sim in the sandbox."
          },
          "capabilities": {
            "type": "array",
            "items": {
              "type": "string"
            },
            "description": "What it carries, like camera and depth . Missions need a camera ."
          },
          "home": {
            "type": "object",
            "properties": {
              "lat": {
                "type": "number"
              },
              "lon": {
                "type": "number"
              }
            },
            "required": [
              "lat",
              "lon"
            ],
            "description": "Its dock: {\"lat\", \"lon\"} ."
          },
          "position": {
            "type": "object",
            "properties": {
              "lat": {
                "type": "number"
              },
              "lon": {
                "type": "number"
              },
              "alt_m": {
                "type": "number"
              }
            },
            "required": [
              "alt_m",
              "lat",
              "lon"
            ],
            "description": "Where it is now: lat , lon and alt_m above home."
          },
          "heading_deg": {
            "type": "number",
            "description": "The way it's pointing, 0 to 360 degrees from north."
          },
          "ground_speed_mps": {
            "type": "number",
            "description": "Its speed over the ground now."
          },
          "speed_mps": {
            "type": "number",
            "description": "Its cruise speed."
          },
          "range_m": {
            "type": "number",
            "description": "The longest round trip it can fly."
          },
          "battery_pct": {
            "type": "number",
            "description": "Its battery level."
          },
          "status": {
            "type": "string",
            "description": "docked , en_route , on_scene , returning or fault .",
            "enum": [
              "docked",
              "en_route",
              "on_scene",
              "returning",
              "fault"
            ]
          },
          "ready": {
            "type": "boolean",
            "description": "true when it can take a mission now: docked, no fault, battery at or above the minimum."
          },
          "charging": {
            "type": "boolean",
            "description": "true while it charges on its dock."
          },
          "mission_id": {
            "type": [
              "string",
              "null"
            ],
            "description": "The mission it's flying."
          },
          "fault": {
            "type": "null",
            "description": "A fault it reported, in words."
          },
          "created_at": {
            "type": "string",
            "format": "date-time",
            "description": "When it was added."
          },
          "updated_at": {
            "type": "string",
            "format": "date-time",
            "description": "When it last changed status."
          }
        },
        "required": [
          "adapter",
          "battery_pct",
          "capabilities",
          "charging",
          "created_at",
          "fault",
          "ground_speed_mps",
          "heading_deg",
          "home",
          "id",
          "mission_id",
          "model",
          "name",
          "position",
          "range_m",
          "ready",
          "speed_mps",
          "status",
          "type",
          "updated_at"
        ]
      },
      "ZoneList": {
        "type": "object",
        "properties": {
          "data": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/Zone"
            }
          }
        },
        "required": [
          "data"
        ]
      },
      "RuleList": {
        "type": "object",
        "properties": {
          "data": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/Rule"
            }
          },
          "first_match_wins": {
            "type": "boolean"
          }
        },
        "required": [
          "data",
          "first_match_wins"
        ]
      },
      "DetectionList": {
        "type": "object",
        "properties": {
          "data": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/Detection"
            }
          }
        },
        "required": [
          "data"
        ]
      },
      "ReportList": {
        "type": "object",
        "properties": {
          "data": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/ReportBrief"
            }
          }
        },
        "required": [
          "data"
        ]
      },
      "Report": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string"
          },
          "mission_id": {
            "type": "string"
          },
          "title": {
            "type": "string"
          },
          "outcome": {
            "type": "object",
            "properties": {
              "status": {
                "type": "string"
              },
              "reason": {
                "type": "string"
              }
            },
            "required": [
              "reason",
              "status"
            ]
          },
          "summary": {
            "type": "string"
          },
          "trigger": {
            "type": "object",
            "properties": {
              "kind": {
                "type": "string"
              },
              "text": {
                "type": "string"
              },
              "rule_id": {
                "type": "string"
              },
              "sensor_id": {
                "type": "string"
              },
              "alert_ids": {
                "type": "array",
                "items": {
                  "type": "string"
                }
              },
              "requested_by": {
                "type": "string"
              },
              "time": {
                "type": "string",
                "format": "date-time"
              }
            },
            "required": [
              "alert_ids",
              "kind",
              "requested_by",
              "rule_id",
              "sensor_id",
              "text",
              "time"
            ]
          },
          "timeline": {
            "type": "array",
            "items": {
              "type": "object",
              "properties": {
                "time": {
                  "type": "string",
                  "format": "date-time"
                },
                "text": {
                  "type": "string"
                }
              },
              "required": [
                "text",
                "time"
              ]
            }
          },
          "detections": {
            "type": "array",
            "items": {
              "type": "object",
              "properties": {
                "id": {
                  "type": "string"
                },
                "class": {
                  "type": "string"
                },
                "confidence": {
                  "type": "number"
                },
                "location": {
                  "type": "object",
                  "properties": {
                    "lat": {
                      "type": "number"
                    },
                    "lon": {
                      "type": "number"
                    }
                  },
                  "required": [
                    "lat",
                    "lon"
                  ]
                },
                "zone_id": {
                  "type": "string"
                },
                "source": {
                  "type": "string"
                },
                "mission_id": {
                  "type": "string"
                },
                "vehicle_id": {
                  "type": "string"
                },
                "expired": {
                  "type": "boolean"
                },
                "expires_at": {
                  "type": "string",
                  "format": "date-time"
                },
                "created_at": {
                  "type": "string",
                  "format": "date-time"
                }
              },
              "required": [
                "class",
                "confidence",
                "created_at",
                "expired",
                "expires_at",
                "id",
                "location",
                "mission_id",
                "source",
                "vehicle_id",
                "zone_id"
              ]
            }
          },
          "vehicle": {
            "type": "object",
            "properties": {
              "id": {
                "type": "string"
              },
              "name": {
                "type": "string"
              },
              "battery_start_pct": {
                "type": "number"
              },
              "battery_end_pct": {
                "type": "number"
              },
              "distance_flown_m": {
                "type": "integer"
              },
              "flight_time_s": {
                "type": "integer"
              }
            },
            "required": [
              "battery_end_pct",
              "battery_start_pct",
              "distance_flown_m",
              "flight_time_s",
              "id",
              "name"
            ]
          },
          "recommendations": {
            "type": "array",
            "items": {
              "type": "string"
            }
          },
          "target": {
            "type": "object",
            "properties": {
              "kind": {
                "type": "string"
              },
              "alert_id": {
                "type": "string"
              },
              "sensor_id": {
                "type": "string"
              },
              "location": {
                "type": "object",
                "properties": {
                  "lat": {
                    "type": "number"
                  },
                  "lon": {
                    "type": "number"
                  }
                },
                "required": [
                  "lat",
                  "lon"
                ]
              },
              "zone_id": {
                "type": "string"
              },
              "name": {
                "type": "string"
              }
            },
            "required": [
              "alert_id",
              "kind",
              "location",
              "name",
              "sensor_id",
              "zone_id"
            ]
          },
          "created_at": {
            "type": "string",
            "format": "date-time"
          }
        },
        "required": [
          "created_at",
          "detections",
          "id",
          "mission_id",
          "outcome",
          "recommendations",
          "summary",
          "target",
          "timeline",
          "title",
          "trigger",
          "vehicle"
        ]
      },
      "EventPage": {
        "type": "object",
        "properties": {
          "data": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/Event"
            }
          },
          "next_after": {
            "type": "integer"
          },
          "has_more": {
            "type": "boolean"
          }
        },
        "required": [
          "data",
          "has_more",
          "next_after"
        ]
      },
      "WebhookWithSecret": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string"
          },
          "url": {
            "type": "string"
          },
          "event_types": {
            "type": "array",
            "items": {
              "type": "string"
            }
          },
          "description": {
            "type": "string"
          },
          "enabled": {
            "type": "boolean"
          },
          "owner": {
            "type": "string"
          },
          "stats": {
            "type": "object",
            "properties": {
              "delivered": {
                "type": "integer"
              },
              "failed_attempts": {
                "type": "integer"
              },
              "gave_up": {
                "type": "integer"
              },
              "last_status": {
                "type": "null"
              },
              "last_attempt_at": {
                "type": "null"
              }
            },
            "required": [
              "delivered",
              "failed_attempts",
              "gave_up",
              "last_attempt_at",
              "last_status"
            ]
          },
          "created_at": {
            "type": "string",
            "format": "date-time"
          },
          "updated_at": {
            "type": "string",
            "format": "date-time"
          },
          "secret": {
            "type": "string"
          }
        },
        "required": [
          "created_at",
          "description",
          "enabled",
          "event_types",
          "id",
          "owner",
          "secret",
          "stats",
          "updated_at",
          "url"
        ]
      },
      "WebhookList": {
        "type": "object",
        "properties": {
          "data": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/Webhook"
            }
          }
        },
        "required": [
          "data"
        ]
      },
      "Webhook": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string"
          },
          "url": {
            "type": "string"
          },
          "event_types": {
            "type": "array",
            "items": {
              "type": "string"
            }
          },
          "description": {
            "type": "string"
          },
          "enabled": {
            "type": "boolean"
          },
          "owner": {
            "type": "string"
          },
          "stats": {
            "type": "object",
            "properties": {
              "delivered": {
                "type": "integer"
              },
              "failed_attempts": {
                "type": "integer"
              },
              "gave_up": {
                "type": "integer"
              },
              "last_status": {
                "type": "integer"
              },
              "last_attempt_at": {
                "type": "string",
                "format": "date-time"
              }
            },
            "required": [
              "delivered",
              "failed_attempts",
              "gave_up",
              "last_attempt_at",
              "last_status"
            ]
          },
          "created_at": {
            "type": "string",
            "format": "date-time"
          },
          "updated_at": {
            "type": "string",
            "format": "date-time"
          }
        },
        "required": [
          "created_at",
          "description",
          "enabled",
          "event_types",
          "id",
          "owner",
          "stats",
          "updated_at",
          "url"
        ]
      },
      "DeliveryList": {
        "type": "object",
        "properties": {
          "data": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/Delivery"
            }
          },
          "pending": {
            "type": "array",
            "items": {}
          }
        },
        "required": [
          "data",
          "pending"
        ]
      },
      "WebhookTest": {
        "type": "object",
        "properties": {
          "queued": {
            "type": "boolean"
          },
          "event": {
            "type": "object",
            "properties": {
              "id": {
                "type": "string"
              },
              "seq": {
                "type": "integer"
              },
              "type": {
                "type": "string"
              },
              "time": {
                "type": "string",
                "format": "date-time"
              },
              "actor": {
                "type": "string"
              },
              "subject": {
                "type": "string"
              },
              "data": {
                "type": "object",
                "properties": {
                  "webhook_id": {
                    "type": "string"
                  },
                  "message": {
                    "type": "string"
                  }
                },
                "required": [
                  "message",
                  "webhook_id"
                ]
              }
            },
            "required": [
              "actor",
              "data",
              "id",
              "seq",
              "subject",
              "time",
              "type"
            ]
          }
        },
        "required": [
          "event",
          "queued"
        ]
      },
      "KeyList": {
        "type": "object",
        "properties": {
          "data": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/ApiKey"
            }
          }
        },
        "required": [
          "data"
        ]
      },
      "KeyWithSecret": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string"
          },
          "name": {
            "type": "string"
          },
          "prefix": {
            "type": "string"
          },
          "scopes": {
            "type": "array",
            "items": {
              "type": "string"
            }
          },
          "created_at": {
            "type": "string",
            "format": "date-time"
          },
          "last_used_at": {
            "type": "null"
          },
          "key": {
            "type": "string"
          }
        },
        "required": [
          "created_at",
          "id",
          "key",
          "last_used_at",
          "name",
          "prefix",
          "scopes"
        ]
      },
      "KeyDeleted": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string"
          },
          "name": {
            "type": "string"
          },
          "deleted": {
            "type": "boolean"
          }
        },
        "required": [
          "deleted",
          "id",
          "name"
        ]
      },
      "Zone": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string"
          },
          "name": {
            "type": "string"
          },
          "kind": {
            "type": "string"
          },
          "polygon": {
            "type": "array",
            "items": {
              "type": "object",
              "properties": {
                "lat": {
                  "type": "number"
                },
                "lon": {
                  "type": "number"
                }
              },
              "required": [
                "lat",
                "lon"
              ]
            }
          },
          "center": {
            "type": "object",
            "properties": {
              "lat": {
                "type": "number"
              },
              "lon": {
                "type": "number"
              }
            },
            "required": [
              "lat",
              "lon"
            ]
          }
        },
        "required": [
          "center",
          "id",
          "kind",
          "name",
          "polygon"
        ]
      },
      "Rule": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string"
          },
          "name": {
            "type": "string"
          },
          "order": {
            "type": "integer"
          },
          "when": {
            "type": "string"
          },
          "zones": {
            "type": "array",
            "items": {
              "type": "string"
            }
          },
          "min_priority": {
            "type": "string"
          },
          "mission": {
            "type": "string"
          },
          "approval": {
            "type": "string"
          },
          "cooldown_s": {
            "type": "number"
          }
        },
        "required": [
          "approval",
          "cooldown_s",
          "id",
          "min_priority",
          "mission",
          "name",
          "order",
          "when",
          "zones"
        ]
      },
      "Detection": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string"
          },
          "class": {
            "type": "string"
          },
          "confidence": {
            "type": "number"
          },
          "location": {
            "type": "object",
            "properties": {
              "lat": {
                "type": "number"
              },
              "lon": {
                "type": "number"
              }
            },
            "required": [
              "lat",
              "lon"
            ]
          },
          "zone_id": {
            "type": "string"
          },
          "source": {
            "type": "string"
          },
          "mission_id": {
            "type": "string"
          },
          "vehicle_id": {
            "type": "string"
          },
          "expired": {
            "type": "boolean"
          },
          "expires_at": {
            "type": "string",
            "format": "date-time"
          },
          "created_at": {
            "type": "string",
            "format": "date-time"
          }
        },
        "required": [
          "class",
          "confidence",
          "created_at",
          "expired",
          "expires_at",
          "id",
          "location",
          "mission_id",
          "source",
          "vehicle_id",
          "zone_id"
        ]
      },
      "ReportBrief": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string"
          },
          "mission_id": {
            "type": "string"
          },
          "title": {
            "type": "string"
          },
          "outcome": {
            "type": "object",
            "properties": {
              "status": {
                "type": "string"
              },
              "reason": {
                "type": "string"
              }
            },
            "required": [
              "reason",
              "status"
            ]
          },
          "summary": {
            "type": "string"
          },
          "created_at": {
            "type": "string",
            "format": "date-time"
          }
        },
        "required": [
          "created_at",
          "id",
          "mission_id",
          "outcome",
          "summary",
          "title"
        ]
      },
      "Delivery": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string"
          },
          "webhook_id": {
            "type": "string"
          },
          "event_id": {
            "type": "string"
          },
          "event_seq": {
            "type": "integer"
          },
          "event_type": {
            "type": "string"
          },
          "attempt": {
            "type": "integer"
          },
          "time": {
            "type": "string",
            "format": "date-time"
          },
          "ok": {
            "type": "boolean"
          },
          "status_code": {
            "type": "integer"
          },
          "error": {
            "type": "null"
          },
          "duration_ms": {
            "type": "integer"
          },
          "next_retry_at": {
            "type": "null"
          }
        },
        "required": [
          "attempt",
          "duration_ms",
          "error",
          "event_id",
          "event_seq",
          "event_type",
          "id",
          "next_retry_at",
          "ok",
          "status_code",
          "time",
          "webhook_id"
        ]
      },
      "ApiKey": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string"
          },
          "name": {
            "type": "string"
          },
          "prefix": {
            "type": "string"
          },
          "scopes": {
            "type": "array",
            "items": {
              "type": "string"
            }
          },
          "created_at": {
            "type": "string",
            "format": "date-time"
          },
          "last_used_at": {
            "type": "string",
            "format": "date-time"
          }
        },
        "required": [
          "created_at",
          "id",
          "last_used_at",
          "name",
          "prefix",
          "scopes"
        ]
      },
      "Event": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string"
          },
          "seq": {
            "type": "integer"
          },
          "type": {
            "type": "string"
          },
          "time": {
            "type": "string",
            "format": "date-time"
          },
          "actor": {
            "type": "string"
          },
          "subject": {
            "type": "string"
          },
          "data": {
            "type": "object",
            "properties": {
              "sensor_id": {
                "type": "string"
              },
              "name": {
                "type": "string"
              },
              "type": {
                "type": "string"
              },
              "location": {
                "type": "object",
                "properties": {
                  "lat": {
                    "type": "number"
                  },
                  "lon": {
                    "type": "number"
                  }
                },
                "required": [
                  "lat",
                  "lon"
                ]
              },
              "zone_id": {
                "type": "string"
              },
              "checkin_interval_s": {
                "type": "number"
              },
              "missed_checkins_allowed": {
                "type": "integer"
              },
              "simulated": {
                "type": "boolean"
              },
              "origin": {
                "type": "string"
              },
              "report_id": {
                "type": "string"
              },
              "mission_id": {
                "type": "string"
              },
              "outcome": {
                "type": "string"
              },
              "summary": {
                "type": "string"
              },
              "detections": {
                "type": "integer"
              },
              "url": {
                "type": "string"
              }
            }
          }
        },
        "required": [
          "actor",
          "data",
          "id",
          "seq",
          "subject",
          "time",
          "type"
        ]
      },
      "SensorCreate": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string",
            "description": "Your id for it, unique on the site: letters, digits, . , _ and - , up to 64 characters, starting with a letter or digit.",
            "pattern": "^[A-Za-z0-9][A-Za-z0-9._-]{0,63}$",
            "example": "east-gate-pir-02"
          },
          "name": {
            "type": "string",
            "description": "A name people read, up to 120 characters.",
            "maxLength": 120,
            "minLength": 1
          },
          "type": {
            "type": "string",
            "description": "What it is, in your words. Default motion .",
            "default": "motion",
            "maxLength": 64
          },
          "location": {
            "$ref": "#/components/schemas/LatLon"
          },
          "checkin_interval_s": {
            "type": "number",
            "description": "How often it will check in, 1 to 86,400 seconds. Default 10.",
            "default": 10,
            "minimum": 1,
            "maximum": 86400
          },
          "missed_checkins_allowed": {
            "type": "integer",
            "description": "Check-ins it may miss before it's silent, 1 to 100. Default 2.",
            "default": 2,
            "minimum": 1,
            "maximum": 100
          }
        },
        "required": [
          "id",
          "name",
          "location"
        ]
      },
      "Heartbeat": {
        "type": "object",
        "properties": {
          "battery_pct": {
            "type": [
              "number",
              "null"
            ],
            "description": "The sensor's battery level, 0 to 100.",
            "minimum": 0,
            "maximum": 100
          },
          "status": {
            "type": [
              "string",
              "null"
            ],
            "description": "The sensor's own health word, up to 32 characters: ok , degraded .",
            "maxLength": 32
          }
        }
      },
      "AlertCreate": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string",
            "description": "The sender's own id for this incident, up to 128 characters. With source , it identifies the alert.",
            "maxLength": 128,
            "minLength": 1
          },
          "source": {
            "type": "string",
            "description": "The id of a registered sensor . A signed request must come from this sensor.",
            "maxLength": 64,
            "minLength": 1
          },
          "type": {
            "type": "string",
            "description": "What happened, in your words, up to 64 characters: motion , door_open , person , tamper .",
            "maxLength": 64,
            "minLength": 1
          },
          "priority": {
            "type": "string",
            "description": "low , medium , high or critical . Default medium . Rules can require a minimum.",
            "enum": [
              "low",
              "medium",
              "high",
              "critical"
            ],
            "default": "medium"
          },
          "time": {
            "type": "string",
            "description": "When it happened: ISO 8601, or Unix seconds or milliseconds, between 2000 and 2100. Default: when Ochio receives it."
          },
          "location": {
            "$ref": "#/components/schemas/LatLon"
          },
          "version": {
            "type": "integer",
            "description": "Starts at 1. Send a higher number, with every field again, to update the alert.",
            "default": 1,
            "minimum": 1
          },
          "title": {
            "type": "string",
            "description": "A short headline for people, up to 200 characters.",
            "maxLength": 200
          },
          "description": {
            "type": "string",
            "description": "More detail, up to 2,000 characters.",
            "maxLength": 2000
          },
          "media_url": {
            "type": "string",
            "description": "A link to a picture or clip, up to 2,000 characters.",
            "maxLength": 2000
          },
          "data": {
            "type": "object",
            "additionalProperties": true,
            "description": "Anything else to keep with the alert, as you send it."
          }
        },
        "required": [
          "id",
          "source",
          "type"
        ]
      },
      "Note": {
        "type": "object",
        "properties": {
          "note": {
            "type": "string",
            "description": "A short note kept with the decision, up to 500 characters.",
            "maxLength": 500
          }
        }
      },
      "MissionCreate": {
        "type": "object",
        "properties": {
          "type": {
            "type": "string",
            "description": "inspect or patrol .",
            "enum": [
              "inspect",
              "patrol"
            ]
          },
          "target": {
            "type": "object",
            "properties": {
              "location": {
                "$ref": "#/components/schemas/LatLon"
              },
              "sensor_id": {
                "type": "string",
                "description": "A registered sensor."
              },
              "zone_id": {
                "type": "string",
                "description": "A zone. Required for a patrol."
              },
              "alert_id": {
                "type": "string",
                "description": "An alert. The mission takes it."
              }
            },
            "description": "Exactly one of these:"
          },
          "approval": {
            "type": "string",
            "description": "auto launches when the gate and the key allow it; ask waits for a person. Default auto .",
            "enum": [
              "auto",
              "ask"
            ],
            "default": "auto"
          },
          "priority": {
            "type": "string",
            "description": "low , medium , high or critical . Default medium .",
            "enum": [
              "low",
              "medium",
              "high",
              "critical"
            ],
            "default": "medium"
          },
          "reason": {
            "type": "string",
            "description": "Why, in words, up to 500 characters. People see it in Mission Control and in the report.",
            "maxLength": 500
          },
          "vehicle_id": {
            "type": "string",
            "description": "A vehicle to use. Leave it out to let Ochio pick."
          },
          "on_scene_s": {
            "type": "number",
            "description": "For inspect : seconds over the target, 1 to 600. Default: the site's setting (15).",
            "minimum": 1,
            "maximum": 600
          }
        },
        "required": [
          "type",
          "target"
        ]
      },
      "WebhookCreate": {
        "type": "object",
        "properties": {
          "url": {
            "type": "string",
            "description": "Where to send deliveries: http:// or https:// , up to 2,000 characters. Use HTTPS outside a closed network.",
            "maxLength": 2000,
            "minLength": 8
          },
          "event_types": {
            "type": "array",
            "items": {
              "type": "string"
            },
            "description": "Exact types, prefixes like mission.* , or * . Default [\"*\"] ."
          },
          "description": {
            "type": "string",
            "description": "A note, up to 200 characters.",
            "maxLength": 200
          },
          "enabled": {
            "type": "boolean",
            "description": "Default true .",
            "default": true
          }
        },
        "required": [
          "url"
        ]
      },
      "KeyCreate": {
        "type": "object",
        "properties": {
          "name": {
            "type": "string",
            "description": "A name, unique among keys: letters, digits, . , _ and - , up to 64 characters.",
            "pattern": "^[A-Za-z0-9][A-Za-z0-9._-]{0,63}$"
          },
          "scopes": {
            "type": "array",
            "items": {
              "type": "string"
            },
            "description": "One or more of read , alerts:write , sensors:write , missions:request , missions:launch , missions:approve , webhooks:write , admin ."
          }
        },
        "required": [
          "name",
          "scopes"
        ]
      },
      "DevMotion": {
        "type": "object",
        "properties": {
          "sensor_id": {
            "type": "string",
            "description": "The sensor that alerts."
          },
          "type": {
            "type": "string",
            "description": "Default motion .",
            "default": "motion"
          },
          "priority": {
            "type": "string",
            "description": "Default high .",
            "enum": [
              "low",
              "medium",
              "high",
              "critical"
            ],
            "default": "high"
          },
          "alert_id": {
            "type": "string",
            "description": "The alert's own id. Default: a new one."
          },
          "version": {
            "type": "integer",
            "description": "Default 1.",
            "default": 1,
            "minimum": 1
          },
          "intruder": {
            "type": "boolean",
            "description": "Also place a simulated person near the sensor. Default false .",
            "default": false
          }
        },
        "required": [
          "sensor_id"
        ]
      },
      "DevPower": {
        "type": "object",
        "properties": {
          "on": {
            "type": "boolean",
            "description": "false cuts the power; true restores it."
          }
        },
        "required": [
          "on"
        ]
      },
      "DevIntruder": {
        "type": "object",
        "properties": {
          "lat": {
            "type": "number",
            "description": "Latitude."
          },
          "lon": {
            "type": "number",
            "description": "Longitude."
          },
          "label": {
            "type": "string",
            "description": "Default Person ."
          }
        },
        "required": [
          "lat",
          "lon"
        ]
      },
      "DevFault": {
        "type": "object",
        "properties": {
          "message": {
            "type": "string",
            "description": "The fault, in words. Default Simulated motor fault .",
            "maxLength": 200
          }
        }
      },
      "DevSpeed": {
        "type": "object",
        "properties": {
          "speed": {
            "type": "number",
            "description": "The speed, 0.25 to 20.",
            "minimum": 0.25,
            "maximum": 20
          }
        },
        "required": [
          "speed"
        ]
      },
      "DevTamper": {
        "type": "object",
        "properties": {
          "sensor_id": {
            "type": "string",
            "description": "Default north-fence-pir-01 ."
          }
        }
      }
    }
  }
}