DEV Community

VesselAPI
VesselAPI

Posted on • Originally published at vesselapi.com

What an MMSI Lookup Actually Looks Up

A ship has a name, and a name is a fragile thing. Maersk Detroit could be sold tomorrow and become Ocean Star. Ocean Star could be re-flagged, repainted, renamed again, and resurface six months later moving sanctioned crude in the South China Sea. Names lie. Flags lie. Even the hull, given a coat of paint and a torch to the bow numbers, can be made to lie.

A ship's bridge and antennas silhouetted at golden hour

What doesn't lie — or at least, lies less often — is a nine-digit number broadcast by the ship's radio at intervals ranging from every couple of seconds when underway to every few minutes at anchor. That number is the MMSI. And when you build an "MMSI lookup," what you are really doing is asking a deceptively hard question: given this number, who is this, right now, today?

The first time I queried an MMSI on a vessel I was actively tracking and got back a tanker that had been scrapped in 2019, I assumed the API was broken. It wasn't. The MMSI had been reassigned. That was a fun afternoon.

The number itself

MMSI stands for Maritime Mobile Service Identity. It is, on the surface, exactly what it sounds like: a unique radio identifier assigned to a vessel (or a coast station, or a navigational aid, or a life raft's distress beacon) so that other radios can address it. Nine digits. Broadcast in every AIS message the ship transmits. If you've ever seen a live map of ocean traffic — those flickering arrows crawling across the Mediterranean — every one of those arrows is, at the wire level, an MMSI.

The first three digits are called the MID, the Maritime Identification Digits, and they encode the country whose flag the vessel sails under. 232 through 235 are the United Kingdom. 338 and 366 through 369 are the United States. 477 is Hong Kong. The remaining six digits are assigned by that country's licensing authority, more or less however they like.

So already, before you've looked anything up, an MMSI tells you something. 538 at the front? That's the Marshall Islands — one of the world's largest open registries and a dominant flag of convenience for tanker operators, for reasons that have very little to do with the Marshall Islands. 412 at the front? Mainland China. The number is a passport, sort of.

But here is the first uncomfortable truth: MMSIs are not permanent. When a vessel changes flag, it gets a new MMSI. When it's sold to an operator in a different jurisdiction, new MMSI. When a transponder is replaced and the new one is misconfigured — which happens more often than the industry likes to admit — the MMSI can change with no paperwork at all. Sometimes two vessels broadcast the same MMSI by accident. Sometimes, less innocently, on purpose.

So a lookup isn't a dictionary read. It's a forensic question.

Close-up of a ship hull with painted-over lettering

What a lookup is actually doing

When you call something like GET /vessel/{mmsi} on a vessel data API, here's what's happening behind that single line of HTTP.

First, the system has to find every record that has ever been associated with that MMSI. That sounds trivial; it isn't. The same nine digits, over the course of a decade, might point to two or three completely different ships. Good lookup services maintain a temporal index — in practice, an append-only event log keyed on (mmsi, valid_from, valid_to, vessel_id) that you can query at a point in time. Not just what is MMSI 477123456? but what was MMSI 477123456 on the afternoon of 14 March 2021?

Second, it has to resolve to the ship's more durable identifiers. The MMSI is the radio identity; the IMO number is the hull identity. The IMO ship identification scheme is mandated by the International Maritime Organization and administered by its authorized registrar (currently S&P Global, formerly IHS Markit, formerly Lloyd's Register Fairplay — the genealogy itself tells you something about how this industry works). The IMO number is intended to follow the steel of the ship from cradle to scrapyard, regardless of how many times it changes name or flag. In practice, vessels not engaged on international voyages — and most fishing boats and inland barges — don't have IMO numbers at all, and some operators of larger vessels have been known to broadcast incorrect ones. But when an MMSI and an IMO agree, and have agreed for years, you have something close to ground truth.

Third, it has to enrich. This is the layer most people don't think about until they need it. Beyond identity: dimensions, deadweight tonnage, year and place of build, class society, last known position, last known port call, whether the vessel appears on a sanctions list under any of its previous names. And ownership — which is its own swamp. Current operator, registered owner, and beneficial owner are three different entities, often deliberately so. AIS doesn't carry any of them. Knowing who actually owns a ship requires an entirely different lookup chain, and the answer is frequently a shell company in a jurisdiction that does not enjoy being asked.

A "lookup" that returns only the name and flag is barely a lookup. It's the cover of a book.

The dark inputs

Here's the part that makes this genuinely difficult. AIS — the Automatic Identification System that carries the MMSI — was developed through the 1990s as a vessel traffic management and collision-avoidance system, ratified under SOLAS in the early 2000s. It assumed everyone was honest, because the original users were port authorities and bridge officers, and in a collision scenario, dishonesty kills you first. The lack of any authentication layer was a deliberate architectural choice for low-cost receiver compatibility — but the upshot is the same: AIS is a network of unsigned messages from strangers, and that assumption no longer holds.

Vessels engaged in sanctions evasion routinely spoof their MMSI, broadcasting a number that belongs to a different ship — or to no ship at all. They go dark, switching off their transponder entirely for days or weeks. And in cases documented in OFAC advisories and UN Panel of Experts reports on Iran and North Korea sanctions, they meet other vessels in unmonitored waters and conduct ship-to-ship transfers: the dirty cargo physically moves to a clean ship, sometimes while one or both vessels broadcast another ship's identity entirely. The MMSI doesn't literally swap. The cargo does, and the electronic identity is manipulated to obscure who carried what.

A naive MMSI lookup — the kind that just returns whatever the latest AIS broadcast claims — will happily report back the spoofed identity as fact. A serious lookup cross-references the broadcast against fleet registries, historical position tracks, hull dimensions detected by satellite synthetic aperture radar, and port arrival records. When the AIS says "I am a 180-meter bulk carrier" and the satellite radar says "you are a 250-meter tanker," the lookup is supposed to notice.

A crowded anchorage seen from above at twilight

Building one that doesn't lie to you

There are a lot of "vessel lookup" APIs in the world. Most of them are a thin wrapper around the most recent AIS broadcast, which is to say, most of them will cheerfully repeat whatever a transponder told them six minutes ago, with no provenance and no sense of history. That's fine for drawing dots on a map. It is not fine for any decision with consequences.

The two things I actually care about, when evaluating one of these services, are time and provenance.

Time, because an MMSI is a moving target. If the API can't tell you what an MMSI meant on a specific date, it cannot help you with a sanctions investigation, an insurance claim, or any question about the past. The phrase "this MMSI belonged to a different vessel last year" should be a normal sentence in its response, not a footnote.

Provenance, because "vessel name: ATLANTIC PIONEER" means very different things depending on where that string came from. A name pulled from the IHS/S&P registry against a confirmed IMO number is near-truth. The same name pulled from a single AIS broadcast forty minutes ago, with no IMO cross-check and no historical confirmation, is a rumour. A lookup that doesn't distinguish between these two cases is, frankly, lying to you politely.

And then there's the question of whether the API has actually thought about the long tail. Most fail there — because the small fishing boats with no IMO, the inland river barges with regional MMSI quirks, the AIS aids-to-navigation with the 111 prefix, the AIS-SART distress beacons in the 970 range — none of these things show up in the sales demo. They show up at three in the morning when your pipeline throws a null pointer and a container ship somewhere is unaccounted for.

The nine digits look like a phone number. They are not a phone number. They are a thread — and pulling on a thread is how you find out what's actually on the other end of the line. In this case: forty years of flag-state politics, satellite coverage gaps, and ships that, very specifically, do not want to be found.

Top comments (0)