WebSocket AIS feed

Maritime events via WebSocket.

Track ship movements, monitor maritime accidents and discover ship's cargo from aisstream.io's websocket api in real-time and for free.

Streaming
{
  "MessageType": "PositionReport",
  "MetaData": {
    "ShipName": "EVER GIVEN",
    "Latitude": 30.002,
    "Longitude": 32.583
  },
  "Message": {
    "PositionReport": { "Sog": 9.4, "Cog": 318.2 }
  }
}
{
  "MessageType": "PositionReport",
  "MetaData": {
    "ShipName": "OOCL HONG KONG",
    "Latitude": 1.264,
    "Longitude": 103.84
  },
  "Message": {
    "PositionReport": { "Sog": 12.1, "Cog": 57.6 }
  }
}
{
  "MessageType": "PositionReport",
  "MetaData": {
    "ShipName": "CMA CGM JACQUES SAADE",
    "Latitude": 43.32,
    "Longitude": 5.35
  },
  "Message": {
    "PositionReport": { "Sog": 8.7, "Cog": 274.2 }
  }
}
{
  "MessageType": "PositionReport",
  "MetaData": {
    "ShipName": "MAERSK MC-KINNEY MOLLER",
    "Latitude": 51.905,
    "Longitude": 4.485
  },
  "Message": {
    "PositionReport": { "Sog": 11.3, "Cog": 91.8 }
  }
}
{
  "MessageType": "PositionReport",
  "MetaData": {
    "ShipName": "QUEEN MARY 2",
    "Latitude": 50.8812,
    "Longitude": -1.3983
  },
  "Message": {
    "PositionReport": { "Sog": 10.8, "Cog": 132.4 }
  }
}
WebSocket
Persistent connection
JSON
Typed AIS messages
Bounding boxes
Geographic filtering
Message types
Optional filtering

Quick start

Connect and read messages.

  1. 1Create a keySign in with GitHub and create an API key in Account.
  2. 2Send a subscriptionAuthenticate and set bounding boxes with optional message-type filters.
  3. 3Read continuouslyDecode each binary WebSocket frame as JSON and handle events promptly.
JavaScript · client.js
const WebSocket = require("ws");

const socket = new WebSocket("wss://stream.aisstream.io/v0/stream");

socket.on("open", () => socket.send(JSON.stringify({
  APIKey: process.env.AISSTREAM_API_KEY,
  BoundingBoxes: [[[25.835, -80.208], [25.603, -79.879]]],
  FilterMessageTypes: ["PositionReport"]
})));

socket.on("message", data => {
  const event = JSON.parse(data.toString());
  console.log(event.MessageType);
});

Track much more than just ship positions

Our global network of Automatic Identification System (AIS) stations, which power aisstream.io's tracking capabilities, allows us to stream much more than just ship positions.

create a account

Ship Property and Voyage Data

Track ships port calls, voyage destination and ship properties such as it's registered name.

Accident And Danger Reports

Track observed dangers at sea as well as ship accidents and rescues.

SAR Aircraft Position

Follow search and rescue aircraft movements at sea. Track their response to accidents.

Binary Ship To Ship Messages

See the messages ships send to each other using the ais system.

Common questions

Operational essentials

All limits and considerations →

How many connections can I open?

Up to three open connections per originating IP and three subscribed connections per account.

Why can delivery appear slow?

AIS is event-driven, so filters and current vessel activity affect volume. If you do not consume messages quickly enough and sufficient buffered messages accumulate, the service drops messages.

Can I connect from a browser?

No. Direct browser connections are not permitted. Connect from your own server and proxy only the information your clients need. This protects the API key and reduces load on the stream service.

How can I use a the service with a slow client?

Use focused geographic and message-type filters, and negotiate permessage-deflate compression in your WebSocket client to avoid dropped events fro slow reads.