Legacy v1

Corgi VIN Decoder

Last updated:

Fast, offline VIN decoding for Node.js, browsers, and Cloudflare Workers. Community-extensible patterns.

Docs for the previous API generation. v1 endpoints keep working, but new work should target v2. See v2 VIN guide.

Corgi is Cardog's open-source VIN decoder. It is fast, runs offline, and accepts community-contributed patterns.

Quick Start

npm install @cardog/corgi

Community Patterns

Corgi's base patterns cover US-market vehicles and miss many international manufacturers. Community patterns let anyone contribute VIN decoding rules for WMIs the base does not cover.

How It Works

  1. Create a YAML file defining the WMI and its patterns
  2. Add test VINs with expected decode results
  3. Submit a PR. CI validates the patterns
  4. On release, patterns merge into the published database

Example Pattern

wmi: XP7
manufacturer: Tesla
make: Tesla
country: Germany
vehicle_type: Passenger Car
years:
  from: 2022
  to: null

patterns:
  - pattern: "Y*****"
    element: Model
    value: Model Y
  - pattern: "*D****"
    element: Drive Type
    value: All-Wheel Drive

test_vins:
  - vin: XP7YGCED3PB000001
    expected:
      make: Tesla
      model: Model Y

Current Community Patterns

WMIManufacturerRegionModels
LRWTesla ShanghaiChinaModel 3, Model Y
XP7Tesla BerlinGermanyModel Y

Contributing

Contributions are needed for:

  • Chinese EVs: BYD, NIO, XPeng, Li Auto
  • European variants: market-specific WMIs
  • JDM vehicles: Japan-only models

See the contribution guide for full documentation.

Corgi vs Cardog API

FeatureCorgi (OSS)Cardog API
VIN DecodingBasic specsFull vehicle data
OfflineYesNo
Market ValuesNoYes
RecallsNoYes
ListingsNoYes
PriceFreeUsage-based

Use Corgi for VIN validation and basic decoding. Use the Cardog API for full vehicle data.

Platform Support

  • Node.js: native SQLite with better-sqlite3
  • Browser: sql.js with gzipped database fetch
  • Cloudflare Workers: D1 database adapter
  • CLI: npx @cardog/corgi decode <VIN>

Was this helpful?