NHTSA Vehicles

NHTSA Vehicles

Vehicle

NHTSA Product Information Catalog and Vehicle Listing. The NHTSA Product Information Catalog Vehicle Listing (vPIC) Application Programming Interface (API) provides different ways to gather information on Vehicles and their specifications. The vPIC Dataset is populated using the information submitted by the Motor Vehicle manufacturers through the 565 submittals. All the information on how a VIN is assigned by the manufacturer is captured in this catalog and used to decode a VIN and extract vehicle information.

Visit API

📚 Documentation & Examples

Everything you need to integrate with NHTSA Vehicles

🚀 Quick Start Examples

NHTSA Vehicles Javascript Examplejavascript
// NHTSA Vehicles API Example
const response = await fetch('https://vpic.nhtsa.dot.gov/api/', {
    method: 'GET',
    headers: {
        'Content-Type': 'application/json'
    }
});

const data = await response.json();
console.log(data);

Exploring the NHTSA API for Vehicle Information

The National Highway Traffic Safety Administration (NHTSA) provides a public API that allows anyone to retrieve information about vehicles, including their make, model, year, and other relevant data.

Getting Started

Before we dive into the API, we need to get an API key. Visit the NHTSA API website and sign up for an API key. Once you have your key, you can start using the API by making HTTP requests with your key as a query parameter.

Example 1: Retrieve General Vehicle Information

Let's start by retrieving general information about a specific vehicle. In this example, we'll retrieve the make, model, year, and origin of a vehicle using its VIN.

const vin = '1HGCM82633A004352';
const apiKey = 'YOUR_API_KEY';

const url = `https://vpic.nhtsa.dot.gov/api/vehicles/decodevin/${vin}?format=json&modelyear=${year}&catalog=true&brandName=true&key=${apiKey}`;

fetch(url)
  .then(response => response.json())
  .then(data => {
    const make = data.Results[6].Value;
    const model = data.Results[8].Value;
    const year = data.Results[9].Value;
    const origin = data.Results[10].Value;
    console.log(`Make: ${make}, Model: ${model}, Year: ${year}, Origin: ${origin}`);
  })
  .catch(error => console.log(error));

Example 2: Retrieve Vehicle Manufacturer Details

In this example, we'll retrieve details about a vehicle manufacturer using its ID.

const manufacturerId = 987;
const apiKey = 'YOUR_API_KEY';

const url = `https://vpic.nhtsa.dot.gov/api/vehicles/getmanufacturerdetails/${manufacturerId}?format=json&key=${apiKey}`;

fetch(url)
  .then(response => response.json())
  .then(data => {
    const name = data.Results[0].Mfr_Name;
    const country = data.Results[0].Country;
    const address = `${data.Results[0].City}, ${data.Results[0].State}, ${data.Results[0].Zip}`;
    console.log(`Name: ${name}, Country: ${country}, Address: ${address}`);
  })
  .catch(error => console.log(error));

Example 3: Retrieve Vehicle Equipment Details

In this example, we'll retrieve details about a vehicle's equipment using its ID.

const equipmentId = 10002345;
const apiKey = 'YOUR_API_KEY';

const url = `https://vpic.nhtsa.dot.gov/api/vehicles/getequipmentdetails/${equipmentId}?format=json&key=${apiKey}`;

fetch(url)
  .then(response => response.json())
  .then(data => {
    const name = data.Results[0].EquipmentName;
    const description = data.Results[0].EquipmentDescription;
    console.log(`Name: ${name}, Description: ${description}`);
  })
  .catch(error => console.log(error));

Conclusion

The NHTSA API provides a wealth of information about vehicles that can be utilized in various applications. In this short guide, we covered just a few examples of how to use the API in your JavaScript code. By exploring the API documentation and experimenting with the examples outlined here, you can discover even more ways to leverage this powerful resource.

📊 30-Day Uptime History

Daily uptime tracking showing online vs offline minutes

Jun 12Jun 14Jun 16Jun 18Jun 20Jun 22Jun 24Jun 26Jun 28Jun 30Jul 2Jul 4Jul 6Jul 8Jul 1104008001440Minutes
Online
Offline

Related APIs in Vehicle