> 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.md).

# Edge API

The Edge API is an HTTP API that runs on the Cyclops computer. Use it to integrate Cyclops with your own ground control station (GCS): read Cyclops status and health, start and stop Cyclops, install maps, set the home position, manage vehicle and camera configurations, record flights, and download logs and recordings.

Vozilla uses this API for the same tasks, so you can compare your results with what Vozilla shows.

## Reaching the API

The v2 API listens on port `5050` of the Cyclops computer. With the default network setup, the base URL is:

```
http://192.168.218.100:5050/api/v2
```

If you changed the Cyclops IP address, use that address instead. See [Quick Start](https://docs.theseus.us/vozilla-gcs-software/vozilla-app/quick-start.md#connecting-cyclops) for the default network settings.

The API needs an IP connection to the Cyclops computer, such as Ethernet or an IP radio link. It is not available over a serial MAVLink link. For health monitoring over MAVLink, see [Monitoring VPS Health Over MAVLink](https://docs.theseus.us/vozilla-gcs-software/mavlink/monitoring-vps-health-over-mavlink.md).

{% hint style="warning" %}
Neither port has authentication. Anyone who can reach ports `5050` or `5000` can control Cyclops. Make both ports reachable only on the aircraft's own network or data link. Never expose them to the internet or to a shared network.
{% endhint %}

## Versioning

The v2 API on port `5050`, under `/api/v2`, is the main API. Use it whenever it covers your task.

Some tasks are not in v2 yet and use the legacy API on port `5000`. It has its own response format, described on each page. It may be replaced by v2 endpoints in a later release.

| Task                                         | Port   | Page                                                                                                                                                        |
| -------------------------------------------- | ------ | ----------------------------------------------------------------------------------------------------------------------------------------------------------- |
| Status and health                            | `5050` | [Status and health](https://docs.theseus.us/cyclops/developers/edge-api/status-and-health.md)                                                               |
| Start, stop, and restart Cyclops             | `5050` | [Controlling Cyclops](https://docs.theseus.us/cyclops/developers/edge-api/controlling-cyclops.md)                                                           |
| Home position spoof                          | `5000` | [Controlling Cyclops](https://docs.theseus.us/cyclops/developers/edge-api/controlling-cyclops.md#send-the-home-position-to-the-flight-controller-port-5000) |
| Home position                                | `5050` | [Home position](https://docs.theseus.us/cyclops/developers/edge-api/home-position.md)                                                                       |
| Maps                                         | `5000` | [Maps (port 5000)](https://docs.theseus.us/cyclops/developers/edge-api/maps-port-5000.md)                                                                   |
| Vehicle configuration and camera calibration | `5000` | [Vehicle and camera](https://docs.theseus.us/cyclops/developers/edge-api/vehicle-and-camera.md)                                                             |
| List and download recordings                 | `5050` | [Recordings](https://docs.theseus.us/cyclops/developers/edge-api/recordings.md)                                                                             |
| Start and stop recording                     | `5000` | [Recordings](https://docs.theseus.us/cyclops/developers/edge-api/recordings.md#start-and-stop-recording-port-5000)                                          |
| Flight logs                                  | `5050` | [Flight logs](https://docs.theseus.us/cyclops/developers/edge-api/flight-logs.md)                                                                           |
| License status                               | `5050` | [License and lockdown](https://docs.theseus.us/cyclops/developers/edge-api/license-and-lockdown.md)                                                         |
| Lockdown mode                                | `5000` | [License and lockdown](https://docs.theseus.us/cyclops/developers/edge-api/license-and-lockdown.md#lockdown-mode)                                           |

## Your first call

Check that the API is up:

```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"
  }
}
```

If this call fails, check the network connection and IP address before trying anything else.

## Requests and responses

This section describes the v2 API. Request bodies are JSON. Send them with `Content-Type: application/json`.

Every JSON response has a `success` field. On success, the result is in `data`, and some endpoints also return a `message`:

```json
{
  "success": true,
  "data": { ... },
  "message": "..."
}
```

On failure, the HTTP status code is set and the body explains the error:

```json
{
  "success": false,
  "error": "Home position not set",
  "status_code": 404
}
```

| Status | Meaning                                                                                                  |
| ------ | -------------------------------------------------------------------------------------------------------- |
| `200`  | Success                                                                                                  |
| `400`  | The request is invalid. The `error` field says why.                                                      |
| `404`  | The resource does not exist, or the path is wrong.                                                       |
| `500`  | The request failed on the device. The `error` field says why.                                            |
| `503`  | The requested information is not available yet, for example right after boot. Retry after a few seconds. |

Responses can contain fields that are not described in this guide. Those fields are for Theseus support and can change between releases, so do not depend on them.

## Reference

* [Status and health](https://docs.theseus.us/cyclops/developers/edge-api/status-and-health.md)
* [Controlling Cyclops](https://docs.theseus.us/cyclops/developers/edge-api/controlling-cyclops.md)
* [Home position](https://docs.theseus.us/cyclops/developers/edge-api/home-position.md)
* [Maps (port 5000)](https://docs.theseus.us/cyclops/developers/edge-api/maps-port-5000.md)
* [Vehicle and camera (port 5000)](https://docs.theseus.us/cyclops/developers/edge-api/vehicle-and-camera.md)
* [Recordings](https://docs.theseus.us/cyclops/developers/edge-api/recordings.md)
* [Flight logs](https://docs.theseus.us/cyclops/developers/edge-api/flight-logs.md)
* [License and lockdown](https://docs.theseus.us/cyclops/developers/edge-api/license-and-lockdown.md)
