{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://artifacts.apis.io/openwaters-io/json-schema/openwaters-io-station-schema.json",
  "title": "Station",
  "x-generated": "2026-11-20",
  "x-method": "derived",
  "x-generator": "derive-json-schema.py",
  "x-source": "openapi/ais-openapi.json#/components/schemas/Station",
  "type": "object",
  "required": [
    "station",
    "source",
    "events",
    "duplicates",
    "vessels",
    "vessels_24h",
    "vessels_exclusive_24h",
    "uptime_7d",
    "positions",
    "first_seen",
    "last_seen",
    "last_age_s"
  ],
  "properties": {
    "station": {
      "type": "string",
      "description": "Station id. Volunteer UDP stations are a keyed hash of the sender, never an address. A feed's TAG `s:` adds a path naming one of its receivers, such as `barentswatch/terra`; a volunteer's station is its `source`, whatever its sentences' TAG `s:` says."
    },
    "source": {
      "type": "string"
    },
    "events": {
      "$ref": "#/$defs/Windows"
    },
    "duplicates": {
      "type": "integer",
      "description": "Position messages another station delivered first, over the station's history, up to an hour behind; since the last restart while `uptime_7d` is null."
    },
    "vessels": {
      "type": "integer",
      "description": "Distinct MMSIs whose positions the station heard in the last 30 minutes, its own vessel left out. Counts what is binned, up to about 7 minutes behind. 0 without ClickHouse or after 10 minutes of failed reads, when `uptime_7d` is null too."
    },
    "vessels_24h": {
      "type": "integer",
      "description": "Distinct MMSIs whose positions the station heard in the last 24 hours, its own vessel left out. Up to about 7 minutes behind."
    },
    "vessels_exclusive_24h": {
      "type": "integer",
      "description": "Of `vessels_24h`, the vessels no other station heard. A vessel counts whether this station delivered a message first or as a duplicate, and an aggregator's late copy of a report another station already delivered does not count as hearing it."
    },
    "uptime_7d": {
      "type": [
        "number",
        "null"
      ],
      "description": "Share of hours with a position reception, from 0 to 1, over the last 7 days or since the station's first hour if later. The current hour counts once it has one. Null without ClickHouse, until the series' hourly totals have the station, while the totals are over 3 hours old, and while ClickHouse has not answered for 10 minutes."
    },
    "name": {
      "type": "string",
      "description": "What to call the station: the name its operator chose when minting its token, else the name of the boat it is on. Absent when it has neither, or when moderation has locked it."
    },
    "name_from": {
      "type": "string",
      "enum": [
        "operator",
        "vessel"
      ],
      "description": "Where `name` came from."
    },
    "mmsi": {
      "type": "integer",
      "description": "The station's own vessel, from the `!AIVDO` sentences it sends."
    },
    "near": {
      "type": "string",
      "description": "The town or region nearest the traffic the station hears, such as `Santa Monica, CA` or `Munster, Ireland`. Volunteer stations only. Place names from GeoNames, CC BY 4.0."
    },
    "positions": {
      "type": "integer",
      "description": "Position messages the station delivered first, over the station's history, up to an hour behind; since the last restart while `uptime_7d` is null."
    },
    "first_seen": {
      "type": "string",
      "format": "date-time",
      "description": "The station's first hour in its history, or when this server first heard it if earlier, or while `uptime_7d` is null; for a station not heard since the server started, its first hour in the last 30 days until its history is read. During the first backfill the history is partial, so the first hour can read later than it was."
    },
    "last_seen": {
      "type": "string",
      "format": "date-time",
      "description": "The last message. For a station not heard since the server started, its last position reception the history holds, up to about 7 minutes behind, or the start of its last hour when that hour held only stale copies or the read of its last reception failed."
    },
    "last_age_s": {
      "type": "integer",
      "description": "Seconds since `last_seen`."
    },
    "bbox": {
      "type": "array",
      "description": "`[minLat, minLon, maxLat, maxLon]` extent of positions heard since the server last started, a rough coverage footprint. Absent until the station hears one.",
      "items": {
        "type": "number"
      },
      "minItems": 4,
      "maxItems": 4
    },
    "hours": {
      "type": "array",
      "description": "`GET /v1/stations/{id}` only: the station's position receptions in each hour of the last 7 days, UTC, 168 counts oldest first, the current hour last, its own vessel's included, as `uptime_7d` counts them. An hour with none is 0. Up to about 7 minutes behind, and read at most once a minute per station. Absent without ClickHouse, while the station list's figures find ClickHouse down, for the minute after its read fails, and when the page waited 10 seconds behind another station's read; each of those stands for the minute.",
      "items": {
        "type": "integer"
      },
      "minItems": 168,
      "maxItems": 168
    },
    "hours_from": {
      "type": "string",
      "format": "date-time",
      "description": "`GET /v1/stations/{id}` only, with `hours`: the UTC hour its first count is for. Each later count is the next hour."
    },
    "types": {
      "type": "object",
      "description": "`GET /v1/stations/{id}` only: the vessels the station heard in the last 24 hours, its own vessel left out, by type, each as `[vessels, unique]`, where unique counts those no other station heard, as `vessels_exclusive_24h` does. A key is an ITU ship type such as `\"70\"`: the latest non-zero one any source sent, within the last 35 days, else the one the vessel cache or record holds, credited to the vessel's source as `/v1/vessels` credits it; `\"0\"` when none is known; or a kind for what is not a ship: `aton`, `base`, `sar` for a SAR aircraft or a distress beacon, or `gear`. Read apart from `vessels_24h`, so the counts can differ from it by a minute's traffic. Absent without ClickHouse, while the station list's figures find ClickHouse down, for the minute after its read fails, after a 10-second wait, and when the station heard no vessel. The response's `attribution` credits the sources of the types.",
      "additionalProperties": {
        "type": "array",
        "items": {
          "type": "integer"
        },
        "minItems": 2,
        "maxItems": 2
      }
    }
  },
  "$defs": {
    "Windows": {
      "type": "object",
      "description": "A rolling counter: hourly buckets, kept across restarts.",
      "required": [
        "last_24h",
        "last_7d"
      ],
      "properties": {
        "last_24h": {
          "type": "integer"
        },
        "last_7d": {
          "type": "integer"
        }
      }
    }
  }
}