JSON. To receive XML, set the Accept header to application/xml.
            GET https://api.myshiptracking.com/api/v2/vessel/nearby
        | Parameter | Required | Type | Default | Description | 
|---|---|---|---|---|
| apikey (header) | yes | text | Your API key. Pass it via the HTTP header Authorization: Bearer YOUR_API_KEYorx-api-key. | |
| response | no | text | simple | Allowed values: simple or extended. simple: Returns basic vessel information. extended: Returns additional vessel details. | 
| mmsi | yes | integer | 9-digit Maritime Mobile Service Identity of the reference vessel. | |
| radius | no | number | 20 | Search radius in nautical miles within which to retrieve nearby vessels. Allowed range: 1 to 100. | 
| Field | Type | Description | 
|---|---|---|
| distance | real | Computed distance (in nautical miles) from the reference vessel. | 
| bearing | int | Calculated true bearing (in degrees) from the reference vessel’s position to the candidate vessel’s position, computed solely from their geographic coordinates using the great circle formula. | 
| vessel_name | text | Name of the vessel. | 
| mmsi | int | Maritime Mobile Service Identity. | 
| imo | int | International Maritime Organization number (if available). | 
| vtype | int | Vessel type group code according to References | 
| lat | real | Latitude in decimal degrees. | 
| lng | real | Longitude in decimal degrees. | 
| course | real | Course in degrees. | 
| speed | real | Speed in knots. | 
| nav_status | text | Navigation status according to AIS Specification | 
| received | datetime | UTC timestamp when the position was received. | 
Includes all simple fields plus:
| Field | Type | Description | 
|---|---|---|
| callsign | text | Vessel's callsign. | 
| vessel_type | text | Readable description of the vessel type. | 
| ais_type | int | AIS Ship Type according to AIS Specification | 
| size_a | int | Length from GPS antenna to the bow (meters). | 
| size_b | int | Length from GPS antenna to the stern (meters). | 
| size_c | int | Distance from GPS antenna to the port side (meters). | 
| size_d | int | Distance from GPS antenna to the starboard side (meters). | 
| draught | real | Current draught (meters) of the vessel. | 
| flag | text | Country flag code. | 
| flag_mid | text | Maritime flag identifier. | 
| gt | int | Gross Tonnage (if available). | 
| dwt | int | Deadweight (if available). | 
| built | int | Year the vessel was built (if available). | 
| destination | text | Reported destination. | 
| eta | datetime | Estimated Time of Arrival (UTC). | 
| current_port | text | Current port name (if available). | 
| current_port_id | int | Current port identifier. | 
| current_port_unloco | text | Current port UN/LOCODE. | 
| current_port_country | text | Country of the current port. | 
| current_port_arr_utc | datetime | Arrival time at current port (UTC). | 
| current_port_arr_local | datetime | Arrival time at current port (local time). | 
| last_port | text | Last port visited. | 
| last_port_id | int | Last port identifier. | 
| last_port_unloco | text | Last port UN/LOCODE. | 
| last_port_country | text | Country of the last port. | 
| last_port_dep_utc | datetime | Departure time from last port (UTC). | 
| last_port_dep_local | datetime | Departure time from last port (local time). | 
| next_port | text | Next port name. | 
| next_port_id | int | Next port identifier. | 
| next_port_unloco | text | Next port UN/LOCODE. | 
| next_port_country | text | Country of the next port. | 
| next_port_eta_utc | datetime | ETA at next port (UTC). | 
| next_port_eta_local | datetime | ETA at next port (local time). | 
| avg_sog | real | Average speed over ground. | 
| max_sog | real | Maximum speed over ground. | 
| distance_covered | real | Distance covered (nautical miles). | 
| wind_knots | real | Wind speed (knots). | 
| wind_direction | text | Wind direction. | 
| humidity | real | Humidity percentage. | 
| pressure | real | Atmospheric pressure. | 
| temperature | real | Temperature in Celsius. | 
| visibility | int | Visibility in meters. | 
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.018958738",
    "timestamp": "2025-10-31T22:32:24.011Z",
    "data": [
        {
            "distance": 1.44,
            "bearing": 138,
            "vessel_name": "EMINE ANNE",
            "mmsi": 577397000,
            "imo": 9145360,
            "vtype": 7,
            "lat": 37.06947,
            "lng": 25.34222,
            "course": 336,
            "speed": 0.2,
            "nav_status": 1,
            "received": "2025-10-31T08:13:58Z"
        },
        {
            "distance": 1.52,
            "bearing": 156,
            "vessel_name": "KYRIARXOS III",
            "mmsi": 239855200,
            "imo": null,
            "vtype": 6,
            "lat": 37.06407,
            "lng": 25.33493,
            "course": 71.5,
            "speed": 17.3,
            "nav_status": 0,
            "received": "2025-10-31T07:32:45Z"
        },
        {
            "distance": 3.61,
            "bearing": 5,
            "vessel_name": "BLUE STAR NAXOS",
            "mmsi": 239923000,
            "imo": 9241786,
            "vtype": 6,
            "lat": 37.14715,
            "lng": 25.32885,
            "course": 324.4,
            "speed": 21.1,
            "nav_status": 0,
            "received": "2025-10-31T11:18:41Z"
        }
    ]
}{
    "status": "error",
    "duration": "0.002345678",
    "timestamp": "2025-10-31T22:35:00.000Z",
    "code": "MST_ERR_VALIDATOR",
    "message": "Radius must be at least 1."
}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 out-of-range values). | 
| ERR_INVALID_IDENTIFIER | 400 | Required parameter(s) missing or invalid. For this endpoint, only mmsiandradiusmust be provided. | 
| 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_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_VESSEL_NOT_FOUND | 404 | The reference vessel was not found. | 
| ERR_OUT_OF_RANGE | 400 | The reference vessel is out of coverage. | 
| ERR_RATE_LIMIT | 429 | The request rate limit has been exceeded. | 
| ERR_INTERNAL | 500 | An internal server error occurred. | 
<?php
$apiKey = "YOUR_API_KEY";
$mmsi   = "241087000";
$radius = "1"; // in nautical miles
$url    = "https://api.myshiptracking.com/api/v2/vessel/nearby?mmsi={$mmsi}&radius={$radius}";
// For extended response, append: &response=extended
// $url = "https://api.myshiptracking.com/api/v2/vessel/nearby?mmsi={$mmsi}&radius={$radius}&response=extended";
$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 -X GET "https://api.myshiptracking.com/api/v2/vessel/nearby?mmsi=241087000&radius=1" \
  -H "Authorization: Bearer YOUR_API_KEY"
