Skip to content

JoxMarkes/vindecodervehicle-node-sdk

Repository files navigation

VIN Decoder Vehicle — Node.js SDK

CI npm License: MIT

Official Node.js SDK for the VIN Decoder Vehicle API.

Features

  • TypeScript with full type definitions
  • Zero runtime dependencies
  • Native fetch (Node.js 18+)
  • ESM-first
  • All API endpoints supported

Installation

npm install @vindecodervehicle/sdk

Quick Start

import { VinDecoderClient, getVehicleFullName } from '@vindecodervehicle/sdk';

const client = VinDecoderClient.create('YOUR_USER', 'YOUR_API_KEY');

const vehicle = await client.decodeVin('WF0GXXGAJ69C71882');
console.log(getVehicleFullName(vehicle)); // BMW 3 Coupe (E92) 316 i
console.log(vehicle.make);              // BMW
console.log(vehicle.carId);             // 55565

API Reference

VIN

const vehicle = await client.decodeVin('WF0GXXGAJ69C71882');
const vehicles = await client.decodeVinAll('WF0GXXGAJ69C71882');
const engines = await client.getEngines('WF0GXXGAJ69C71882');

Vehicle by carId

const vehicle = await client.getVehicle(55565);
const fluids = await client.getFluidCapacities(55565);
const parts = await client.getOemParts(55565);
const repairs = await client.getRepairTimes(55565);

Catalog

const brands = await client.listBrands();
const models = await client.listModels('bmw');
const variants = await client.listVariants('bmw', '3-series');

Error Handling

import {
  ApiError,
  AuthenticationError,
  InvalidArgumentError,
} from '@vindecodervehicle/sdk';

try {
  await client.decodeVin('INVALID');
} catch (error) {
  if (error instanceof InvalidArgumentError) { /* invalid VIN */ }
  if (error instanceof AuthenticationError) { /* bad credentials */ }
  if (error instanceof ApiError) {
    console.log(error.statusCode, error.responseBody);
  }
}

Links

License

MIT