The carsxe-api package is the official CarsXE client for Node.js and TypeScript.
Installation
npm install carsxe-api
# yarn add carsxe-api
# pnpm add carsxe-api
# bun add carsxe-apiQuick start
Decode a VIN
The client is constructed with your API key as a positional argument. Every method takes a params object and returns a Promise.
Methods
| Method | Params | Description |
|---|---|---|
specs(params) | { vin, deepdata?, disableIntVINDecoding? } | Decode a VIN into full vehicle specifications |
internationalVinDecoder(params) | { vin } | Decode a non-US international VIN |
marketvalue(params) | { vin, state?, mileage?, condition? } | Retail, trade-in, and auction value estimates |
history(params) | { vin } | Title events, salvage, and insurance records |
recalls(params) | { vin } | Open safety recalls by VIN |
lienAndTheft(params) | { vin } | Lien records and theft/salvage status |
platedecoder(params) | { plate, country, state?, district? } | Resolve a license plate to vehicle data |
images(params) | { make, model, year?, trim?, color?, angle?, photoType?, size?, transparent?, license? } | Vehicle photos by make, model, and year |
plateImageRecognition(params) | { imageUrl } | Extract plate info from an image URL |
vinOcr(params) | { imageUrl } | Extract VIN text from an image via OCR |
yearMakeModel(params) | { year, make, model, trim? } | Look up vehicles by year, make, and model |
obdcodesdecoder(params) | { code } | Decode an OBD-II diagnostic trouble code |
Error handling
Methods reject on failure. Wrap calls in try/catch:
import { CarsXE } from "carsxe-api";
const carsxe = new CarsXE("YOUR_API_KEY");
try {
const vehicle = await carsxe.specs({ vin: "WBAFR7C57CC811956" });
console.log(vehicle);
} catch (error) {
console.error("CarsXE error:", error);
}Best practices
Create one instance and reuse it. Construct the client once with your key and share it across your app instead of instantiating per request.
// lib/carsxe.ts
import { CarsXE } from "carsxe-api";
export const carsxe = new CarsXE(process.env.CARSXE_API_KEY as string);Store your key in an environment variable. Never hardcode it or commit it to source control.
# .env
CARSXE_API_KEY=your_key_hereTypeScript types are included. The package ships type declarations for every method's input (SpecsInput, MarketValueInput, PlateDecoderParams, and so on) — no @types package needed.
Official CarsXE SDK for Node.js and TypeScript.