This guide explains how to access detailed container routes and vessel positions data (historical and future positions) using Terminal49 APIs.
GET /v2/containers/{id}/route
endpoint. (See: Get Container Route API Reference)
API Request & Response Snippet for Port Locations
data.relationships.route_locations.data
array to get the sequence of stops.route_location
object (found in included
using its ID from the previous step), find its corresponding physical location
(port) by looking up the relationships.location.data.id
in the included
array (where type
is port
).latitude
and longitude
from the port attributes to plot markers on your map (e.g., POL, TS1, TS2 as shown in the image).route_location
in included
also contains valuable data like outbound_atd_at
, inbound_ata_at
, outbound_vessel.id
, inbound_vessel.id
etc., which you’ll need for the next steps.GET /v2/vessels/{id}?show_positions[from_timestamp]={departure_time}&show_positions[to_timestamp]={arrival_time}
endpoint. (See: Get Vessel Positions API Reference
API Request & Response Snippet for Historical Paths
/containers/{id}/route
response, for each completed leg (i.e., both ATD from origin and ATA at destination are known):
outbound_vessel.data.id
from the departure route_location
.outbound_atd_at
(Actual Time of Departure) from the departure route_location
as the from_timestamp
.inbound_ata_at
(Actual Time of Arrival) from the arrival route_location
as the to_timestamp
./vessels/{vessel_id}?show_positions...
endpoint with these details.attributes.positions
array will contain a series of latitude/longitude coordinates. Plot these coordinates as a connected solid line on your map to represent the vessel’s actual historical path for that leg (like the green line from POL to TS1 in the image).GET /v2/vessels/{id}/future_positions_with_coordinates
(For Vessels Currently En Route)API Request & Response Snippet for Detailed Future Paths (Vessel En Route)
/containers/{id}/route
response, check if the leg has an outbound_atd_at
from the origin port but no inbound_ata_at
at the destination port yet.outbound_vessel.data.id
from the departure route_location
.GET /v2/vessels/{vessel_id}
. The response will contain its latest latitude
, longitude
, and position_timestamp
in the attributes
section.
future_positions_with_coordinates
:
location.data.id
of the original departure port for this leg (as previous_port_id
or similar parameter, check API ref).location.data.id
of the final arrival port for this leg (as port_id
or similar parameter).latitude
and longitude
of the vessel in the request.attributes.positions
array will provide a sequence of estimated coordinates starting from (or near) the vessel’s current position. Plot these as a connected dashed line on your map (like the dashed line from the vessel’s current position between TS1 and TS2, heading towards TS2 in the image).GET /v2/vessels/{id}/future_positions
(For Legs Not Yet Started)API Request & Response Snippet for Future Paths Between Ports (Leg Not Started)
/containers/{id}/route
response, check if the leg has no outbound_atd_at
from the origin port (or outbound_etd_at
is in the future).outbound_vessel.data.id
that will perform this leg.location.data.id
of the departure port for this leg (as previous_port_id
).location.data.id
of the arrival port for this leg (as port_id
).future_positions
:attributes.positions
array will provide estimated coordinates for the full leg. Plot these as a connected dashed line on your map (like the dashed line from TS3 to TS4 in the image, assuming the vessel is still at TS3).route_locations
obtained from the initial /containers/{id}/route
call: