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.
1. Find the aircraft
Section titled “1. Find the aircraft”The aircraft is identified by its MAVLink hardware ID, the same ID the autopilot reports. If you don’t have it, list the aircraft:
curl https://app.ayna.com/api/v1/aircraft/ \ -H "Authorization: Bearer $AYNA_TOKEN"Each aircraft’s id is its MAVLink ID.
2. Start the flight at takeoff
Section titled “2. Start the flight at takeoff”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.
3. End the flight at landing
Section titled “3. End the flight at landing”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.
If the flight didn’t happen
Section titled “If the flight didn’t happen”Cancel it instead of ending it:
curl -X POST https://app.ayna.com/api/v1/flights/{flight_id}/cancel \ -H "Authorization: Bearer $AYNA_TOKEN"Related
Section titled “Related”- Flights reference, including telemetry updates during the flight
- Missions reference, including the pre-, in- and post-flight checklists