Skip to content

Log a flight

A ground station or logging app records a flight in two calls: one at takeoff, one at landing. The flight appears in AYNA on the aircraft, the pilot and, if you give one, the mission.

You need a token for your organization. A pilot-paired app is the usual choice, so the flight is recorded under that pilot.

The aircraft is identified by its MAVLink hardware ID, the same ID the autopilot reports. If you don’t have it, list the aircraft:

Terminal window
curl https://app.ayna.com/api/v1/aircraft/ \
-H "Authorization: Bearer $AYNA_TOKEN"

Each aircraft’s id is its MAVLink ID.

Terminal window
curl -X POST https://app.ayna.com/api/v1/flights/start \
-H "Authorization: Bearer $AYNA_TOKEN" \
-H "Content-Type: application/json" \
-d '{
"aircraft_id": "3E0026000B51383236363639",
"pilot_id": "5b0d2c9e-8f3a-4b1e-9d7c-2a6f0e1b3c4d",
"mission_id": "9e8d7c6b-5a4f-4e3d-8c2b-1a0f9e8d7c6b",
"takeoff_latitude": 30.2672,
"takeoff_longitude": -97.7431,
"takeoff_altitude_msl_meters": 149.0,
"flight_type": "commercial",
"purpose": "Roof inspection",
"checklist_completed": true
}'

Only takeoff_latitude and takeoff_longitude are required, plus the aircraft. pilot_id and mission_id are optional. The response is 201 with the new flight; keep its id.

If the aircraft already has a flight in progress, that flight is marked aborted and the response includes it as superseded_flight, so a missed landing never leaves two open flights.

Terminal window
curl -X POST https://app.ayna.com/api/v1/flights/{flight_id}/end \
-H "Authorization: Bearer $AYNA_TOKEN" \
-H "Content-Type: application/json" \
-d '{
"landing_latitude": 30.2675,
"landing_longitude": -97.7429,
"max_altitude_msl_meters": 210.5,
"max_speed_mps": 12.4,
"distance_traveled_meters": 1830,
"incidents": null
}'

end_time defaults to now. Send it if you are uploading a flight after the fact.

Cancel it instead of ending it:

Terminal window
curl -X POST https://app.ayna.com/api/v1/flights/{flight_id}/cancel \
-H "Authorization: Bearer $AYNA_TOKEN"