APIStats

Get statistics

Get aggregated statistics for completed flights visible to the authenticated API key. Regular users can only retrieve their own statistics. Admins and owners can also request a specific user's statistics or statistics for all users.

GET
/stats
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 an admin or owner API key.

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://your-instance.com/api/stats"
{
  "success": true,
  "stats": {
    "flights": 42,
    "distanceKm": 87432,
    "durationSeconds": 561600,
    "airports": 31,
    "topAirline": {
      "id": 1,
      "name": "British Airways",
      "iata": "BA",
      "icao": "BAW",
      "count": 10
    },
    "topAirport": {
      "id": 42,
      "name": "John F Kennedy International Airport",
      "icao": "KJFK",
      "iata": "JFK",
      "count": 20
    },
    "topAircraft": {
      "id": 5,
      "name": "Airbus A380-800",
      "icao": "A388",
      "count": 8
    },
    "topRoute": {
      "from": {
        "id": 42,
        "name": "John F Kennedy International Airport",
        "icao": "KJFK",
        "iata": "JFK"
      },
      "to": {
        "id": 15,
        "name": "Los Angeles International Airport",
        "icao": "KLAX",
        "iata": "LAX"
      },
      "count": 5
    }
  }
}
{
  "success": false,
  "message": "Invalid scope"
}
{
  "success": "false",
  "message": "Unauthorized"
}
{
  "success": "false",
  "message": "Forbidden"
}
{
  "success": "false",
  "message": "string"
}
Edit on GitHub

Last updated on