API to Track a Yacht

API to Track a Yacht

You need a reliable way to track a yacht in real time, pull recent positions, see the active route and ETA, and pivot to nearby traffic and ports when plans change. By the end of this guide you’ll wire up a production-ready yacht tracker using vessels-api.com: search a yacht, stream live AIS positions and 48–168 hour history, display route and ETA, and enrich your UI with nearby vessel context and port activity.

Why developers use vessels-api.com for yacht tracking

vessels-api.com exposes a single, consistent REST surface for global AIS data. You get:

Illustration: API to Track a Yacht
  • 18 REST endpoints for search, live tracking, fleet ops, port intelligence, CII emissions, and a premium real-time AIS feed.
  • One API key, one base URL, X-API-Key header. No OAuth or per-endpoint auth differences.
  • Every response uses the same JSON envelope: {status, success, message, data}.
  • Near real-time global coverage. Scales from indie dashboards to enterprise fleet ops.
  • Developer targets: yacht owners/operators, logistics startups, fleet managers, port ops, ESG/compliance teams.

Base URL: https://vessels-api.com/api/V1 | Auth header: X-API-Key: YOUR_API_KEY

Core endpoints to track a yacht

For yachts, these endpoints cover the end-to-end flow:

  • GET /vessels/search — find the yacht by name, IMO, or MMSI.
  • GET /vessels/track — live AIS position, up to 168h of history, active route, predicted ETA, and weather (when available).
  • GET /vessels/nearby — situational awareness around the yacht.
  • POST /vessels/fleet — batch metrics when you manage multiple yachts/tenders.
  • GET /vessels/green — optional CII scoring for ESG-conscious operations.

1) Find the yacht: GET /vessels/search

Resolve your target to an IMO or MMSI. Fuzzy name matching helps when you only know a partial name.

curl -H "X-API-Key: YOUR_API_KEY" "https://vessels-api.com/api/V1/vessels/track?mmsi=258785000&hours=48"

JSON response (truncated for clarity):

{
"status": 200,
"success": true,
"message": "OK",
"data": {
"vessel": {
"imo": "9122556",
"mmsi": "258785000",
"name": null
},
"current_position": {
"latitude": 53.33708,
"longitude": 7.17993,
"speed_knots": 0,
"course_degrees": 212,
"heading_degrees": null,
"navigational_status": 5,
"timestamp_utc": "2017-01-24T04:07:00+00:00",
"age_minutes": 5114721,
"destination": null,
"eta": null
},
"predicted_eta": null,
"position_history": [],
"route": {
"departure_port": "HERACLIO",
"departure_time": "2026-04-27T21:35:36+00:00",
"destination_port": "HERACLIO",
"eta": "2026-04-30T09:00:00+00:00",
"distance_nm": null,
"avg_speed_knots": 17.1
},
"last_port_visits": [
{
"port_id": "156",
"port_name": "EMDEN",
"arrival_time": "2026-07-30T13:00:10+00:00",
"departure_time": null,
"duration_hours": null
},
{
"port_id": "10",
"port_name": "HERACLIO",
"arrival_time": "2026-04-20T12:00:00+00:00",
"departure_time": "2026-04-23T08:00:00+00:00",
"duration_hours": 68
}
],
"weather": null
}
}

Key fields you’ll actually use:

  • imo/mmsi — identifiers to pass into tracking endpoints.
  • name, flag, vessel_type — display context in your UI.
  • length_m/width_m — for marina/berth suitability checks.

2) Live yacht tracking with route and ETA: GET /vessels/track

Use MMSI or IMO. Add hours to expand history up to 168 hours. You can also request optional route, predicted ETA, and weather.

Official sample — copy/paste this request exactly (documented MMSI 258785000, 48h history):

Official JSON (verbatim) — note the standard envelope and core fields:

