{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://artifacts.apis.io/openwaters-io/json-schema/openwaters-io-claims-schema.json",
  "title": "Claims",
  "description": "The claims a token carries. Absent limits mean unlimited.",
  "x-generated": "2026-11-20",
  "x-method": "derived",
  "x-generator": "derive-json-schema.py",
  "x-source": "openapi/ais-openapi.json#/components/schemas/Claims",
  "type": "object",
  "properties": {
    "kid": {
      "type": "string",
      "description": "Issuer key id."
    },
    "sub": {
      "type": "string",
      "description": "Who: a station name, partner name, or `ed25519:<pubkey>` / `mmsi:<n>` for a device."
    },
    "role": {
      "type": "string",
      "enum": [
        "personal",
        "feeder",
        "peer",
        "partner",
        "admin"
      ]
    },
    "iat": {
      "type": "integer",
      "description": "Issued at, unix seconds."
    },
    "exp": {
      "type": "integer",
      "description": "Expiry, unix seconds. Absent on personal tokens, which never expire."
    },
    "bbox": {
      "type": "array",
      "description": "Boxes every subscription must fit inside, each `[minLat, minLon, maxLat, maxLon]`.",
      "items": {
        "type": "array",
        "items": {
          "type": "number"
        },
        "minItems": 4,
        "maxItems": 4
      }
    },
    "cidr": {
      "type": "array",
      "description": "Source CIDRs/IPs the token may be used from. On a personal token signed with the personal issuer's key (one minted by `POST /v1/keys`), a single address is a UDP station claim like `udp` and does not limit where the token is used. An operator-minted personal token with `cidr` is still limited to it.",
      "items": {
        "type": "string"
      }
    },
    "udp": {
      "type": "array",
      "description": "Addresses whose UDP stations the token owns, set by `bind_ip`. Not a limit on where the token is used from.",
      "items": {
        "type": "string"
      }
    },
    "conns": {
      "type": "integer",
      "description": "Concurrent WebSocket cap for this `sub`."
    },
    "rate": {
      "type": "integer",
      "description": "Messages per second per connection; excess is thinned."
    },
    "area": {
      "type": "integer",
      "description": "Total subscribed bounding-box area in square degrees. Negative means MMSI-only subscriptions."
    },
    "mmsis": {
      "type": "integer",
      "description": "Vessels followed by MMSI or IMO per subscription."
    }
  }
}