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
AuthorizationBearer <token>

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

In: header

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

application/json

application/json

application/json

application/json

application/json

curl -X GET "https://example.com/stats"
{  "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    }  }}