> ## Documentation Index
> Fetch the complete documentation index at: https://docs.skyvexsoftware.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Search the schedule

> Search the VA's published schedule. Every filter is optional — an empty query returns up to `limit` flights. Filters are AND-combined.

If `pilots.only_flights_from_current` is enabled, the `departure_airport` filter is overridden server-side with the pilot's current airport.



## OpenAPI

````yaml /api-reference/openapi.json get /flights/search
openapi: 3.1.0
info:
  title: Stratos Core API
  version: 0.3.0
  summary: >-
    The Stratos VA API contract — auth, pilot identity, reference data, and the
    flight lifecycle.
  description: >-
    The contract every Stratos desktop client speaks to a virtual airline's crew
    system. The reference implementation is the open-source [stratos-core-api
    phpVMS 7 module](https://github.com/SkyvexSoftware/stratos-core-api), but
    any backend can implement these endpoints — they're framework-agnostic.


    Every endpoint in this reference is documented under `/api/stratos` — that's
    the convention the phpVMS module uses, and what we recommend for
    consistency. You're free to mount the surface anywhere you like; the desktop
    client just uses whatever base URL is set in your Stratos airline
    configuration.


    ## Authentication


    Most endpoints require a Bearer token — the pilot's API key, obtained via
    `POST /pilot/login` or your OAuth flow. Send as `Authorization: Bearer
    <api_key>` on every authenticated request.


    Public (no token): `GET /` and `POST /pilot/login`.


    ## Conventions


    - JSON, `snake_case` field names.

    - Distances in nautical miles, weights in pounds, flight times in decimal
    hours (unless suffixed `_minutes`).

    - Coordinates are decimal degrees (WGS84).

    - CORS is wide-open; the client preflights every method.
servers:
  - url: '{baseUrl}'
    description: >-
      Your VA's Stratos API base — set this to whatever URL the Stratos client
      is pointed at, including any path prefix you chose to mount the surface
      under.
    variables:
      baseUrl:
        default: https://crew.example.com/api/stratos
        description: >-
          Full base URL including the path prefix (no trailing slash). The
          phpVMS reference module mounts under `/api/stratos`; if you mounted
          yours somewhere else (e.g. `https://api.youva.com/stratos/v1`), use
          that.
security:
  - BearerAuth: []
tags:
  - name: Pilot
    description: Authentication, profile, and career statistics.
  - name: Reference Data
    description: Static lookup data the client renders in UI.
  - name: Flights
    description: >-
      Browse the schedule, manage bids, and run the active-flight lifecycle
      (start, update, complete, cancel).
paths:
  /flights/search:
    get:
      tags:
        - Flights
      summary: Search the schedule
      description: >-
        Search the VA's published schedule. Every filter is optional — an empty
        query returns up to `limit` flights. Filters are AND-combined.


        If `pilots.only_flights_from_current` is enabled, the
        `departure_airport` filter is overridden server-side with the pilot's
        current airport.
      operationId: searchFlights
      parameters:
        - name: departure_airport
          in: query
          description: ICAO of the departure airport (e.g. `YSSY`).
          schema:
            type: string
            minLength: 3
            maxLength: 4
        - name: arrival_airport
          in: query
          description: ICAO of the arrival airport.
          schema:
            type: string
            minLength: 3
            maxLength: 4
        - name: aircraft
          in: query
          description: >-
            Subfleet ID — only flights whose visible subfleets include this one
            are returned.
          schema:
            type: integer
        - name: minimum_flight_time
          in: query
          description: Minimum scheduled flight time, in decimal hours.
          schema:
            type: number
            format: float
            minimum: 0
        - name: maximum_flight_time
          in: query
          description: Maximum scheduled flight time, in decimal hours.
          schema:
            type: number
            format: float
            minimum: 0
        - name: minimum_distance
          in: query
          description: Minimum great-circle distance in nautical miles.
          schema:
            type: number
            format: float
            minimum: 0
        - name: maximum_distance
          in: query
          description: Maximum great-circle distance in nautical miles.
          schema:
            type: number
            format: float
            minimum: 0
        - name: limit
          in: query
          description: Max results to return. Capped server-side at 100.
          schema:
            type: integer
            minimum: 1
            maximum: 100
            default: 100
      responses:
        '200':
          description: Array of matching flights (may be empty).
          content:
            application/json:
              schema:
                type: array
                items:
                  $ref: '#/components/schemas/FlightSearchResult'
        '401':
          $ref: '#/components/responses/Unauthorized'
components:
  schemas:
    FlightSearchResult:
      type: object
      required:
        - id
        - number
        - code
        - departure_airport
        - arrival_airport
        - flight_level
        - route
        - distance
        - departure_time
        - arrival_time
        - flight_time
        - days_of_week
        - type
        - aircraft
        - notes
      properties:
        id:
          type: integer
          description: >-
            Flight ID (not a bid — convert to a bid by booking via your VA's
            booking flow before calling `/flights/start`).
        number:
          type: string
        code:
          type: string
        departure_airport:
          type: string
        arrival_airport:
          type: string
        flight_level:
          type: string
        route:
          type: string
          nullable: true
          description: >-
            Route as a single space-separated string. Differs from
            `/flights/bookings` where this is split into an array.
        distance:
          type: number
          format: float
        departure_time:
          type: string
        arrival_time:
          type: string
        flight_time:
          type: number
          format: float
        days_of_week:
          type: array
          items:
            type: integer
          description: Always returned as an empty array on search results.
        type:
          $ref: '#/components/schemas/FlightType'
        aircraft:
          type: string
          nullable: true
          description: Display name of the first matching subfleet aircraft.
        notes:
          type: string
          nullable: true
    FlightType:
      type: string
      enum:
        - P
        - C
      description: >-
        Coarse flight category derived from phpVMS's flight_type. `P` =
        passenger (scheduled/charter/extra/govt/other), `C` = cargo
        (ambulance/cargo/training/mail/military/positioning/special/general
        aviation/technical).
    Error:
      type: object
      properties:
        error:
          type: string
        success:
          type: boolean
        message:
          type: string
  responses:
    Unauthorized:
      description: Missing or invalid Bearer token.
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/Error'
          example:
            success: false
            error: Invalid Token
  securitySchemes:
    BearerAuth:
      type: http
      scheme: bearer
      description: >-
        The pilot's API key, obtained via `POST /pilot/login` or your OAuth
        flow. Send as `Authorization: Bearer <api_key>` on every authenticated
        request.

````