How to use these fields in a yacht tracker:

  • current_position.latitude/longitude — map marker for the yacht (WGS84). Timestamp is UTC ISO8601.
  • speed_knots, course_degrees, heading_degrees — movement and orientation.
  • route.departure_port/destination_port/eta — voyage context for itinerary views.
  • last_port_visits — recent port calls; useful for compliance and logistics history.

Notes:

  • Timestamps are in UTC. Display local time by transforming with the viewer’s TZ.
  • Position history is bounded by hours (default 24, max 168).
  • Navigational status is an integer AIS code; map it to UI labels as needed.

3) Nearby traffic around the yacht: GET /vessels/nearby

For collision awareness or tender rendezvous, query all AIS targets within a radius (NM) around the yacht.

Sample JSON (truncated):

Use cases:

  • Draw proximity rings around the yacht; color nearby vessels by speed/navigational status.
  • Filter by ship_type=Yacht to find neighboring leisure vessels; omit to include ferries/cargo/traffic control.

4) Manage multiple yachts and tenders: POST /vessels/fleet

Query a set of MMSI/IMO identifiers in one request to power a dashboard or mobile list view.

Sample JSON (truncated):

This allows you to compute per-fleet “at sea vs in port” state and render cards without N sequential calls.

5) Optional compliance: GET /vessels/green

For larger yachts reporting ESG metrics, query estimated CO₂ and CII rating over rolling windows.

Sample JSON (truncated):

Display distance_nm and co2_per_nm on a compliance card; archive monthly snapshots for audits.

Python quickstart: track a yacht with route and ETA

This example calls the official tracking sample (MMSI 258785000, 48h) and extracts position, route, and ETA.

import requests
from datetime import datetime

API_KEY = "YOUR_API_KEY"
BASE_URL = "https://vessels-api.com/api/V1"

def track_yacht(mmsi: str, hours: int = 48):
url = f"{BASE_URL}/vessels/track"
params = {"mmsi": mmsi, "hours": hours}
r = requests.get(url, headers={"X-API-Key": API_KEY}, params=params, timeout=20)
r.raise_for_status()
payload = r.json() # envelope: {status, success, message, data}
if not payload.get("success"):
raise RuntimeError(payload.get("message", "Unknown error"))
data = payload["data"]
pos = data.get("current_position") or {}
route = data.get("route") or {}
return {
"mmsi": data.get("vessel", {}).get("mmsi"),
"latitude": pos.get("latitude"),
"longitude": pos.get("longitude"),
"speed_knots": pos.get("speed_knots"),
"course_degrees": pos.get("course_degrees"),
"timestamp_utc": pos.get("timestamp_utc"),
"destination_port": route.get("destination_port"),
"eta_utc": route.get("eta"),
}

if __name__ == "__main__":
info = track_yacht("258785000", hours=48)
print("MMSI:", info["mmsi"])
print("Position:", info["latitude"], info["longitude"])
print("Speed (kn):", info["speed_knots"], "Course:", info["course_degrees"])
print("Timestamp (UTC):", info["timestamp_utc"])
print("Destination:", info["destination_port"], "ETA (UTC):", info["eta_utc"])

Implementation notes:

  • Timeouts: set a client timeout (e.g., 20s) to avoid hanging calls in mobile or serverless contexts.
  • Envelope: always check success and status before using data.
  • Units: positions are degrees (WGS84), distances are nautical miles (nm), speeds are knots, timestamps are UTC.

JavaScript example: search and then track

Resolve a yacht by name, then track it. This pattern supports “type-ahead search → live view.”

const API_KEY = "YOUR_API_KEY";
const BASE_URL = "https://vessels-api.com/api/V1";

async function searchYacht(query) {
const url = new URL(`${BASE_URL}/vessels/search`);
url.searchParams.set("query", query);
url.searchParams.set("ship_type", "Yacht");
url.searchParams.set("per_page", "5");

const r = await fetch(url.toString(), { headers: { "X-API-Key": API_KEY } });
if (!r.ok) throw new Error(`Search failed: ${r.status}`);
const payload = await r.json();
if (!payload.success) throw new Error(payload.message || "Search error");
return payload.data.vessels;
}

