
A VIN alone does not tell your application which crash-test results NHTSA published for a vehicle. By the end of this guide, you can call Vehicle API’s NCAP safety-ratings endpoint from a server, interpret its response, and handle partial matches, missing ratings and US-only coverage.
Request NCAP ratings for a VIN
The endpoint is GET https://vehicles-api.com/api/v1/vin/safety-ratings. Supply the VIN in the vin query parameter and authenticate with the X-API-Key header. The request below uses the documentation’s control VIN, which identifies a 2003 Honda Accord; it is not a stand-in for your reader’s vehicle.
curl "https://vehicles-api.com/api/v1/vin/safety-ratings?vin=1HGCM82633A004352" -H "X-API-Key: YOUR_API_KEY"
Replace YOUR_API_KEY with your key when running the command. In an application, make the request from your server and load the key from server-side configuration. Do not embed it in browser JavaScript or expose it in a page.
Vehicle API also accepts an Authorization Bearer header, but the examples here use X-API-Key consistently. The Documentation is the place to check current integration and account details.
NCAP results are US-market only and are matched by make, model and year. A valid non-US VIN returns HTTP 422 with error code coverage_us_only at this endpoint. Successful VIN decoding alone does not establish that an NCAP lookup will have US coverage.
Read the official response
The following is the official documentation example for the request above. It is useful for testing your parser, but it does not describe every vehicle or guarantee that every rating is available.
{
"status": "success",
"source": "nhtsa",
"data": {
"vin": "1HGCM82633A004352",
"coverage": "us",
"match": "partial",
"vehicle_description": "2003 Honda Accord 2-DR.",
"overall": null,
"front": {
"overall": null,
"driver": 5,
"passenger": 5
},
"side": {
"overall": null,
"driver": 5,
"passenger": 5
},
"rollover": 4,
"nhtsa_vehicle_id": 4736
}
}
Every response uses an envelope. On success, check status, retain source for attribution, and read the result from data. An error instead has an error status with error.code and error.message; do not assume that data is present in that case.
The fields most useful to a ratings integration are:
vinidentifies the requested VIN. Keep it with the result so that a cached response or background job cannot be attached to the wrong listing.coverageindicates the coverage represented in the result. The example isus.matchdescribes the match returned by the service. The example sayspartial, so retain that qualifier rather than presenting the result as an exact vehicle-specific match.vehicle_descriptionidentifies the vehicle description associated with the NHTSA result. Display it alongside the ratings so a user can assess the match.overall,front,sideandrollovercontain NCAP crash-test stars. The frontal and side objects include separate driver and passenger values as well as their ownoverallvalues.nhtsa_vehicle_ididentifies the NHTSA vehicle record used for the result. Store it with the description and match information for traceability.
In this example, the top-level, frontal and side overall values are null. NHTSA may not have published an overall rating; show that value as unavailable, not as zero stars. Do not calculate a replacement overall value from the driver, passenger or rollover values.
Integrate from your server
Both examples call the same GET endpoint and read the response envelope before using rating fields. They take the API key from the VEHICLE_API_KEY environment variable; configure that variable in your server environment rather than committing the key to source control.
Python with requests
Install requests in your application environment. For this GET request, use params= for the VIN; json= is for a JSON POST body and is not needed by this endpoint.
import os
import requests
url = "https://vehicles-api.com/api/v1/vin/safety-ratings"
vin = "1HGCM82633A004352"
try:
response = requests.get(
url,
headers={"X-API-Key": os.environ["VEHICLE_API_KEY"]},
params={"vin": vin},
timeout=5,
)
response.raise_for_status()
except requests.exceptions.HTTPError:
try:
envelope = response.json()
except ValueError:
envelope = dict()
error = envelope.get("error") or dict()
print("HTTP status:", response.status_code)
print("Error code:", error.get("code"))
print("Error message:", error.get("message"))
if error.get("code") == "coverage_us_only":
print("NCAP ratings are limited to US-market vehicles.")
except requests.exceptions.RequestException as exc:
print("Request failed:", exc)
else:
try:
envelope = response.json()
except ValueError:
raise RuntimeError("Response was not valid JSON")
if envelope.get("status") != "success":
error = envelope.get("error") or dict()
raise RuntimeError(
"API error: " + str(error.get("code")) + " "
+ str(error.get("message"))
)
ratings = envelope.get("data") or dict()
front = ratings.get("front") or dict()
side = ratings.get("side") or dict()
print("Source:", envelope.get("source"))
print("Vehicle:", ratings.get("vehicle_description"))
print("Match:", ratings.get("match"))
print("Overall:", ratings.get("overall"))
print("Front driver:", front.get("driver"))
print("Front passenger:", front.get("passenger"))
print("Side driver:", side.get("driver"))
print("Side passenger:", side.get("passenger"))
print("Rollover:", ratings.get("rollover"))
The HTTP-error branch reads error.code before deciding what to show. The success branch also checks status, so an error envelope is not treated as a ratings object merely because it arrived with an HTTP response. The timeout limits how long the server waits instead of leaving a request open indefinitely.
PHP with cURL
This version sends the same VIN as a query parameter and uses the same header. It checks for transport failures, non-JSON responses, HTTP errors and error envelopes before accessing the ratings.
<?php
$apiKey = getenv('VEHICLE_API_KEY');
if (!$apiKey) {
throw new RuntimeException('VEHICLE_API_KEY is not configured');
}
$url = 'https://vehicles-api.com/api/v1/vin/safety-ratings';
$vin = '1HGCM82633A004352';
$query = http_build_query(['vin' => $vin]);
$handle = curl_init($url . '?' . $query);
curl_setopt_array($handle, [
CURLOPT_RETURNTRANSFER => true,
CURLOPT_HTTPHEADER => ['X-API-Key: ' . $apiKey],
CURLOPT_TIMEOUT => 5,
]);
$body = curl_exec($handle);
if ($body === false) {
$message = curl_error($handle);
curl_close($handle);
throw new RuntimeException('Request failed: ' . $message);
}
$httpStatus = curl_getinfo($handle, CURLINFO_HTTP_CODE);
curl_close($handle);
$envelope = json_decode($body, true);
if (!is_array($envelope)) {
throw new RuntimeException('Response was not valid JSON');
}
if ($httpStatus >= 400 || ($envelope['status'] ?? null) !== 'success') {
$error = $envelope['error'] ?? [];
$code = $error['code'] ?? null;
$message = $error['message'] ?? null;
if ($code === 'coverage_us_only') {
echo "NCAP ratings are limited to US-market vehicles.\n";
}
throw new RuntimeException(
'API error: ' . (string) $code . ' ' . (string) $message
);
}
$ratings = $envelope['data'] ?? [];
echo 'Source: ' . ($envelope['source'] ?? '') . "\n";
echo 'Vehicle: ' . ($ratings['vehicle_description'] ?? '') . "\n";
echo 'Match: ' . ($ratings['match'] ?? '') . "\n";
echo 'Overall: ' . ($ratings['overall'] ?? 'unavailable') . "\n";
echo 'Front driver: ' . ($ratings['front']['driver'] ?? 'unavailable') . "\n";
echo 'Front passenger: ' . ($ratings['front']['passenger'] ?? 'unavailable') . "\n";
echo 'Side driver: ' . ($ratings['side']['driver'] ?? 'unavailable') . "\n";
echo 'Side passenger: ' . ($ratings['side']['passenger'] ?? 'unavailable') . "\n";
echo 'Rollover: ' . ($ratings['rollover'] ?? 'unavailable') . "\n";
In a production application, log enough information to diagnose failures without logging the API key. Map errors to an appropriate response for your own users rather than exposing raw exceptions. The examples use the control VIN; replace it with a VIN submitted to your server after applying your application’s input validation.
Handle coverage, caching and limits
Keep the match context with the stars
A crash rating is matched by make, model and year; it is not a direct inspection of the individual vehicle. Store or display match, vehicle_description, source and nhtsa_vehicle_id with the stars. This context matters when a result is partial or when a listing has more specific vehicle details than the returned description.
VIN decoding works worldwide and is fullest for US-market vehicles. NCAP ratings, recalls and owner complaints are US-market only and matched by make, model and year. Dutch plate data comes from RDW and never includes a VIN, so a Dutch plate result does not supply the VIN required by this NCAP request.
These safety data sources do not make the response a vehicle history report. They do not provide title, accident or ownership history. Label the result as an NHTSA NCAP rating rather than a history of the specific car.
Cache deliberately
Cache decoded VIN data so repeated views of the same listing do not require repeated decoding. Cache an NCAP response separately from the decoded VIN: identification and crash ratings have different availability, and a decoded VIN does not imply a successful safety-rating match.
Keep the requested VIN, response source, match context and nullable rating fields together in the cached record. Preserve null as missing data rather than converting it to a numeric value. Choose a refresh policy appropriate to your application, because published source data can change; do not assume a cached ratings response is permanent.
Keep an error distinct from a successful response with unavailable fields. In particular, coverage_us_only is a coverage outcome, not a zero-star rating. Retrying the same unchanged non-US VIN will not change that coverage constraint.
Plan for rate limits and monthly quota
Requests are subject to rate limits and a monthly quota. Check your account and the current documentation for the limits that apply to your plan; build your integration without assuming a particular allowance or reset schedule.
Use your cache to reduce duplicate lookups, and handle limit-related errors without presenting them as missing NCAP stars. Avoid immediate, repeated retries when a request has been limited. For temporary request failures, use a bounded retry policy appropriate to your application and preserve the last successful cached result when it is still suitable to show.
Vehicle API also provides an MCP server for agent integrations. The same distinction between US-only NCAP coverage, match context and unavailable ratings remains important when an agent presents a result.
FAQ
Does a valid VIN always return NCAP ratings?
No. VIN decoding has wider geographic coverage than this endpoint. A valid non-US VIN returns 422 with coverage_us_only for NCAP ratings, and available ratings depend on the published NHTSA data and the match.
What does a null overall rating mean?
It means the response does not contain an overall rating; NHTSA may not have published one. Display it as unavailable and keep any available frontal, side or rollover ratings separate.
Is a partial match an exact match for the individual car?
Do not present it that way. NCAP data is matched by make, model and year, and the returned match and vehicle_description should accompany the ratings.
Can a Dutch plate be used as the VIN for this request?
No. Dutch plate data from RDW never includes a VIN, and this endpoint takes a VIN in its vin parameter.
Ready to test the integration? Register to start a 7-day free trial. The Starter plan is $19 per month, and every plan includes the trial.