Awake.AI Voyage Events API 1.0.0

Voyage Events API can be used to subscribe to real-time events related to sea voyages. Currently, the API supports zone events, which are sent when a ship has arrived to or departed from a given area (zone) defined by a geo-fence.

The API is based on WebSockets. Communication with the API starts by the client sending a subscription request message, including a description of the type of events it wishes to subscribe to. In the below example, the client subscribes to events for zones located in Finland (FI). Additionally, it is also possible to subscribe to zones associated with certain locodes.

{"msgType": "subscribe", "parameters": [{"eventType": "zone-event", "countries": ["FI"]}]}

The API will then respond with a subscription status message, signaling if the subscription was successful or not. If the subscription was successful, the server will respond with status ok and a unique subscription ID:

{"msgType": "subscription-status", "status": "ok", "subscriptionId": "f0823c69-7c67-4851-8d97-a525445a8b38"}

Following this, the API will start sending events. A typical zone event looks like the following:

{
  "msgType": "event",
  "eventType": "zone-event",
  "eventTimestamp": "2021-10-18T12:25:37+00:00",
  "eventId": "daf3e03d-6cd1-4624-be03-5d799b006789",
  "mmsi": 248562000,
  "imo": 9457191,
  "shipName": "EUROCARGO SAVONA",
  "location": [59.762187, 23.021522],
  "zoneId": "8fbfc1f1-cab1-4414-8cd0-d36121afd4ec",
  "zoneType": "pbp",
  "zoneEventType": "departure",
  "zoneName": "Hanko N",
  "locodes": ["FIHKO"]
}

If the websocket is disconnected, the client can resume the session with the subscription ID received in the subscription status message as follows:

{"msgType": "subscribe", "resume": "f0823c69-7c67-4851-8d97-a525445a8b38"}

If the provided subscription ID is recognized by the server, the client will receive an equivalent subscription status message as above. When a subscription is resumed, the server will first send possible events that happened while the client was disconnected, before starting to send real-time events.

Servers

  • voyages-api.prod.awake.ai/v1/wswssprod

    The service requires authentication with a token passed as a query parameter. The token is provided by Awake.AI.

    Example:

    https://voyages-api.prod.awake.ai/v1/ws?token=<api key>
    
  • voyages-api.stage.awake.ai/v1/wswssstage

    The service requires authentication with a token passed as a query parameter. The token is provided by Awake.AI.

    Example:

    https://voyages-api.stage.awake.ai/v1/ws?token=<api key>
    
  • voyages-api.dev.awake.ai/v1/wswssdev

    The service requires authentication with a token passed as a query parameter. The token is provided by Awake.AI.

    Example:

    https://voyages-api.dev.awake.ai/v1/ws?token=<api key>
    

Operations

  • PUB /

    Send messages to the API

    Operation IDprocessReceivedMessage

    Accepts the following message:

    SubscriptionRequest

    Subscription request sent by the client, specifying the events to subscribe to

    object
    >= 2 properties

    Examples

  • SUB /

    Receive message from the API

    Operation IDsendMessage

    Accepts one of the following messages:

    • #0SubscriptionStatus

      Subscription status provided by the server as a response to a subscription request

      object oneOf

      Examples

    • #1ZoneEvent

      Zone events delivered by the server

      object

      Examples

Messages

  • #1SubscriptionRequest

    Subscription request sent by the client, specifying the events to subscribe to

    object
    >= 2 properties
  • #2SubscriptionStatus

    Subscription status provided by the server as a response to a subscription request

    object oneOf
  • #3ZoneEvent

    Zone events delivered by the server

    object

Schemas

  • object
    uid: ZoneEventSubscription

    Zone event subscription request

  • object
    uid: SubscriptionStatusOk

    Successful subscription status

  • object
    uid: SubscriptionStatusFailed

    Failed subscription status