<!-- Copyright (c) 2026 defconxt. All rights reserved. -->
<!-- Licensed under AGPL-3.0 — see LICENSE file for details. -->

# API Reference — Analyzing Shipping and Maritime Data

## MarineTraffic API

| Endpoint | Description |
|---|---|
| `GET /exportvesseltrack/v:2` | Historical vessel track |
| `GET /portcalls/v:4` | Port call history |
| `GET /vesselsearch/v:1` | Search vessels |
| `GET /shippingRoutes/v:2` | Shipping route data |

### Parameters

| Parameter | Format |
|---|---|
| `mmsi` | 9-digit MMSI number |
| `imo` | 7-digit IMO number |
| `fromdate` | YYYY-MM-DD |
| `todate` | YYYY-MM-DD |
| `protocol` | json, csv, xml |

## Equasis

| URL Pattern | Description |
|---|---|
| `/ShipInfo?fs=SearchShip&P_IMO=<imo>` | Ship details by IMO |
| Free registration required | Inspection and detention history |

## Global Fishing Watch API

| Endpoint | Description |
|---|---|
| `GET /v2/vessels/search?query=<name>` | Search vessels |
| `GET /v2/vessels/<id>/tracks` | Vessel track data |

## AIS Data Fields

| Field | Description |
|---|---|
| MMSI | 9-digit Maritime Mobile Service Identity |
| IMO | 7-digit International Maritime Organization number |
| SHIPNAME | Current vessel name |
| SHIPTYPE | Numeric type code (70=cargo, 80=tanker) |
| LAT / LON | Position coordinates |
| SPEED | Speed over ground (knots × 10) |
| COURSE | Course over ground (degrees × 10) |
| STATUS | Navigation status code |

## Agent Script

```bash
node agent.js vessel-track --mmsi 211234567 --start 2026-01-01 --end 2026-03-01
node agent.js vessel-lookup --imo 9876543
node agent.js ais-gaps --mmsi 211234567 --threshold 24
node agent.js port-calls --mmsi 211234567 --days 90
node agent.js sts-detect --mmsi 211234567 --radius 0.5
node agent.js --self-test
```
