Skip to main content

Documentation Index

Fetch the complete documentation index at: https://mintlify.com/danizd/GeoSentinel/llms.txt

Use this file to discover all available pages before exploring further.

The AIS Vessels endpoint retrieves real-time ship positions from the ais-relay microservice (port 8003), which maintains a persistent WebSocket connection to AISStream.io and caches the latest vessel state in memory. Unlike the military flights endpoint, which issues a single union-bbox request, the backend queries the relay once per active AOI in parallel using a ThreadPoolExecutor with up to 8 worker threads, then deduplicates the combined result by vessel id — keeping the first occurrence when the same vessel falls inside multiple overlapping AOIs. Staleness is determined per AOI: if any individual relay call returns an X-Stale: true response header (set when the relay’s WebSocket is disconnected and it is serving mock data), the top-level isStale flag is set to true for the entire response.

GET /v1/ais-vessels

Returns all AIS-tracked vessels currently present within any active Area of Interest bounding box. No query parameters are accepted — bounding box coordinates are derived automatically from the active AOI records in the database.

Response body

The response conforms to AISVesselsResponseDTO.
vessels
array
required
Deduplicated list of vessels observed within any active AOI. Each element is an AISVesselDTO object.
clusters
array
required
Reserved for future vessel clustering. Currently always returned as an empty array [].
isStale
boolean
required
true if any individual AOI relay call returned an X-Stale: true response header, meaning that at least one AOI’s vessel data was served from mock or cached state rather than a live AISStream feed.

Example request

curl http://localhost:8000/v1/ais-vessels

Example response

{
  "vessels": [
    {
      "id": "mmsi:123456789",
      "mmsi": "123456789",
      "name": "MSC OSCAR",
      "callsign": "V7ABC1",
      "location": {"latitude": 36.1, "longitude": -5.3},
      "sog": 12.4,
      "cog": 180.0,
      "heading": 178.0,
      "navigationalStatus": "Under way using engine",
      "vesselType": "cargo",
      "flag": "PA",
      "destination": "ROTTERDAM",
      "isDark": false,
      "lastAisUpdate": "2025-01-15T12:00:00Z",
      "source": "aisstream"
    }
  ],
  "clusters": [],
  "isStale": false
}
If no AOIs are marked active in the database, the backend skips all relay calls and returns an empty AISVesselsResponseDTOvessels and clusters will both be empty arrays and isStale will be false.
The isStale flag is set to true if any AOI’s relay query returned an X-Stale: true response header. The relay sets this header when its AISStream WebSocket connection is not active and it is falling back to mock vessel data. Stale responses should be surfaced to users with an appropriate visual indicator. The relay requires the AISSTREAM_API_KEY environment variable to establish a live connection; without it, all responses will be stale mock data.

Build docs developers (and LLMs) love