DEV Community

Vin Lookup
Vin Lookup

Posted on

Combining WMI and Plant Code: A Two-Field Sanity Check for Marketplace Listings

A single VIN field can contradict a seller's story. Two cheap checks catch many mistakes: WMI (positions 1-3) and plant code (position 11).

Why both

WMI points at the manufacturer universe. Plant code is manufacturer-specific. Together they answer "does this VIN belong to the brand and factory story on the listing?"

Pipeline

  1. Normalize and validate length/charset/check digit.
  2. Decode via NHTSA vPIC.
  3. Compare Make/Manufacturer against listing claim.
  4. Surface PlantCity/PlantState when present.
  5. Soft-flag mismatches; never auto-ban on sparse fields alone.
type Flag = { code: string; message: string };

function sanityFlags(decoded: { Make?: string; PlantCity?: string }, claimMake: string): Flag[] {
  const flags: Flag[] = [];
  if (decoded.Make && claimMake && !decoded.Make.toLowerCase().includes(claimMake.toLowerCase())
      && !claimMake.toLowerCase().includes(decoded.Make.toLowerCase())) {
    flags.push({ code: "make_mismatch", message: "Listing make does not match NHTSA Make for this VIN." });
  }
  if (!decoded.PlantCity) {
    flags.push({ code: "plant_blank", message: "NHTSA returned no plant city; do not invent one." });
  }
  return flags;
}
Enter fullscreen mode Exit fullscreen mode

Buyer copy

Show flags as questions ("Ask the seller why..."), not accusations. Pair with a reminder that free decode is not a title/lien/odometer report.

I maintain VIN Lookup, a free VIN decode based on NHTSA data.

Top comments (0)