---
title: "ETA computation"
method: POST
path: "/compute-eta"
tags: ["Estimated time arrival"]
---

# ETA computation

`POST /compute-eta`

This endpoint is used to compute the Estimated Time of Arrival of any vessel.

Request
=======

To compute the ETA of a vessel, we need information concerning the vessel, the departure (optional) and the arrival. These 3 elements are present in the request in 3 different fields.

It will allow you to compute the ETA of a vessel **from the vessel position to a port** or **from a port to another port**.

Vessel
------

To identify the vessel, you can use the IMO (International Maritime Organization) or the MMSI (Maritime Mobile Service Identity).

You can optionally set the vessel speed to use for computation, in nautical miles per hour. The maximum speed is 25.0

Departure
---------

By default, the ETA is computed with the latest known position of the vessel as departure (time and position). The API allows you to compute an ETA of a vessel from a port to another port. In that case, you must use the field **departure** to define the departure port code and the departure date time (ISO 8601 format).

**Note that you can't define a departure date time in case of vessel position to port ETA computation.**

Arrival
-------

Arrival field is used to define to where the eta must be computed. You need to indicate the port code of the arrival.

Response
========

You will find the response of the ETA in the field named **arrivalTime** in format ISO 8601

You will also find the confidence of the result which is a value from 1 to 5, 5 means high confidence.

You will also find the remaining distance which is in nautical miles

The fields from the request will also be added in the response.

Examples
========

You can find below 2 examples of payloads for the 2 ways to compute the ETA.

## Request body

- EtaRequest
  - `vessel` EtaVessel, required
    - `imo` integer
    - `mmsi` integer
    - `speed` number, double — The speed of the vessel you want to use in the eta computation, in nautical mile per hour
  - `departure` EtaDeparture
    - `date` string, date-time — Date-time of departure, if not present, the current date-time (now) will be used
    - `portCode` string — The departure port code composed of 5 characters (2 for the country, 3 for the port), if not present neither latitude and latitude, the vessel position will be used
  - `arrival` EtaArrival, required
    - `portCode` string, required — Arrival port code composed of 5 characters (2 for the country, 3 for the port)

## Response `200`

The computed ETA

- EtaResponse
  - `arrivalTime` string, date-time, required — The time at which the vessel will arrive
  - `vessel` EtaVessel, required
    - `imo` integer
    - `mmsi` integer
    - `speed` number, double — The speed of the vessel you want to use in the eta computation, in nautical mile per hour
  - `departure` EtaDeparture
    - `date` string, date-time — Date-time of departure, if not present, the current date-time (now) will be used
    - `portCode` string — The departure port code composed of 5 characters (2 for the country, 3 for the port), if not present neither latitude and latitude, the vessel position will be used
  - `arrival` EtaArrival, required
    - `portCode` string, required — Arrival port code composed of 5 characters (2 for the country, 3 for the port)
  - `confidence` integer, required — The confidence of the eta computation, from 1 (low confidence) to 5 (high confidence)
  - `remainingTime` number, double — Predicted remaining time in hours.
  - `errorMarginValue` number, double — Error margin value in hours.
  - `remainingDistance` number, double — The remaining distance in nautical miles

## Other responses

- `400` — The body in the request is not correct
- `401` — The authentication failed
- `404` — The resource has not been found
- `500` — An error occurend on server side
- `default` — default

---

[API](https://skmtc.net/safecube/apis/api-container-tracking.md) · [All operations](https://skmtc.net/safecube/apis/api-container-tracking/llms.txt) · [OpenAPI document](https://skmtc-service-staging.skmtc.workers.dev/v1/apis/safecube/api-container-tracking/revisions/e74a670ab7a5/schema)
