GET /v1/port/NLRTM returned the record for Rotterdam on 28 November 2026. The UN/LOCODE is the fastest way to a port, but 12.3% of the 1,014 port records we requested for six European countries have no UN/LOCODE at all. Those records can only be found by name, by country or by position.
We ran 112 requests against the live API between 18:44 and 18:50 UTC that evening. The sample covers every port record for the Netherlands, Belgium, Germany, Portugal, Spain and Denmark.
One port by its UN/LOCODE
The path parameter is the five-character code. Case does not matter: nlrtm returned the same record as NLRTM.
curl -s "https://api.vesselapi.com/v1/port/NLRTM" \ -H "Authorization: Bearer $VESSELAPI_API_KEY" { "port": { "unlo_code": "NLRTM", "name": "ROTTERDAM", "country": {"code": "NL", "name": "Netherlands"}, "type": "Port", "size": "Large" } } The full response has 28 of the schema's 39 fields filled for Rotterdam, and the sample above is trimmed. An unknown code returns HTTP 404 with "code": "resource_missing". Code that takes UN/LOCODEs from user input should fall back to a name search.
Each record has a single reference point. For a port area the size of Rotterdam's, that point can be many kilometres from some of its terminals, so use the radius query below to find the terminal records.
Searching by name or by country
GET /v1/search/ports takes filter.name, filter.country, filter.type and filter.size, among others. The name filter matches whole words without regard to case:
filter.name | Records | Countries |
|---|---|---|
| PORTLAND | 6 | US 3, GB 2, AU 1 |
| NEWPORT | 8 | US 5, GB 2, AU 1 |
| ROTTERDAM | 8 | NL 8 |
| VICTORIA | 4 | CA 2, SC 1, AU 1 |
| ROTTERD | 0 | |
| LISBON | 0 | |
| LISBOA | 1 | PT 1 |
Part of a word returns nothing. Many names are in the local form, so LISBON finds nothing and LISBOA finds Lisbon. Several of the ROTTERDAM records cover parts of the same port area, and not all of them have a UN/LOCODE. A port picker built on this endpoint should show the country and the code next to each name, because six records matching Portland in three countries look identical in a dropdown.
filter.country accepts the ISO code or the English name: NL and Netherlands returned the same records. Repeating the parameter combines countries, and NL plus BE returned the records of both with none repeated. Results page at 50 records, with a nextToken until the last page.
Ports within a radius or a box
GET /v1/location/ports/radius takes a centre point and filter.radius in metres. From Rotterdam's city centre (51.9225 N, 4.4792 E):
| Radius | Records | Requests |
|---|---|---|
| 5 km | 2 | 1 |
| 20 km | 34 | 1 |
| 50 km | 129 | 3 |
| 100 km | 248 | 5 |
| 100.001 km | HTTP 400 | 1 |
The cap is 100,000 m, and one metre over it returns invalid radius: must not exceed 100000 meters (100 km). The results are not ordered by distance. In the 50 km query the first record was 49.1 km away, and the nearest, at 2.5 km, came last of 129. Sort the records yourself. With the Python SDK (pip install vessel-api-python, tested with version 2.1.2), the iterator follows the pages:
import math, os from vessel_api_python import VesselClient client = VesselClient(api_key=os.environ["VESSELAPI_API_KEY"]) def km(lat1, lon1, lat2, lon2): p1, p2 = math.radians(lat1), math.radians(lat2) a = (math.sin((p2 - p1) / 2) ** 2 + math.cos(p1) * math.cos(p2) * math.sin(math.radians(lon2 - lon1) / 2) ** 2) return 12742 * math.asin(math.sqrt(a)) lat, lon = 51.9225, 4.4792 # Rotterdam city centre ports = list(client.location.all_ports_radius( latitude=lat, longitude=lon, radius=20000, pagination_limit=50)) ports.sort(key=lambda p: km(lat, lon, p.latitude, p.longitude)) for p in ports[:4]: print(p.unlo_code, round(km(lat, lon, p.latitude, p.longitude), 1), "km") # None 2.5 km # None 2.9 km # NLWAL 5.3 km # NLSCI 5.9 km The two nearest records have no UN/LOCODE, so code that stores the nearest port by its code has to handle None.
GET /v1/location/ports/bounding-box takes filter.latBottom, filter.latTop, filter.lonLeft and filter.lonRight. The limit is on the sum of the two spans: |dLat| + |dLon| must not exceed 4 degrees. A box of 1.5 degrees of latitude by 2.5 of longitude from 51 N, 3 E passed and returned 217 ports in 5 pages. At that latitude it covers about 167 km by 172 km. Widening the longitude to 2.51 degrees returned HTTP 400. lonRight has to be greater than lonLeft, so an area that crosses the 180th meridian takes two requests.
How much of a port record is filled in
The record schema has 39 fields, including depths. Across the 1,014 records from the six countries:
| Field | Filled |
|---|---|
name, latitude, longitude, size | 100% |
type | 96.4% |
unlo_code | 87.7% |
Depths are filled for some ports and not others. A missing depth means the depth is unknown, and a fit check should treat it differently from a shallow one.
A large port area is split across several records, and each carries its own depths, so two parts of the same port can differ. A draught check against Rotterdam should look at the terminal records found by the radius query, not only at NLRTM. Use a recorded depth as a first filter, and confirm the limits for the berth with the port before planning a call.
From a port to the ships calling at it
GET /v1/port/NLRTM/inbound returned a first page of 50 vessels due in the next 72 hours, with a nextToken for the rest. Each entry carries the vessel's reported destination and ETA. GET /v1/portevents/port/NLRTM returned 36 port events from the last 2 hours.
Both endpoints take the UN/LOCODE in the path, so a record without one cannot be used for port event or ETA queries. Use the code of the main port record instead, which the name or radius search will find. The parameters for all of these endpoints are in the ports API documentation, and the vessel side is in the vessel database API.
