CarsXE Developer

Node.js Quickstart Guide

Get started with CarsXE's Node.js SDK to integrate comprehensive vehicle data into your JavaScript and TypeScript applications.


The CarsXE Node.js SDK provides a simple and powerful way to integrate vehicle data into your JavaScript and TypeScript applications. This guide will help you get started quickly.

For more information, see the package on npm.

Installation

Install the CarsXE Node.js package using npm or yarn:

npm install carsxe-api

or

yarn add carsxe-api

Setup

First, import the CarsXE client and initialize it with your API key:

decode.js

const { CarsXE } = require("carsxe-api");
// Initialize the client
const carsxe = new CarsXE("YOUR_API_KEY_HERE");

For TypeScript:

decode.ts

import { CarsXE } from "carsxe-api";
const carsxe = new CarsXE("YOUR_API_KEY_HERE");

Basic Usage

VIN Specifications

decode.js

const vin = 'WBAFR7C57CC811956';
carsxe
  .specs({ vin })
  .then((vehicle) => console.log(vehicle.input.vin))
  .catch((error) => console.error(error));

Or using async/await:

decode.js

async function decodeVIN() {
  try {
    const vehicle = await carsxe.specs({
      vin: 'WBAFR7C57CC811956'
    });
    console.log(vehicle.input.vin);
  } catch (error) {
    console.error("Error:", error);
  }
}
decodeVIN();

International VIN Decoder

decode.js

async function decodeInternationalVIN() {
  try {
    const intVin = await carsxe.internationalVinDecoder({
      vin: 'WF0MXXGBWM8R43240'
    });
    console.log(intVin);
  } catch (error) {
    console.error("Error:", error);
  }
}

Market Value

decode.js

async function getMarketValue() {
  try {
    const value = await carsxe.marketvalue({
      vin: 'WBAFR7C57CC811956'
    });
    console.log(value);
  } catch (error) {
    console.error("Error:", error);
  }
}

Vehicle History

decode.js

async function getVehicleHistory() {
  try {
    const history = await carsxe.history({
      vin: 'WBAFR7C57CC811956'
    });
    console.log(history);
  } catch (error) {
    console.error("Error:", error);
  }
}

License Plate Decoder

decode.js

async function decodePlate() {
  try {
    const plate = await carsxe.platedecoder({
      plate: '7XER187',
      state: 'CA',
      country: 'US'
    });
    console.log(plate);
  } catch (error) {
    console.error("Error:", error);
  }
}

Vehicle Images

decode.js

async function getVehicleImages() {
  try {
    const imgs = await carsxe.images({
      make: 'BMW',
      model: 'X5',
      year: '2019'
    });
    console.log(imgs);
  } catch (error) {
    console.error("Error:", error);
  }
}

Vehicle Recalls

decode.js

async function checkRecalls() {
  try {
    const recalls = await carsxe.recalls({
      vin: '1C4JJXR64PW696340'
    });
    console.log(recalls);
  } catch (error) {
    console.error("Error:", error);
  }
}

Plate Image Recognition

decode.js

async function recognizePlateFromImage() {
  try {
    const plateImg = await carsxe.plateImageRecognition({
      imageUrl: 'https://api.carsxe.com/img/apis/plate_recognition.JPG'
    });
    console.log(plateImg);
  } catch (error) {
    console.error("Error:", error);
  }
}

VIN OCR from Image

decode.js

async function extractVINFromImage() {
  try {
    const vinOcr = await carsxe.vinOcr({
      imageUrl: 'https://user-images.githubusercontent.com/5663423/30922082-64edb4fa-a3a8-11e7-873e-3fbcdce8ea3a.png'
    });
    console.log(vinOcr);
  } catch (error) {
    console.error("Error:", error);
  }
}

decode.js

async function searchByYearMakeModel() {
  try {
    const ymm = await carsxe.yearMakeModel({
      year: '2023',
      make: 'Toyota',
      model: 'Camry'
    });
    console.log(ymm);
  } catch (error) {
    console.error("Error:", error);
  }
}

OBD Code Decoder

decode.js

async function decodeOBDCode() {
  try {
    const obd = await carsxe.obdcodesdecoder({
      code: 'P0115'
    });
    console.log(obd);
  } catch (error) {
    console.error("Error:", error);
  }
}

Lien and Theft

decode.js

async function getLienAndTheft() {
  try {
    const lienTheft = await carsxe.lienAndTheft({
      vin: '2C3CDXFG1FH762860'
    });
    console.log(lienTheft);
  } catch (error) {
    console.error("Error:", error);
  }
}

Start building powerful automotive applications with CarsXE's Node.js SDK!