async function trackByMmsi(mmsi, hours = 24) {
const url = new URL(`${BASE_URL}/vessels/track`);
url.searchParams.set("mmsi", mmsi);
url.searchParams.set("hours", String(hours));

const r = await fetch(url.toString(), { headers: { "X-API-Key": API_KEY } });
if (!r.ok) throw new Error(`Track failed: ${r.status}`);
const payload = await r.json();
if (!payload.success) throw new Error(payload.message || "Track error");
return payload.data;
}

(async () => {
const candidates = await searchYacht("Serene");
if (!candidates.length) {
console.log("No results"); return;
}
const yacht = candidates[0];
const track = await trackByMmsi(yacht.mmsi, 48);
console.log("Yacht:", yacht.name, "MMSI:", yacht.mmsi);
console.log("Current position:", track.current_position);
console.log("Route:", track.route);
})();

Port-aware yacht operations

When guests embark at a specific port, enrich the itinerary with port data and expected arrivals. These endpoints keep the UI grounded in port ops:

  • GET /ports — list of 248 ports, with coordinates and timezone for date-localization.
  • GET /ports/data — live vessel counts for a single port.
  • GET /port/expected-arrivals — inbound traffic including ETA and origin.

Example: fetch the global port catalog for a port picker.

Sample JSON (truncated):

Use timezone to render local ETAs, and coordinates to compute approach distances from the yacht’s current_position.

Designing your yacht tracking UI

Translate API fields into an operator-friendly layout:

  • Map view: pin from current_position.lat/lon; draw recent track using position_history.
  • Itinerary pane: destination_port and route.eta for guest-facing ETAs (UTC → local TZ).
  • Nearby widget: GET /vessels/nearby to show the 10 closest targets; color by speed_knots.
  • Fleet header: POST /vessels/fleet to compute total/at-sea/in-port KPIs.
  • ESG card: GET /vessels/green with distance_nm and cii.rating.

Operational tips that save time

  • Polling cadence: many yacht UIs work well at 30–60s refresh for /vessels/track.
  • Caching: cache /vessels/search results for 15–60 minutes; particulars rarely change.
  • Pagination: /vessels/search supports page and per_page (max 100). Always read pagination.last_page.
  • Geodesy: treat degrees as WGS84; compute distances in nautical miles when comparing with distance_nm.
  • Errors: check the envelope; handle 401 (missing/invalid key), 404 (not found), 422 (parameter out of range), 429 (rate limit), 500 (server error).

Security and tooling

  • Keep X-API-Key server-side when possible; if using browser calls, proxy requests via your backend.
  • Use the MCP console for quick endpoint trials and schema exploration: MCP.
  • Reference the full parameter list and field definitions: Documentation.

FAQ

What identifiers should I prefer for yachts: IMO or MMSI?
Use MMSI for live AIS tracking when available; use IMO for stable identity across registry changes. The tracking endpoint accepts either.

How far back can I request position history?
Up to 168 hours via the hours parameter on /vessels/track. The default is 24 hours.

Are timestamps in local time?
All timestamps are UTC ISO8601. Use /ports and /ports/data timezones to localize for user display.

How do I reduce API calls for a fleet of yachts and tenders?
Batch with POST /vessels/fleet and set include_positions and include_routes to true. This collapses N lookups into one response.

Can I filter nearby traffic to only show leisure craft?
Yes. Pass ship_type=Yacht to GET /vessels/nearby to limit the set to yachts.

Build your yacht tracker

Spin up your integration with one API key, one base URL, and consistent JSON across endpoints. Start with /vessels/search to resolve targets, wire /vessels/track for live state and ETA, add /vessels/nearby for situational awareness, and scale to a fleet with /vessels/fleet. Get started here: Register. Explore full schemas and parameters in the Documentation, and try live requests in the MCP.

Ready to get started?

Get your API key and start tracking vessels in minutes.

Get API Key

Related posts