-
Notifications
You must be signed in to change notification settings - Fork 2
HTTP API
Judah Paul edited this page Jul 10, 2026
·
9 revisions
The front end reaches the autopilot and the database through SvelteKit server
routes under /api. Every route except /api/auth/* requires a valid session
(see the authentication section of Architecture).
Commands and parameters are passed as request headers. {type} selects the
operation.
| Type | Headers | Behavior |
|---|---|---|
heartbeat |
none | Opens the link on the first call, then polls status. Returns buffered log lines as JSON, or 503 when none are available. |
send_command |
command, params (comma-separated), useArduPilotMega, useCmdLong
|
Sends a MAVLink command. 400 when command is missing. |
clear_mission |
none | Clears all mission items on the autopilot. |
load_mission |
actions (JSON map of index to mission item) |
Uploads the mission, pacing items by 250 ms. 400 when actions is missing. |
set_position_local |
x, y, z
|
Commands a local-frame position (ArduPilot). 400 on non-numeric input. |
request_params |
none | Requests the full parameter set from the autopilot. |
write_param |
id, value, type
|
Writes one parameter. id is null-padded to 16 characters per the MAVLink parameter protocol. 400 on non-numeric value or type. |
Errors return 500 with the error stack in the body.
Saved missions live in the SQLite mission table. Parameters are passed as
headers.
| Type | Headers | Behavior |
|---|---|---|
save |
title, actions
|
Inserts a mission row. |
load |
title |
Marks the mission loaded. |
unload |
none | Clears the loaded flag on every mission. |
checkExists |
title |
Returns matching rows, or {} when none. |
update |
title, actions
|
Replaces a mission's waypoints. |
list |
none | Returns all missions. |
delete |
title |
Deletes a mission. |
Returns airspace zones for a bounding box, used by the map overlay and the pre-flight safety checks.
- Query:
bbox=minLon,minLat,maxLon,maxLat. - Response:
{ "zones": AirspaceZone[], "configured": boolean }. - Each
AirspaceZoneis{ name, restricted, polygon }, wherepolygonis GeoJSON-style ring coordinates andrestrictedmarks prohibited, restricted, danger, no-fly, TRA, or TSA areas.
The route reads OPENAIP_API_KEY on the server and queries
OpenAIP. With no key, no bounding box, or an upstream
failure it returns an empty zones list so planning still works. See
Configuration.
| Action | Body / state | Behavior |
|---|---|---|
login |
username, password
|
Verifies the account, creates a session, sets the session cookie. 400 on bad credentials. |
register |
username, password
|
Creates the first account and a session. Returns 403 once any account exists. |
logout |
session cookie | Invalidates the session. |
checkAdmin |
none | Reports whether an account exists yet. |