VIN Decoder Template
- Next.js
- TypeScript
Decode any VIN: make, model and year, open recalls, crash ratings and fuel economy.
A Next.js app that turns a vehicle identification number into a report. Enter a VIN to see the make, model, year and body, how many safety recalls are on record and how serious they are, the government crash rating and the fuel economy. Use it for a used car listing, a fleet tool or a dealership site, or lift the route to check every car in your inventory.

What it does
- The vehicle
- Make, model, year, body, type and manufacturer from any 17-character VIN; paid plans add the trim, engine and factory.
- Safety recalls
- The recall count with how many are high or critical, and a red warning when a recall says not to drive.
- Crash rating and MPG
- The government crash test rating and combined fuel economy; paid plans add frontal and rollover stars and city and highway MPG.
- Checked before it calls
- The route rejects anything that isn't 17 letters and digits without I, O or Q, so typos don't spend credits.
- Keeps your key private
- The browser only talks to your own API route, which holds the key, caches each VIN for a day and limits each visitor to 10 a minute.
How it works
The route: it checks the VIN, then calls VIN Decoder with recalls, safety and fuel economy switched on.
/** GET /api/vin?vin=1HGCM82633A004352: decodes a VIN and adds recalls, safety rating and fuel economy. */
export async function GET(request: Request) {
const vin = (new URL(request.url).searchParams.get('vin') || '').trim().toUpperCase();
// 17 characters, letters and digits, never I, O or Q (they look like 1 and 0).
if (!/^[A-HJ-NPR-Z0-9]{17}$/.test(vin)) return fail('A VIN is 17 letters and digits, without I, O or Q');
const key = `vin:${vin}`;
const hit = fromCache(key, TTL_MS);
if (hit) return Response.json(hit);
const blocked = guard(request);
if (blocked) return blocked;
return respond(async () => {
const data = await callApi('vindecoder', {
query: { vin, recalls: 'true', safetyRating: 'true', fuelEconomy: 'true' }
});
toCache(key, data);
return data;
});
}Deploy it
- Get a free API key
The free plan includes 200 credits a month, no card needed. Create your key.
- Deploy it
Click Deploy to Vercel. Vercel copies the repo to your GitHub account and asks for
APIVERVE_API_KEY: paste your key there. - Open your app
Vercel builds it and gives you a live URL, usually in about a minute. Every push to the repo redeploys it.
Try the VIN Decoder API — the call this template makes
No key required to try it. Get a key to use it in your app.
{
"status": "ok",
"error": null,
"data": {
"vin": "1HGCM82633A004352",
"valid": true,
"decoded": true,
"vehicleDescriptor": "1HGCM826*3A",
"make": "HONDA",
"model": "Accord",
"year": 2003,
"trim": "EX-V6",
"trim2": null,
"series": null,
"series2": null,
"manufacturer": "AMERICAN HONDA MOTOR CO., INC.",
"vehicleType": "PASSENGER CAR",
"bodyClass": "Coupe",
"plant": {
"country": "UNITED STATES (USA)",
"city": "MARYSVILLE",
"state": "OHIO"
},
"engine": {
"displacementL": "2.998832712",
"displacementCc": "2998.832712",
"engineNumberOfCylinders": "6",
"engineBrakeHpFrom": "240",
"displacementCi": "183",
"fuelTypePrimary": "Gasoline",
"valveTrainDesign": "Single Overhead Cam (SOHC)",
"engineModel": "J30A4",
"engineConfiguration": "V-Shaped"
},
"features": {
"exterior": {
"doors": "2",
"grossVehicleWeightRatingTo": "Class 1: 6,000 lb or less (2,722 kg or less)",
"grossVehicleWeightRatingFrom": "Class 1C: 4,001 - 5,000 lb (1,814 - 2,268 kg)"
},
"mechanical": {
"transmissionStyle": "Automatic",
"transmissionSpeeds": "5"
},
"passiveSafetySystem": {
"otherRestraintSystemInfo": "Seat Belt (Rr center position)",
"seatBeltType": "Manual",
"curtainAirBagLocations": "1st and 2nd Rows",
"sideAirBagLocations": "1st Row (Driver and Passenger)",
"frontAirBagLocations": "1st Row (Driver and Passenger)"
}
},
"validation": {
"errorText": "0 - VIN decoded clean. Check Digit (9th position) is correct",
"errorCode": "0",
"errorCodes": [
"0"
]
}
}
}