mmsi.port_id or unloco (you cannot provide both).GET https://api.myshiptracking.com/api/v2/port/calls
        | Parameter | Required | Type | Default | Description | 
|---|---|---|---|---|
| apikey (header) | yes | text | 
                            Your API key. Pass via the HTTP header Authorization: Bearer YOUR_API_KEY or x-api-key.
                         | 
                    |
| type | no | integer | 0 | Filter by event type. Allowed values: 0 (all events), 1 (arrivals only), 2 (departures only). Default is 0. | 
| port_id / unloco | conditionally required* | integer / text | 
                            Port identifier. Provide either a numeric port_id or a text-based unloco. Do not provide both.
                         | 
                    |
| mmsi | integer | 9‑digit Maritime Mobile Service Identity. Use this if you want to filter results by vessel. | ||
| days | yes (if not using fromdate and todate) | 
                        integer | 
                            Number of days to look back. Provide either fromdate and todate or days, but not both.
                         | 
                    |
| fromdate | yes (if not using days) | 
                        ISO 8601 datetime | 
                            Start date/time in ISO 8601 UTC format (e.g. 2025-11-04T12:12:00Z).
                         | 
                    |
| todate | yes (if not using days) | 
                        ISO 8601 datetime | 
                            End date/time in ISO 8601 UTC format (e.g. 2025-11-04T13:10:00Z).
                         | 
                    
*You must supply at least one identifier from either the mmsi group or the port_id/unloco group. Allowed combinations are: mmsi; mmsi + port_id; mmsi + unloco; port_id; or unloco.
| Field | Type | Description | 
|---|---|---|
| event | text | Port call event type (ARRIVAL or DEPARTURE). | 
| time_utc | datetime | Timestamp (UTC) when the port call occurred. | 
| time_local | datetime | Local timestamp when the port call occurred. | 
| mmsi | int | Vessel’s 9‑digit Maritime Mobile Service Identity. | 
| imo | int | Vessel’s 7‑digit International Maritime Organization number (if available). | 
| vessel_name | text | Name of the vessel. | 
| port_id | int | Port identifier. | 
| port_name | text | Name of the port. | 
| unloco | text | Port UN/LOCODE. | 
All API responses follow a standardized envelope format for consistency and ease of integration.
On success (HTTP status code 200), the envelope includes:
status: "success"duration: Time taken to process the request (in seconds).timestamp: Server timestamp when the response was generated (ISO 8601 format).data: The requested resource data. For XML responses, the data is formatted according to the requested XML structure.On error, the envelope includes:
status: "error"duration: Time taken to process the request.timestamp: Server timestamp when the error was generated.code: Specific error code used for troubleshooting.message: Detailed error message.The response format (JSON or XML) is determined by the Accept header.
Note: When credits are charged for a request, the response includes a custom HTTP header X-Credit-Charged indicating the number of credits deducted.
{
    "status": "success",
    "duration": "0.026218332",
    "timestamp": "2025-11-04T06:32:08.766Z",
    "data": [
        {
            "event": "ARRIVAL",
            "time_utc": "2025-03-14T14:23:47Z",
            "time_local": "2025-03-14T16:23:47",
            "mmsi": 241087000,
            "imo": 9565039,
            "vessel_name": "BLUE STAR DELOS",
            "port_id": 28,
            "port_name": "IOS",
            "unloco": "GRIOS"
        },
        {
            "event": "DEPARTURE",
            "time_utc": "2025-03-14T09:14:55Z",
            "time_local": "2025-03-14T11:14:55",
            "mmsi": 239914200,
            "imo": null,
            "vessel_name": "SANTORINI",
            "port_id": 28,
            "port_name": "IOS",
            "unloco": "GRIOS"
        }
    ]
}
        
        {
    "status": "error",
    "duration": "0.001234567",
    "timestamp": "2025-11-04T06:35:00.000Z",
    "code": "MST_ERR_VALIDATOR",
    "message": "fromdate and todate must be provided together."
}
    The following error responses can be returned. Each error follows the standardized response envelope.
| Error Code | HTTP Status | Description | 
|---|---|---|
| MST_ERR_VALIDATOR | 400 | Parameter validation failed (e.g. incorrect format or missing required time range parameters). | 
| ERR_INVALID_IDENTIFIER | 400 | Either none or more than one identifier was provided; exactly one identifier (mmsi, or port_id/unloco) is required. | 
| ERR_NO_KEY | 401 | No API key was provided in the request headers. | 
| ERR_INVALID_KEY | 401 | The provided API key is invalid or unrecognized. | 
| ERR_INVALID_DATE | 400 | Invalid date format for fromdate or todate. | 
| ERR_DATE_RANGE | 400 | The range between fromdate and todate must be 90 days max and up to 2 years back | 
| ERR_NOACCESS | 403 | The API key does not have permission to access this endpoint. | 
| ERR_NO_CREDITS | 402 | Insufficient credit balance for the requested operation. | 
| ERR_PORT_NOT_FOUND | 404 | No port or port calls were found matching the provided identifier. | 
| ERR_RATE_LIMIT | 429 | The request rate limit has been exceeded. | 
| ERR_INTERNAL | 500 | An internal server error occurred. | 
<?php
$apiKey   = "YOUR_API_KEY";
$port_id  = 28; // Alternatively, use unloco or mmsi
$fromdate = "2025-03-13T22:12:00Z";
$todate   = "2025-03-14T14:43:00Z";
$url      = "https://api.myshiptracking.com/api/v2/port/calls?port_id={$port_id}&fromdate={$fromdate}&todate={$todate}";
// Optional: Append &days=NUMBER_OF_DAYS or &type=1 (for arrivals) or &type=2 (for departures)
$headers  = [
    "Authorization: Bearer $apiKey"
    // Alternatively: "x-api-key: $apiKey"
];
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, $url);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_HTTPHEADER, $headers);
$response = curl_exec($ch);
if(curl_errno($ch)) {
    echo 'Request Error: ' . curl_error($ch);
} else {
    echo $response;
}
curl_close($ch);
?>
                curl --location 'https://api.myshiptracking.com/api/v2/port/calls?port_id=28&fromdate=2025-03-13T22%3A12%3A00Z&todate=2025-03-14T14%3A43%3A00Z' \