# For extended response, add: &response=extendedimport requests
api_key = "YOUR_API_KEY"
mmsi    = "241087000"
radius  = "1"  # in nautical miles
url     = f"https://api.myshiptracking.com/api/v2/vessel/nearby?mmsi={mmsi}&radius={radius}"
# For extended response, append: &response=extended
# url = f"https://api.myshiptracking.com/api/v2/vessel/nearby?mmsi={mmsi}&radius={radius}&response=extended"
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 mmsi   = "241087000";
const radius = "1"; // in nautical miles
let url    = `https://api.myshiptracking.com/api/v2/vessel/nearby?mmsi=${mmsi}&radius=${radius}`;
// For extended response, append: &response=extended
// url = `https://api.myshiptracking.com/api/v2/vessel/nearby?mmsi=${mmsi}&radius=${radius}&response=extended`;
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 VesselNearbyExample {
    public static void main(String[] args) {
        try {
            String apiKey = "YOUR_API_KEY";
            String mmsi   = "241087000";
            String radius = "1"; // in nautical miles
            String urlString = "https://api.myshiptracking.com/api/v2/vessel/nearby?mmsi=" + mmsi + "&radius=" + radius;
            // For extended response, append: &response=extended
            // urlString += "&response=extended";
            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 VesselNearbyExample {
    static async Task Main() {
        string apiKey = "YOUR_API_KEY";
        string mmsi   = "241087000";
        string radius = "1"; // in nautical miles
        string url    = $"https://api.myshiptracking.com/api/v2/vessel/nearby?mmsi={mmsi}&radius={radius}";
        // For extended response, append: &response=extended
        // url += "&response=extended";
        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"
mmsi    = "241087000"
radius  = "1"  # in nautical miles
uri     = URI("https://api.myshiptracking.com/api/v2/vessel/nearby?mmsi=#{mmsi}&radius=#{radius}")
# For extended response, use:
# uri = URI("https://api.myshiptracking.com/api/v2/vessel/nearby?mmsi=#{mmsi}&radius=#{radius}&response=extended")
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...