{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://artifacts.apis.io/openwaters-io/json-schema/openwaters-io-vessel-feature-schema.json",
  "title": "VesselFeature",
  "description": "One vessel and its last known position.",
  "x-generated": "2026-11-20",
  "x-method": "derived",
  "x-generator": "derive-json-schema.py",
  "x-source": "openapi/ais-openapi.json#/components/schemas/VesselFeature",
  "type": "object",
  "required": [
    "type",
    "id",
    "geometry",
    "properties"
  ],
  "properties": {
    "type": {
      "type": "string",
      "const": "Feature"
    },
    "id": {
      "type": "integer",
      "description": "MMSI."
    },
    "geometry": {
      "type": [
        "object",
        "null"
      ],
      "description": "The last known position. Always present in a FeatureCollection; `null` from `/v1/vessels/{mmsi}` for a vessel whose position was never heard.",
      "required": [
        "type",
        "coordinates"
      ],
      "properties": {
        "type": {
          "type": "string",
          "const": "Point"
        },
        "coordinates": {
          "type": "array",
          "description": "`[longitude, latitude]`.",
          "items": {
            "type": "number"
          },
          "minItems": 2,
          "maxItems": 2
        }
      }
    },
    "properties": {
      "type": "object",
      "required": [
        "mmsi",
        "kind",
        "seen",
        "source",
        "station",
        "msg_type"
      ],
      "properties": {
        "mmsi": {
          "type": "integer"
        },
        "kind": {
          "type": "string",
          "enum": [
            "vessel",
            "aton",
            "base",
            "sar",
            "gear"
          ],
          "description": "From the station's message types, and otherwise from what it reports about itself, as the `kind` filter describes. `sar` is a search and rescue aircraft or an active distress beacon (AIS-SART, man-overboard, EPIRB-AIS). `gear` is a transmitter on fishing gear, usually a net buoy; it has no `flag`, and its `type`, when present, is whatever ship type code it sends, often a reserved one. New kinds may be added; treat an unknown one as `vessel`."
        },
        "name": {
          "type": "string",
          "description": "Present only when known."
        },
        "type": {
          "type": "integer",
          "description": "AIS ship/cargo code, or AtoN type. Present only when known."
        },
        "cog": {
          "type": "number",
          "description": "Course over ground, degrees. Present only when known."
        },
        "sog": {
          "type": "number",
          "description": "Speed over ground, knots. Present only when known."
        },
        "heading": {
          "type": "integer",
          "description": "True heading, degrees, 0 to 359. Present only when known; a value out of that range, which some transmitters send, is left out."
        },
        "nav_status": {
          "type": "integer",
          "description": "AIS navigational status. Present only when known."
        },
        "near": {
          "type": "string",
          "description": "The town or region nearest the position, such as `Santa Monica, CA` or `Munster, Ireland`. On `q` searches and `/v1/vessels/{mmsi}`, and absent more than 100 km from a town of 5,000, or without a position. Place names from GeoNames, CC BY 4.0."
        },
        "flag": {
          "type": "string",
          "description": "ISO 3166-1 alpha-2 code of the flag state, from the MMSI's maritime identification digits. Present only when the MID is known, and never for `gear`, whose MMSI no flag state assigned."
        },
        "imo": {
          "type": "integer",
          "description": "IMO number from the vessel's static data. Present only when sent."
        },
        "callsign": {
          "type": "string",
          "description": "Radio call sign. Present only when sent."
        },
        "destination": {
          "type": "string",
          "description": "Destination as typed by the crew: a port name, a UN/LOCODE, or nothing useful. Present only when sent."
        },
        "eta": {
          "type": "string",
          "description": "Estimated arrival as sent, `MM-DD HH:MM` UTC, or `MM-DD` when the time is not available. AIS carries no year. Present only when sent."
        },
        "draught": {
          "type": "number",
          "description": "Maximum static draught, metres. Present only when sent, and never for `gear`."
        },
        "length": {
          "type": "integer",
          "description": "Overall length, metres, from the dimension fields. Present only when sent, and never for `gear`, whose size is a placeholder (a net buoy sends a 10 m square)."
        },
        "beam": {
          "type": "integer",
          "description": "Beam, metres. Present only when sent, and never for `gear`."
        },
        "to_bow": {
          "type": "integer",
          "description": "Metres from the AIS antenna (the vessel's reference point) to the bow; 511 means 511 or more. `to_bow` and `to_stern` add up to `length` and are present together once known, never for `gear`, and 0 can be a real value: a vessel that does not know where its antenna sits sends 0 to the bow and its length to the stern."
        },
        "to_stern": {
          "type": "integer",
          "description": "Metres from the AIS antenna to the stern; 511 means 511 or more. Present together with `to_bow`."
        },
        "to_port": {
          "type": "integer",
          "description": "Metres from the AIS antenna to the port side; 63 means 63 or more. `to_port` and `to_starboard` add up to `beam` and are present together once known, never for `gear`; a vessel that does not know where its antenna sits sends 0 to port and its beam to starboard."
        },
        "to_starboard": {
          "type": "integer",
          "description": "Metres from the AIS antenna to the starboard side; 63 means 63 or more. Present together with `to_port`."
        },
        "first_seen": {
          "type": "string",
          "format": "date-time",
          "description": "The earliest report of the vessel the network holds, from live traffic or its archive. On `/v1/vessels/{mmsi}` only."
        },
        "seen": {
          "type": "string",
          "format": "date-time",
          "description": "Time of the last message that updated the vessel."
        },
        "source": {
          "type": "string",
          "description": "Source of that message: an upstream name, `station:<sub>` for an authenticated contributor (whatever transport it fed over), `udp:<hash>`, or `mmsi:<n>`."
        },
        "station": {
          "type": "string",
          "description": "Station that delivered that message."
        },
        "msg_type": {
          "type": "string",
          "description": "aisstream-style type name of that message."
        }
      }
    }
  }
}