Vehicle Complaints API for Developers

By Vehicle API
Vehicle Complaints API for Developers

You have a VIN and need to show developers or users the relevant NHTSA owner complaints without mistaking model-level reports for that individual vehicle’s history. This guide shows how to call the Vehicle Complaints endpoint from a server, read its response, and handle coverage, errors, caching, and quota constraints.

Request complaints for a VIN

Vehicle API’s Vehicle Complaints lookup accepts a VIN as the vin query parameter on GET /vin/complaints. Authenticate with the X-API-Key header. An Authorization: Bearer header also works, but the examples here use X-API-Key.

Illustration: Vehicle Complaints API for Developers

Run the official request below with your API key substituted for YOUR_API_KEY. The VIN is a control example for a 2003 Honda Accord; it is not necessarily the vehicle your user owns or is evaluating.

curl "https://vehicles-api.com/api/v1/vin/complaints?vin=1HGCM82633A004352" -H "X-API-Key: YOUR_API_KEY"

Keep the key on your server. A browser, mobile client, or agent-facing interface should call your own backend rather than receive the Vehicle API key in client code.

The lookup returns NHTSA Office of Defects Investigation owner complaints matched by make, model, and year. It does not establish that a particular complaint was filed about the VIN submitted, or that the reported issue occurred in that individual vehicle.

Read the response

This is the official documentation example. The example values describe the control VIN; live complaint data and totals can change as NHTSA publishes new data.

{
    "status": "success",
    "source": "nhtsa",
    "data": {
        "vin": "1HGCM82633A004352",
        "year": 2003,
        "make": "HONDA",
        "model": "Accord",
        "coverage": "us",
        "count": 2013,
        "complaints": [
            {
                "odi_number": "11459899",
                "date": "2022-03-15",
                "crash": false,
                "fire": false,
                "injured": 0,
                "deaths": 0,
                "components": [
                    "AIR BAGS"
                ],
                "summary": "Driver airbag warning light illuminated."
            }
        ]
    }
}

A successful response has an envelope containing status, source, and data. Here, source identifies NHTSA. On an error, inspect status, error.code, and error.message rather than assuming that data is present.

The fields most integrations need are:

  • vin, year, make, and model: the submitted identifier and the vehicle attributes used for the complaint match.
  • coverage: the coverage indicated for this response. The example value is us.
  • count: the true total number of matching complaints, not the length of the returned list.
  • complaints: the most recent matching reports, up to 50. Each report includes an odi_number, date, components, and summary.
  • crash, fire, injured, and deaths: report details to preserve when presenting an individual complaint. Treat them as details of the report, not as findings about the submitted vehicle.

The documentation example shows one complaint while its count is 2013. Do not infer the total from the array length or assume that every matching report is in the response. The lookup provides the most recent 50; it does not make the returned list a complete complaint history.

Display date as a date rather than assigning it a time or timezone. Handle missing or null values explicitly: a null is not the same as zero, false, or an empty string. This matters especially for incident details and any decoded vehicle attributes used by your application.

Call the endpoint from Python

Install requests in your server environment and put the key in the VEHICLE_API_KEY environment variable. The sample uses params= for the GET query, sets a timeout, and checks the API error envelope before reading complaint fields.

import os
import requests

url = "https://vehicles-api.com/api/v1/vin/complaints"
vin = "1HGCM82633A004352"

try:
response = requests.get(
url,
params={"vin": vin},
headers={"X-API-Key": os.environ["VEHICLE_API_KEY"]},
timeout=10,
)
payload = response.json()
except requests.RequestException as exc:
raise SystemExit(f"Request failed: {exc}")
except ValueError:
raise SystemExit("The server returned a non-JSON response.")

if payload.get("status") == "error":
error = payload.get("error") or {}
raise SystemExit(
f"API error {error.get('code')}: {error.get('message')}"
)

try:
response.raise_for_status()
except requests.HTTPError as exc:
raise SystemExit(f"HTTP error: {exc}")

if payload.get("status") != "success" or not isinstance(payload.get("data"), dict):
raise SystemExit("Unexpected response envelope.")

data = payload["data"]
print("Source:", payload.get("source"))
print("Vehicle:", data.get("year"), data.get("make"), data.get("model"))
print("Coverage:", data.get("coverage"))
print("Total matching complaints:", data.get("count"))

for complaint in data.get("complaints") or []:
print(
complaint.get("odi_number"),
complaint.get("date"),
complaint.get("components"),
complaint.get("summary"),
)

Replace the control VIN with a value obtained by your backend for the vehicle being inspected. The sample does not use json= because this is a GET request, not a POST; its input belongs in params=.

The error check runs before raise_for_status() so that an API error can be reported using its documented code and message. Transport failures, invalid JSON, non-success HTTP responses, and unexpected envelopes are separate failure paths. In an application, translate those paths into appropriate messages without exposing the API key.

Call the endpoint from PHP

The following server-side PHP example uses cURL and the same environment variable. It sends the VIN as a query parameter and reads error.code and error.message when the response reports an error.

