APIStats

Get statistics

Deprecated

GET
/stats

Deprecated: This endpoint will be removed in the next major AirTrail release. Migrate to GET /api/v1/stats. Get aggregated statistics for completed flights visible to the authenticated API key. scope=mine requires flight.read.own. scope=user and scope=all require flight.read.any.

Authorization

bearerAuth
headerAuthorizationBearer <token>

Go to Settings -> Security and create a new API key. Use the generated key as the bearer token.

Query Parameters

scope?string

Which flights to aggregate. mine is the default. user and all require flight.read.any.

Default"mine"
Value in"mine""user""all"
userId?string

The user ID whose statistics should be returned when scope=user.

Response Body

Aggregated statistics

application/json
  1. response
success?boolean
stats?
Example Request
curl -X GET 'https://your-instance.com/api/stats'
Example Response
{  "success": true,  "stats": {    "flights": 0,    "distanceKm": 0,    "durationSeconds": 0,    "airports": 0,    "topAirline": {      "id": 0,      "name": "string",      "iata": "string",      "icao": "string",      "count": 0    },    "topAirport": {      "id": 0,      "name": "string",      "icao": "string",      "iata": "string",      "count": 0    },    "topAircraft": {      "id": 0,      "name": "string",      "icao": "string",      "count": 0    },    "topRoute": {      "from": {        "id": 0,        "name": "string",        "icao": "string",        "iata": "string"      },      "to": {        "id": 0,        "name": "string",        "icao": "string",        "iata": "string"      },      "count": 0    }  }}