Export
The export feature lets you download your flight data from AirTrail.
Export flights
- Open Settings > Export.
- Click .csv or .json.
The file downloads as airtrail.csv or airtrail.json. It contains every flight on which you are a passenger.
The Export page is available to users whose role includes the flight.export.own permission.
Export with the API
You can automate AirTrail backups with the v1 REST API. Create an API key with the flight.export.own scope, then call:
curl -H "Authorization: Bearer <api-key>" \
"https://your-instance.com/api/v1/flights/export?format=json" \
-o airtrail.jsonUse format=yaml to export YAML instead:
curl -H "Authorization: Bearer <api-key>" \
"https://your-instance.com/api/v1/flights/export?format=yaml" \
-o airtrail.yamlThe API export has the same structure as the JSON format below.
By default, the API exports your own flights. To export another user's flights with scope=user&userId=<user-id>, or every flight on the instance with scope=all, you need both:
- the
flight.export.anyscope on the API key, and - a role that includes the
flight.export.anypermission.
The in-app importer accepts .json files only. To restore a YAML export,
convert it to JSON first.
The deprecated /api/flight/export endpoint still works for now. See migrating from the legacy API.
Export formats
CSV
The CSV export opens in any spreadsheet application, such as Microsoft Excel or Google Sheets. It has one row per flight.
Format
The CSV file contains these columns:
date: The flight date (YYYY-MM-DD).datePrecision: How precise the date is:day,month, oryear.from,to: The names of the departure and arrival airports.departure,arrival: The actual departure and arrival times (ISO 8601, if available).departureScheduled,arrivalScheduled: The scheduled departure and arrival times.takeoffScheduled,takeoffActual,landingScheduled,landingActual: The takeoff and landing times.duration: The flight duration in seconds.departureTerminal,departureGate,arrivalTerminal,arrivalGate: Terminal and gate information.flightNumber: The flight number.airline: The airline name.aircraft: The aircraft type name.aircraftReg: The aircraft registration.note: The flight notes.seat: Your seat type (for example window or aisle).seatNumber: Your seat number.seatClass: Your seat class (for example economy or business).flightReason: Your reason for the flight.fromId,toId,airlineId,aircraftId: Internal AirTrail IDs.
The seat and reason columns come from your own passenger entry. Other passengers, custom fields, and flight tracks are not included in the CSV export.
JSON
The JSON format can be reimported into AirTrail using the import feature. Use the AirTrail importer for current exports and AirTrail (pre-v3) for legacy exports.
The JSON export is the complete AirTrail backup format. It contains every passenger on each flight, custom field values, and flight tracks.
Format
The JSON file follows this structure:
{
"users": [
{
"id": "user_id",
"displayName": "User Name",
"username": "username"
}
],
"flights": [
{
"date": "YYYY-MM-DD",
"datePrecision": "day",
"departure": "ISO_8601_DATETIME",
"arrival": "ISO_8601_DATETIME",
"departureScheduled": "ISO_8601_DATETIME",
"arrivalScheduled": "ISO_8601_DATETIME",
"takeoffScheduled": "ISO_8601_DATETIME",
"takeoffActual": "ISO_8601_DATETIME",
"landingScheduled": "ISO_8601_DATETIME",
"landingActual": "ISO_8601_DATETIME",
"duration": 25200,
"departureTerminal": "TERMINAL",
"departureGate": "GATE",
"arrivalTerminal": "TERMINAL",
"arrivalGate": "GATE",
"flightNumber": "FLIGHT_NUMBER",
"aircraftReg": "AIRCRAFT_REGISTRATION",
"note": "FLIGHT_NOTE",
"fromId": 1,
"toId": 2,
"aircraftId": 3,
"airlineId": 4,
"from": {
"icao": "ICAO_CODE",
"iata": "IATA_CODE",
"lat": 55.0,
"lon": 12.0,
"tz": "Europe/Copenhagen",
"name": "Airport Name",
"municipality": "City",
"type": "large_airport",
"continent": "EU",
"country": "DK",
"custom": false
},
"to": {
"icao": "ICAO_CODE",
"iata": "IATA_CODE",
"lat": 53.0,
"lon": -6.0,
"tz": "Europe/Dublin",
"name": "Airport Name",
"municipality": "City",
"type": "large_airport",
"continent": "EU",
"country": "IE",
"custom": false
},
"aircraft": {
"name": "Aircraft Type",
"icao": "ICAO_AIRCRAFT_TYPE",
"sourceId": "aircraft-source-id"
},
"airline": {
"name": "Airline Name",
"icao": "ICAO_AIRLINE_CODE",
"iata": "IATA_AIRLINE_CODE",
"iconPath": null,
"sourceId": "airline-source-id"
},
"passengers": [
{
"userId": "USER_ID",
"guestName": null,
"seat": "window",
"seatNumber": "12A",
"seatClass": "economy",
"flightReason": "leisure",
"user": {
"id": "USER_ID",
"displayName": "User Name",
"username": "username"
},
"customFields": {
"meal_preferences": ["Vegetarian", "Gluten-free"]
}
}
],
"track": {
"coordinates": [
[12.65, 55.62, 0],
[-6.27, 53.42, 0]
],
"times": [1767261600, 1767269400],
"sourceFormat": "gpx",
"sourceName": "flight.gpx"
},
"customFields": {
"booking_reference": "ABC123"
}
}
]
}Notes on the structure:
userslists only the users who are passengers on the exported flights.- A passenger has either a
userIdor aguestName.userisnullfor guests. trackis present only for flights with a flight track. Track coordinates are[longitude, latitude, altitude]with altitude in meters. Depending on the source file, a track can also containgroundSpeedKt,trackDeg,ground, andestimatedarrays.customFieldsis present only when the flight or passenger has custom field values. Airport, airline, and aircraft fields are expanded to full objects.- The
fromId,toId,aircraftId, andairlineIdvalues are internal IDs of the source instance and are ignored on import.
When you reimport the file, AirTrail restores tracks but not custom field values.
Last updated on