<?php

$key = getenv('VEHICLE_API_KEY');
if ($key === false || $key === '') {
exit("VEHICLE_API_KEY is not set.\n");
}

$vin = '1HGCM82633A004352';
$url = 'https://vehicles-api.com/api/v1/vin/complaints?'
. http_build_query(['vin' => $vin]);

$ch = curl_init($url);
curl_setopt_array($ch, [
CURLOPT_RETURNTRANSFER => true,
CURLOPT_HTTPHEADER => ['X-API-Key: ' . $key],
CURLOPT_TIMEOUT => 10,
]);

$body = curl_exec($ch);
if ($body === false) {
$message = curl_error($ch);
curl_close($ch);
exit("Request failed: " . $message . "\n");
}

$httpStatus = curl_getinfo($ch, CURLINFO_HTTP_CODE);
curl_close($ch);

try {
$payload = json_decode($body, true, 512, JSON_THROW_ON_ERROR);
} catch (JsonException $e) {
exit("The server returned a non-JSON response.\n");
}

if (!is_array($payload)) {
exit("Unexpected response envelope.\n");
}

if (($payload['status'] ?? null) === 'error') {
$error = $payload['error'] ?? [];
$code = $error['code'] ?? 'unknown';
$message = $error['message'] ?? 'No message provided';
exit("API error " . $code . ": " . $message . "\n");
}

if ($httpStatus < 200 || $httpStatus >= 300) {
exit("HTTP error: " . $httpStatus . "\n");
}

if (($payload['status'] ?? null) !== 'success'
|| !isset($payload['data'])
|| !is_array($payload['data'])) {
exit("Unexpected response envelope.\n");
}

$data = $payload['data'];
echo "Source: " . ($payload['source'] ?? 'unknown') . "\n";
echo "Vehicle: " . ($data['year'] ?? 'unknown') . " "
. ($data['make'] ?? 'unknown') . " "
. ($data['model'] ?? 'unknown') . "\n";
echo "Coverage: " . ($data['coverage'] ?? 'unknown') . "\n";
echo "Total matching complaints: " . ($data['count'] ?? 'unknown') . "\n";

foreach (($data['complaints'] ?? []) as $complaint) {
echo ($complaint['odi_number'] ?? 'unknown') . " | "
. ($complaint['date'] ?? 'unknown') . " | "
. ($complaint['summary'] ?? 'unavailable') . "\n";
}

Both samples are deliberately server-side. If you render complaint summaries in a web page, escape them for the output context; the summaries are report text, not markup for your application to execute.

Design for coverage, freshness, and limits

VIN decoding works worldwide, but is fullest for US-market vehicles. The complaint lookup has a narrower scope: it covers US-market vehicles only. A valid non-US VIN returns HTTP 422 with error.code set to coverage_us_only; handle that as a coverage limitation rather than reporting that no complaints exist.

US recall campaigns and NCAP ratings are also US-market data matched by make, model, and year. Dutch plate data comes from RDW and never includes a VIN. Neither a complaint match nor those other data sources makes this a vehicle history report: it does not provide title, accident, or ownership history.

For a dealer tool, marketplace, fleet workflow, or insurance application, label the result as complaints for the matching make, model, and year. Show the total separately from the returned recent reports, and explain that a report is not a verified event for the submitted VIN. An empty list or unavailable field should not be presented as proof that a vehicle has no issues.

Cache decoded VIN attributes when your workflow repeatedly processes the same VIN, but handle null decoded fields without substituting guessed values. Complaint data changes as NHTSA publishes updates, so give cached complaint results a refresh policy appropriate to your application. Preserve the source and retrieval context alongside cached data so users can understand what they are viewing.

Account for both request rate limits and the monthly quota when scheduling lookups and refreshes. Avoid issuing the same lookup repeatedly for every page render, and distinguish a limit-related failure from an empty complaint result. Check the current Documentation for the limits and error details applicable to your plan rather than hard-coding assumed allowances.

For agent workflows, Vehicle API also offers an MCP server. Apply the same distinction between model-level complaint matches and an individual vehicle’s history when an agent presents results.

FAQ

Are complaints tied to the exact VIN?

No. The submitted VIN is used to identify the make, model, and year; complaints are matched on those attributes. A returned report should not be described as a complaint about that particular vehicle.

Why is the complaint count larger than the list?

count is the true total for the match. The response includes up to the 50 most recent complaints, so the list length can be smaller than the total.

What should I do with coverage_us_only?

Tell the caller that complaint coverage is limited to US-market vehicles. Do not turn the HTTP 422 response into a successful zero-complaint result.

Can I cache the response?

Yes. Cache decoded VIN attributes for repeated lookups and choose a complaint refresh policy that reflects the fact that NHTSA data changes. Track your request rate and monthly quota when deciding how often to refresh.

Ready to integrate? Register to start the 7-day free trial. Every plan includes the trial, and Starter is $19 per month.