--header 'authorization: Bearer YOUR_API_KEY'
# Optional: Append &days=NUMBER_OF_DAYS or &type=1 or &type=2
                import requests
api_key   = "YOUR_API_KEY"
port_id   = 28  # Alternatively, use unloco or mmsi
fromdate  = "2025-03-13T22:12:00Z"
todate    = "2025-03-14T14:43:00Z"
url       = f"https://api.myshiptracking.com/api/v2/port/calls?port_id={port_id}&fromdate={fromdate}&todate={todate}"
# Optional: Append &days=NUMBER_OF_DAYS or &type=1 or &type=2
headers   = {
    "Authorization": f"Bearer {api_key}"
    # Alternatively: "x-api-key": api_key
}
response = requests.get(url, headers=headers)
if response.ok:
    print(response.json())
else:
    print("Error:", response.status_code, response.text)
                const apiKey = "YOUR_API_KEY";
const port_id = 28; // Alternatively, use unloco or mmsi
const fromdate = "2025-03-13T22:12:00Z";
const todate = "2025-03-14T14:43:00Z";
let url = `https://api.myshiptracking.com/api/v2/port/calls?port_id=${port_id}&fromdate=${fromdate}&todate=${todate}`;
// Optional: Append &days=NUMBER_OF_DAYS or &type=1 or &type=2
fetch(url, {
  method: "GET",
  headers: {
    "Authorization": `Bearer ${apiKey}`
    // Alternatively: "x-api-key": apiKey
  }
})
.then(response => response.headers.get("Content-Type").includes("application/xml") ? response.text() : response.json())
.then(data => console.log(data))
.catch(error => console.error("Error:", error));
                import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.net.HttpURLConnection;
import java.net.URL;
public class PortCallsExample {
    public static void main(String[] args) {
        try {
            String apiKey   = "YOUR_API_KEY";
            int port_id     = 28; // Alternatively, use unloco or mmsi
            String fromdate = "2025-03-13T22:12:00Z";
            String todate   = "2025-03-14T14:43:00Z";
            String urlString = "https://api.myshiptracking.com/api/v2/port/calls?port_id=" + port_id + "&fromdate=" + fromdate + "&todate=" + todate;
            // Optional: Append &days=NUMBER_OF_DAYS or &type=1/2 as needed
            
            URL url = new URL(urlString);
            HttpURLConnection conn = (HttpURLConnection) url.openConnection();
            conn.setRequestMethod("GET");
            conn.setRequestProperty("Authorization", "Bearer " + apiKey);
            int responseCode = conn.getResponseCode();
            BufferedReader in = new BufferedReader(new InputStreamReader(
                (responseCode == HttpURLConnection.HTTP_OK) ? conn.getInputStream() : conn.getErrorStream()));
            String inputLine;
            StringBuilder response = new StringBuilder();
            while ((inputLine = in.readLine()) != null) {
                response.append(inputLine);
            }
            in.close();
            System.out.println(response.toString());
        } catch (Exception e) {
            e.printStackTrace();
        }
    }
}
                using System;
using System.Net.Http;
using System.Net.Http.Headers;
using System.Threading.Tasks;
class PortCallsExample {
    static async Task Main() {
        string apiKey = "YOUR_API_KEY";
        int port_id = 28; // Alternatively, use unloco or mmsi
        string fromdate = "2025-03-13T22:12:00Z";
        string todate = "2025-03-14T14:43:00Z";
        string url = $"https://api.myshiptracking.com/api/v2/port/calls?port_id={port_id}&fromdate={fromdate}&todate={todate}";
        // Optional: Append &days=NUMBER_OF_DAYS or &type=1/2 if needed
        using (HttpClient client = new HttpClient()) {
            client.DefaultRequestHeaders.Authorization = new AuthenticationHeaderValue("Bearer", apiKey);
            HttpResponseMessage response = await client.GetAsync(url);
            if (response.IsSuccessStatusCode) {
                string content = await response.Content.ReadAsStringAsync();
                Console.WriteLine(content);
            } else {
                Console.WriteLine("Error: " + response.StatusCode);
            }
        }
    }
}
                require 'net/http'
require 'uri'
require 'json'
api_key   = "YOUR_API_KEY"
port_id   = 28  # Alternatively, use unloco or mmsi
fromdate  = "2025-03-13T22:12:00Z"
todate    = "2025-03-14T14:43:00Z"
uri       = URI("https://api.myshiptracking.com/api/v2/port/calls?port_id=#{port_id}&fromdate=#{fromdate}&todate=#{todate}")
# Optional: Append &days=NUMBER_OF_DAYS or &type=1/2
request = Net::HTTP::Get.new(uri)
request["Authorization"] = "Bearer #{api_key}"
response = Net::HTTP.start(uri.hostname, uri.port, use_ssl: true) do |http|
  http.request(request)
end
if response.is_a?(Net::HTTPSuccess)
  data = JSON.parse(response.body)
  puts data
else
  puts "Error: #{response.code} #{response.message}"
end
                
Your request preview will appear here...
                
            
Your response will appear here...