{
  "openapi": "3.1.1",
  "info": {
    "title": "OnAir Public API",
    "description": "Read the live data of your OnAir companies and virtual airlines, and act on some of them.\n\n**Host.** `https://server1.onair.company`\n\n**API key.** Send your company API key in the `oa-apikey` header (or as an `oa-apikey` query parameter). It is in the game client, *Preferences > Debug & connectivity > Company API Key*. The key of a virtual airline can be read from the Manager role. An active subscription is required.\n\n**Responses.** Every response is JSON shaped as `{ \"Content\": ..., \"Error\": \"...\" }`. An error comes back with HTTP 200 and `Error` set: check `Error` before reading `Content`. Fields without a value are left out. Send `Accept-Encoding: gzip` to receive them compressed, several times smaller.\n\n**Quota.** Each call costs its server time in compute units (1 CU = 1 ms, at most 5000 CU per call). **A call that does not send `Accept-Encoding: gzip` costs twice as much**, cap included: an uncompressed response weighs several times more on the network. A key earns 1 CU per second and holds at most 15000 CU. Every response gives `X-OnAir-CU-Cost` and `X-OnAir-CU-Remaining`, plus `X-OnAir-CU-Uncompressed: x2` when the cost was doubled; while the balance is 0 or below, calls are refused with HTTP 429 and a `Retry-After` header.",
    "version": "v1"
  },
  "servers": [
    {
      "url": "https://server1.onair.company"
    }
  ],
  "paths": {
    "/api/v1/companies/{companyId}": {
      "get": {
        "tags": [
          "Companies"
        ],
        "summary": "Details of a company.",
        "parameters": [
          {
            "name": "companyId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "OK"
          }
        }
      }
    },
    "/api/v1/companies/{companyId}/balance_sheet": {
      "get": {
        "tags": [
          "Companies"
        ],
        "summary": "Balance sheet of a company.",
        "parameters": [
          {
            "name": "companyId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "OK"
          }
        }
      }
    },
    "/api/v1/companies/{companyId}/cash_flow": {
      "get": {
        "tags": [
          "Companies"
        ],
        "summary": "Cash flow (account entries) of a company.",
        "parameters": [
          {
            "name": "companyId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "OK"
          }
        }
      }
    },
    "/api/v1/companies/{companyId}/dashboard": {
      "get": {
        "tags": [
          "Companies"
        ],
        "summary": "Dashboard figures of a company.",
        "parameters": [
          {
            "name": "companyId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "OK"
          }
        }
      }
    },
    "/api/v1/companies/{companyId}/employees": {
      "get": {
        "tags": [
          "Companies"
        ],
        "summary": "Employees of a company.",
        "parameters": [
          {
            "name": "companyId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "OK"
          }
        }
      }
    },
    "/api/v1/companies/{companyId}/fbos": {
      "get": {
        "tags": [
          "Companies"
        ],
        "summary": "FBOs (airport bases) of a company.",
        "parameters": [
          {
            "name": "companyId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "OK"
          }
        }
      }
    },
    "/api/v1/companies/{companyId}/fleet": {
      "get": {
        "tags": [
          "Companies"
        ],
        "summary": "Aircraft of a company, owned and leased.",
        "parameters": [
          {
            "name": "companyId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "OK"
          }
        }
      }
    },
    "/api/v1/companies/{companyId}/flights": {
      "get": {
        "tags": [
          "Companies"
        ],
        "summary": "Flights of a company, most recent first.",
        "parameters": [
          {
            "name": "companyId",
            "in": "path",
            "description": "Id of the company.",
            "required": true,
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          },
          {
            "name": "startIndex",
            "in": "query",
            "description": "Index of the first flight to return (paging).",
            "schema": {
              "pattern": "^-?(?:0|[1-9]\\d*)$",
              "type": [
                "integer",
                "string"
              ],
              "format": "int32",
              "default": 0
            }
          },
          {
            "name": "limit",
            "in": "query",
            "description": "Maximum number of flights to return (default 50).",
            "schema": {
              "pattern": "^-?(?:0|[1-9]\\d*)$",
              "type": [
                "integer",
                "string"
              ],
              "format": "int32",
              "default": 50
            }
          }
        ],
        "responses": {
          "200": {
            "description": "OK"
          }
        }
      }
    },
    "/api/v1/companies/{companyId}/income_statement": {
      "get": {
        "tags": [
          "Companies"
        ],
        "summary": "Income statement of a company over a period.",
        "parameters": [
          {
            "name": "companyId",
            "in": "path",
            "description": "Id of the company.",
            "required": true,
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          },
          {
            "name": "startDate",
            "in": "query",
            "description": "Start of the period (UTC).",
            "schema": {
              "type": "string",
              "format": "date-time"
            }
          },
          {
            "name": "endDate",
            "in": "query",
            "description": "End of the period (UTC).",
            "schema": {
              "type": "string",
              "format": "date-time"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "OK"
          }
        }
      }
    },
    "/api/v1/companies/{companyId}/jobs/completed": {
      "get": {
        "tags": [
          "Companies"
        ],
        "summary": "Jobs completed by a company.",
        "parameters": [
          {
            "name": "companyId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "OK"
          }
        }
      }
    },
    "/api/v1/companies/{companyId}/jobs/pending": {
      "get": {
        "tags": [
          "Companies"
        ],
        "summary": "Jobs accepted by a company and not completed yet.",
        "parameters": [
          {
            "name": "companyId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "OK"
          }
        }
      }
    },
    "/api/v1/companies/{companyId}/mission_flight_tracks": {
      "get": {
        "tags": [
          "Companies"
        ],
        "summary": "Flight tracks of the jobs in progress of a company.",
        "parameters": [
          {
            "name": "companyId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "OK"
          }
        }
      }
    },
    "/api/v1/companies/{companyId}/notifications": {
      "get": {
        "tags": [
          "Companies"
        ],
        "summary": "Notifications (event log) of a company, most recent first.",
        "parameters": [
          {
            "name": "companyId",
            "in": "path",
            "description": "Id of the company.",
            "required": true,
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          },
          {
            "name": "startIndex",
            "in": "query",
            "description": "Index of the first notification to return (paging).",
            "schema": {
              "pattern": "^-?(?:0|[1-9]\\d*)$",
              "type": [
                "integer",
                "string"
              ],
              "format": "int32",
              "default": 0
            }
          },
          {
            "name": "limit",
            "in": "query",
            "description": "Maximum number of notifications to return (default 100).",
            "schema": {
              "pattern": "^-?(?:0|[1-9]\\d*)$",
              "type": [
                "integer",
                "string"
              ],
              "format": "int32",
              "default": 100
            }
          }
        ],
        "responses": {
          "200": {
            "description": "OK"
          }
        }
      }
    },
    "/api/v1/companies/{companyId}/trading_goods": {
      "get": {
        "tags": [
          "Companies"
        ],
        "summary": "Trading goods (merchandise) owned by a company.",
        "parameters": [
          {
            "name": "companyId",
            "in": "path",
            "description": "Id of the company.",
            "required": true,
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          },
          {
            "name": "airportICAO",
            "in": "query",
            "description": "Optional: only the goods stored at this airport.",
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "OK"
          }
        }
      }
    },
    "/api/v1/companies/{companyId}/twitch_overlay": {
      "get": {
        "tags": [
          "Companies"
        ],
        "summary": "Live data for the Twitch overlay of a company.",
        "parameters": [
          {
            "name": "companyId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "OK"
          }
        }
      }
    },
    "/api/v1/companies/{companyId}/work_orders": {
      "get": {
        "tags": [
          "Companies"
        ],
        "summary": "Work orders (maintenance and transport) of a company.",
        "parameters": [
          {
            "name": "companyId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "OK"
          }
        }
      }
    },
    "/api/v1/companies/{companyId}/work_orders/{aircraftId}": {
      "get": {
        "tags": [
          "Companies"
        ],
        "summary": "Work orders of a company for one aircraft.",
        "parameters": [
          {
            "name": "companyId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          },
          {
            "name": "aircraftId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "OK"
          }
        }
      }
    },
    "/api/v1/virtual_airlines/{vaId}": {
      "get": {
        "tags": [
          "Virtual airlines"
        ],
        "summary": "Details of a virtual airline (VA).",
        "parameters": [
          {
            "name": "vaId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "OK"
          }
        }
      }
    },
    "/api/v1/virtual_airlines/{vaId}/members": {
      "get": {
        "tags": [
          "Virtual airlines"
        ],
        "summary": "Members of a virtual airline, with their role and statistics.",
        "parameters": [
          {
            "name": "vaId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "OK"
          }
        }
      }
    },
    "/api/v1/virtual_airlines/{vaId}/roles": {
      "get": {
        "tags": [
          "Virtual airlines"
        ],
        "summary": "Roles defined in a virtual airline.",
        "parameters": [
          {
            "name": "vaId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "OK"
          }
        }
      }
    },
    "/api/v1/virtual_airlines/{vaId}/shareholders": {
      "get": {
        "tags": [
          "Virtual airlines"
        ],
        "summary": "Shareholders of a virtual airline.",
        "parameters": [
          {
            "name": "vaId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "OK"
          }
        }
      }
    },
    "/api/v1/aircraft_types/{aircraftTypeId}": {
      "get": {
        "tags": [
          "Aircraft"
        ],
        "summary": "Details of an aircraft type.",
        "parameters": [
          {
            "name": "aircraftTypeId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "OK"
          }
        }
      }
    },
    "/api/v1/aircraft/{aircraftId}": {
      "get": {
        "tags": [
          "Aircraft"
        ],
        "summary": "Details of an aircraft.",
        "parameters": [
          {
            "name": "aircraftId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "OK"
          }
        }
      }
    },
    "/api/v1/aircraft/{aircraftId}/economic_details": {
      "get": {
        "tags": [
          "Aircraft"
        ],
        "summary": "Economic reference data of the aircraft type, in the aircraft's world.",
        "parameters": [
          {
            "name": "aircraftId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "OK"
          }
        }
      }
    },
    "/api/v1/aircraft/{aircraftId}/flights": {
      "get": {
        "tags": [
          "Aircraft"
        ],
        "summary": "Flights of an aircraft, most recent first.",
        "parameters": [
          {
            "name": "aircraftId",
            "in": "path",
            "description": "Id of the aircraft.",
            "required": true,
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          },
          {
            "name": "startIndex",
            "in": "query",
            "description": "Index of the first flight to return (paging).",
            "schema": {
              "pattern": "^-?(?:0|[1-9]\\d*)$",
              "type": [
                "integer",
                "string"
              ],
              "format": "int32",
              "default": 0
            }
          },
          {
            "name": "limit",
            "in": "query",
            "description": "Maximum number of flights to return (default 10).",
            "schema": {
              "pattern": "^-?(?:0|[1-9]\\d*)$",
              "type": [
                "integer",
                "string"
              ],
              "format": "int32",
              "default": 10
            }
          }
        ],
        "responses": {
          "200": {
            "description": "OK"
          }
        }
      }
    },
    "/api/v1/aircraft/{aircraftId}/maintenance_costs": {
      "get": {
        "tags": [
          "Aircraft"
        ],
        "summary": "Maintenance costs of an aircraft: annual check-up, 100h inspection, engine replacement, 1% airframe or engine repair.",
        "parameters": [
          {
            "name": "aircraftId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "OK"
          }
        }
      }
    },
    "/api/v1/employees/{employeeId}": {
      "get": {
        "tags": [
          "Employees"
        ],
        "summary": "Details of an employee.",
        "parameters": [
          {
            "name": "employeeId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "OK"
          }
        }
      }
    },
    "/api/v1/airports/{icao}": {
      "get": {
        "tags": [
          "Airports"
        ],
        "summary": "Details of an airport.",
        "parameters": [
          {
            "name": "icao",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "OK"
          }
        }
      }
    },
    "/api/v1/airports/{icao}/aircraft": {
      "get": {
        "tags": [
          "Airports"
        ],
        "summary": "Aircraft currently at an airport.",
        "parameters": [
          {
            "name": "icao",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "OK"
          }
        }
      }
    },
    "/api/v1/fbos/{fboId}/jobs": {
      "get": {
        "tags": [
          "FBOs and jobs"
        ],
        "summary": "Jobs offered at an FBO.",
        "parameters": [
          {
            "name": "fboId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "OK"
          }
        }
      }
    },
    "/api/v1/fbos/jobs/{jobId}/accept": {
      "post": {
        "tags": [
          "FBOs and jobs"
        ],
        "summary": "Accepts an FBO job for the company of the API key.",
        "parameters": [
          {
            "name": "jobId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "OK"
          }
        }
      }
    },
    "/api/v1/flights/{flightId}": {
      "get": {
        "tags": [
          "Flights"
        ],
        "summary": "Details of a flight.",
        "parameters": [
          {
            "name": "flightId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "OK"
          }
        }
      }
    },
    "/api/v1/flights/{flightId}/zipped_events": {
      "get": {
        "tags": [
          "Flights"
        ],
        "summary": "Recorded events of a flight, zipped.",
        "parameters": [
          {
            "name": "flightId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "OK"
          }
        }
      }
    },
    "/api/v1/flights/{flightId}/zipped_flight_plan": {
      "get": {
        "tags": [
          "Flights"
        ],
        "summary": "Flight plan of a flight, zipped.",
        "parameters": [
          {
            "name": "flightId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "OK"
          }
        }
      }
    },
    "/api/v1/regular_routes": {
      "get": {
        "tags": [
          "Regular routes"
        ],
        "summary": "Regular routes of your company, with their flights of the last 30 days.",
        "description": "The company is the one of the API key. Each route gives its days, times, airports (ICAO), aircraft and default crew; each flight gives its status, departure date and override (fly in sim, aircraft, crew). Airports, aircraft and people are given by ICAO, identifier or pseudo and Id only.",
        "parameters": [
          {
            "name": "status",
            "in": "query",
            "description": "Optional: only the flights with this status (Pending, InProgress, Completed, Error, Canceled), and the routes that have some.",
            "schema": {
              "$ref": "#/components/schemas/RegularRouteFlightStatus"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "OK"
          }
        }
      }
    },
    "/api/v1/regular_routes/flights/{flightId}/clear_override": {
      "post": {
        "tags": [
          "Regular routes"
        ],
        "summary": "Clears the override of one regular route flight.",
        "description": "The flight follows its route again: flown by the AI, unless the route itself is flown in the simulator. Only a Pending or Error flight can be changed.",
        "parameters": [
          {
            "name": "flightId",
            "in": "path",
            "description": "Id of the flight, from regular_routes.",
            "required": true,
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "OK"
          }
        }
      }
    },
    "/api/v1/regular_routes/flights/{flightId}/override": {
      "post": {
        "tags": [
          "Regular routes"
        ],
        "summary": "Sets the override of one regular route flight.",
        "description": "The body replaces the whole override of the flight: an omitted field falls back to the route's own setting. To book the flight for a member, send { \"PilotId\": \"...\" } with the member's Id from regular_routes/pilots: a human pilot always flies in the simulator. To give the flight back to the AI, use clear_override. Crew and aircraft must belong to the company of the API key, or be members of its VA. Only a Pending or Error flight can be changed.",
        "parameters": [
          {
            "name": "flightId",
            "in": "path",
            "description": "Id of the flight, from regular_routes.",
            "required": true,
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          }
        ],
        "requestBody": {
          "description": "Override to apply.",
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/RegularRouteFlightOverride"
              }
            },
            "text/json": {
              "schema": {
                "$ref": "#/components/schemas/RegularRouteFlightOverride"
              }
            },
            "application/*+json": {
              "schema": {
                "$ref": "#/components/schemas/RegularRouteFlightOverride"
              }
            }
          },
          "required": true
        },
        "responses": {
          "200": {
            "description": "OK"
          }
        }
      }
    },
    "/api/v1/regular_routes/pilots": {
      "get": {
        "tags": [
          "Regular routes"
        ],
        "summary": "Pilots that can be assigned to a regular route flight.",
        "description": "AI pilots of the company of the API key, plus the members of a VA (or the owner of a company): use their Id as PilotId to have them fly the route in their simulator.",
        "responses": {
          "200": {
            "description": "OK"
          }
        }
      }
    },
    "/api/v1/zipped_metars": {
      "get": {
        "tags": [
          "Other"
        ],
        "summary": "METARs, zipped.",
        "parameters": [
          {
            "name": "date",
            "in": "query",
            "description": "Optional: METARs at this date (UTC); latest when omitted.",
            "schema": {
              "type": "string",
              "format": "date-time"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "OK"
          }
        }
      }
    }
  },
  "components": {
    "schemas": {
      "RegularRouteFlightOverride": {
        "type": "object",
        "properties": {
          "FlyInSim": {
            "type": [
              "null",
              "boolean"
            ],
            "description": "true: flown in the simulator; false: flown by the AI; omitted: as the route."
          },
          "AircraftId": {
            "type": [
              "null",
              "string"
            ],
            "description": "Aircraft of the company; omitted: the route's aircraft.",
            "format": "uuid"
          },
          "PilotId": {
            "type": [
              "null",
              "string"
            ],
            "description": "Pilot, from regular_routes/pilots; omitted: the route's pilot.",
            "format": "uuid"
          },
          "CopilotId": {
            "type": [
              "null",
              "string"
            ],
            "description": "Copilot, an employee of the company; omitted: the route's copilot.",
            "format": "uuid"
          },
          "FlightAttendantIds": {
            "type": [
              "null",
              "array"
            ],
            "items": {
              "type": "string",
              "format": "uuid"
            },
            "description": "Flight attendants, employees of the company; omitted: the route's attendants."
          }
        }
      },
      "RegularRouteFlightStatus": {
        "type": "integer"
      }
    },
    "securitySchemes": {
      "oa-apikey": {
        "type": "apiKey",
        "description": "Your company API key.",
        "name": "oa-apikey",
        "in": "header"
      }
    }
  },
  "security": [
    {
      "oa-apikey": [ ]
    }
  ],
  "tags": [
    {
      "name": "Companies"
    },
    {
      "name": "Virtual airlines"
    },
    {
      "name": "Aircraft"
    },
    {
      "name": "Employees"
    },
    {
      "name": "Airports"
    },
    {
      "name": "FBOs and jobs"
    },
    {
      "name": "Regular routes"
    },
    {
      "name": "Flights"
    },
    {
      "name": "Other"
    }
  ]
}