> For the complete documentation index, see [llms.txt](https://docs.theseus.us/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.theseus.us/cyclops/developers/edge-api/status-and-health.md).

# Status and health

Use these endpoints to show whether Cyclops is up and healthy in your GCS.

| Method | Path                   | Purpose                                 |
| ------ | ---------------------- | --------------------------------------- |
| `GET`  | `/api/v2/ping`         | Check that the API is responding        |
| `GET`  | `/api/v2/system/build` | Read the Cyclops software version       |
| `GET`  | `/api/v2/state`        | Read Cyclops health and computer status |

## Check that the API is responding

`GET /api/v2/ping`

Returns as soon as the API is running. It does not check the rest of the system. Use it as a connection check.

```bash
curl http://192.168.218.100:5050/api/v2/ping
```

```json
{
  "success": true,
  "data": {
    "status": "ok",
    "service": "theseus-edge-api",
    "version": "2.1.1"
  }
}
```

`version` is the version of the Edge API, not of Cyclops. Use `/api/v2/system/build` for the Cyclops version.

## Read the software version

`GET /api/v2/system/build`

```bash
curl http://192.168.218.100:5050/api/v2/system/build
```

```json
{
  "success": true,
  "data": {
    "variant": "cyclops",
    "firmware_version": "1.4.0"
  }
}
```

| Field              | Description                                                      |
| ------------------ | ---------------------------------------------------------------- |
| `variant`          | Installed product. `cyclops` on a Cyclops computer.              |
| `firmware_version` | Installed Cyclops software version. `null` if it cannot be read. |

## Read Cyclops health

`GET /api/v2/state`

Returns a snapshot of Cyclops health, the flight controller connection, and the computer itself. The device updates the snapshot in the background every few seconds, so this call is cheap. Polling it every 1 to 5 seconds is fine.

```bash
curl http://192.168.218.100:5050/api/v2/state
```

The response is large. This example shows only the fields described below:

```json
{
  "success": true,
  "data": {
    "vps_error": {
      "code": 0,
      "message": "System healthy"
    },
    "mavlink": {
      "heartbeat_active": true,
      "armed": false,
      "health_status": "healthy"
    },
    "hardware": {
      "uptime_ms": 734512,
      "cpu_percent": 41.5,
      "cpu_temp_c": 58.2,
      "memory_percent": 37.9,
      "disk_usage_percent": 22.4,
      "camera": {
        "connected": true,
        "health_status": "healthy"
      }
    }
  }
}
```

### `vps_error`

The main health indicator. `code` is the same value Cyclops sends over MAVLink as `VPS_ERR`, and `message` is a short description.

* `0` means Cyclops is healthy.
* `1` to `5` are normal during startup and clear on their own.
* Any other value needs attention.

The full list of codes is in [Monitoring VPS Health Over MAVLink](https://docs.theseus.us/vozilla-gcs-software/mavlink/monitoring-vps-health-over-mavlink.md).

### `mavlink`

Connection between the Cyclops computer and the flight controller.

| Field              | Description                                                                    |
| ------------------ | ------------------------------------------------------------------------------ |
| `heartbeat_active` | `true` while heartbeats from the flight controller are arriving.               |
| `armed`            | `true` when the flight controller reports that it is armed. `null` if unknown. |
| `health_status`    | `healthy`, `no_heartbeat`, `no_connection`, or `unavailable`.                  |

### `hardware`

Status of the Cyclops computer.

| Field                  | Description                                                                                                                                      |
| ---------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------ |
| `uptime_ms`            | Time since boot, in milliseconds.                                                                                                                |
| `cpu_percent`          | CPU usage, in percent.                                                                                                                           |
| `cpu_temp_c`           | CPU temperature, in degrees Celsius. `null` if not available.                                                                                    |
| `memory_percent`       | Memory usage, in percent.                                                                                                                        |
| `disk_usage_percent`   | Storage usage, in percent. `null` if not available.                                                                                              |
| `camera.connected`     | `true` while the camera is streaming.                                                                                                            |
| `camera.health_status` | `healthy`, `disconnected`, `config_mismatch`, or `unknown`. `config_mismatch` means the camera resolution does not match the camera calibration. |

### Errors

| Status | Cause                                                                            |
| ------ | -------------------------------------------------------------------------------- |
| `503`  | The status is not available yet, usually in the first seconds after boot. Retry. |
