How to Use the Frontal Crash Rating API

By Vehicle API
How to Use the Frontal Crash Rating API

You need to show users clear, trustworthy frontal crash-test star ratings inside your app. By the end of this guide you will send a live request to the Vehicle API Frontal Crash Rating endpoint, parse the official NHTSA NCAP fields you care about (driver and passenger), handle nulls and errors, cache responses, and ship a production-safe integration.

What the Frontal Crash Rating endpoint provides

The Frontal Crash Rating API returns NCAP crash-test star ratings sourced from NHTSA and matched by make + model + year. Ratings include frontal (driver and passenger), side (driver and passenger), and rollover; an overall score can be null if NHTSA did not publish it. This data covers US-market vehicles only. If you pass a valid non-US VIN, you will get a coverage error for this endpoint.

Illustration: How to Use the Frontal Crash Rating API

The endpoint also returns a short description of the matched vehicle (for clarity in your UI), and the NHTSA vehicle identifier. Ratings are presented per the standardized 1–5 star scale as integers. Fields can be null when NHTSA has no result for that dimension.

  • Base URL: https://vehicles-api.com/api/v1
  • Endpoint: GET /vin/safety-ratings?vin=...
  • Auth: X-API-Key: YOUR_API_KEY (Authorization: Bearer YOUR_API_KEY also supported)
  • Envelope: Every response is wrapped with status, source, and data or error

Important scope constraints to keep in mind as you plan your data model:

  • VIN decoding is global, but NCAP ratings, recalls, and complaints are US-market only.
  • NCAP ratings are matched by make + model + year; they are not VIN-specific crash tests.
  • Dutch plates (RDW) never include a VIN, and RDW data is separate from NHTSA sources.
  • This is not a vehicle history report (no title, accident, or ownership history).

Get access, start your trial, and authenticate

All plans include a 7-day free trial. Starter is $19/mo. Create your account, copy your API key from the dashboard, and use it in the X-API-Key header for every request.

Store your key as an environment variable in your app or CI/CD system. The API also accepts Authorization: Bearer YOUR_API_KEY if you prefer a standard authorization header. Do not hard-code keys in client-side code.

Make your first request

Use the provided control VIN (for examples and tests only): 1HGCM82633A004352 (a 2003 Honda Accord). This does not imply any data about the reader’s car and should not be used in production logic beyond testing.

cURL: Frontal Crash Rating request

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

Read the official JSON response

The API returns a standard envelope with status, source, and data. Within data, the frontal ratings live in data.front, with driver and passenger star values. The overall field can be null if NHTSA did not publish an overall rating for that vehicle configuration or year.

Official sample JSON

{
"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
}
}

Fields you will use

  • status: "success" indicates a successful lookup. On errors, status is "error" and the response includes error.code and error.message.
  • source: "nhtsa" indicates that the crash-test data is sourced from official NHTSA NCAP.
  • data.vin: Echoes the VIN you looked up. Useful for correlating your logs and caches.
  • data.coverage: "us" means this VIN falls under US-market data coverage for this endpoint.
  • data.match: "partial" means the rating was matched by make + model + year (NCAP standard). Treat ratings as representative for that configuration.
  • data.vehicle_description: Human-readable descriptor for your UI ("2003 Honda Accord 2-DR.").
  • data.overall: Can be null. Do not assume an overall rating exists for every record.
  • data.front.overall: Can be null. Present when NHTSA publishes a frontal overall. Always check for null.
  • data.front.driver: Integer 1–5. The driver-side frontal star rating (primary field for "frontal crash" summaries).
  • data.front.passenger: Integer 1–5. The passenger-side frontal star rating.
  • data.side.driver, data.side.passenger: Side-impact star ratings.
  • data.rollover: Integer 1–5 indicating rollover risk rating.
  • data.nhtsa_vehicle_id: NHTSA’s internal vehicle identifier. Useful if you cross-reference other NHTSA datasets.

Error handling and coverage behavior

Safety ratings are US-market only. Requests using a valid non-US VIN will return an error indicating coverage_us_only. Authentication or quota issues return consistent error envelopes. Your integration should treat all non-200 responses (and "status":"error" payloads) as exceptional paths and surface clear messages in logs and user flows.

Example: Coverage error for non-US VIN (422)

{
"status": "error",
"error": {
"code": "coverage_us_only",
"message": "Safety ratings are available for US-market vehicles only. Try a US-market VIN, or use VIN decoding for non-US coverage."
}
}

Example: Unauthorized (401)

{
"status": "error",
"error": {
"code": "unauthorized",
"message": "Missing or invalid API key. Include X-API-Key header or Authorization: Bearer YOUR_API_KEY."
}
}

Example: Rate limit exceeded (429)

{
"status": "error",
"error": {
"code": "rate_limit",
"message": "Rate limit exceeded. Please retry with backoff or contact support to adjust limits."
}
}

Example: Generic validation error (400)

{
"status": "error",
"error": {
"code": "invalid_request",
"message": "Query parameter 'vin' is required."
}
}

Notes for production behavior:

  • Response codes: Successful lookups return 200 with status: "success". Coverage or validation issues may return 4xx with status: "error".
  • Monthly quota and rate limits: Plans include monthly call quotas and per-minute rate limits. Implement exponential backoff and check headers/logs for limit signals. For plan-specific details, see your dashboard or the Documentation.
  • Null fields: Treat overall and front.overall as nullable. Do not derive a missing overall from driver/passenger.
  • Matching: Ratings are matched by make + model + year; display the vehicle_description to clarify the context for your users.

Python example: fetch and use frontal driver/passenger stars

This example requests the endpoint, checks for errors, and reads driver/passenger frontal stars with null safety. Replace YOUR_API_KEY with your dashboard key.

import os
import requests

API_KEY = os.getenv("VEHICLES_API_KEY", "YOUR_API_KEY")
BASE_URL = "https://vehicles-api.com/api/v1"

def get_frontal_ratings(vin: str):
url = f"{BASE_URL}/vin/safety-ratings"
params = {"vin": vin}
headers = {"X-API-Key": API_KEY}
resp = requests.get(url, params=params, headers=headers, timeout=10)

# Handle non-200 with consistent JSON envelope
try:
payload = resp.json()
except ValueError:
resp.raise_for_status()
raise RuntimeError("Unexpected non-JSON response")

# status: success | error
if payload.get("status") != "success":
err = payload.get("error", {})
code = err.get("code", "unknown_error")
msg = err.get("message", "Unknown error")
raise RuntimeError(f"Safety ratings error [{code}]: {msg}")

data = payload.get("data", {})
front = data.get("front", {}) or {}
result = {
"vin": data.get("vin"),
"coverage": data.get("coverage"),
"match": data.get("match"),
"vehicle_description": data.get("vehicle_description"),
"overall": data.get("overall"), # can be None
"front_overall": front.get("overall"), # can be None
"front_driver": front.get("driver"),
"front_passenger": front.get("passenger"),
"rollover": data.get("rollover"),
"nhtsa_vehicle_id": data.get("nhtsa_vehicle_id"),
"source": payload.get("source"),
}
return result

if __name__ == "__main__":
# Docs control VIN for testing:
vin = "1HGCM82633A004352"
ratings = get_frontal_ratings(vin)
# Example: print frontal driver/passenger stars, safely handling nulls
driver = ratings.get("front_driver")
passenger = ratings.get("front_passenger")
print(f"Vehicle: {ratings.get('vehicle_description')}")
print(f"Frontal driver: {driver if driver is not None else 'N/A'} stars")
print(f"Frontal passenger: {passenger if passenger is not None else 'N/A'} stars")
print(f"Rollover: {ratings.get('rollover') if ratings.get('rollover') is not None else 'N/A'} stars")

Implementation patterns for production apps

1) Caching decoded VINs and ratings

VIN decoding is stable for a given VIN, and NCAP ratings change infrequently. Cache successful responses keyed by VIN with a TTL aligned to your business needs (for example, 7–30 days). Include the full JSON so your UI can render vehicle_description and all relevant fields without re-fetching.

2) Handling nulls without breaking UI

  • overall can be null. Show “N/A” if not present; do not compute an average.
  • front.overall can be null even when driver and passenger are present.
  • If any of driver or passenger is null, render whichever is available and hide the missing one.

3) Dealing with coverage_us_only responses

For non-US VINs, show a clear message: “US NCAP ratings are not available for this vehicle.” If your workflow supports international vehicles, you can still use the VIN decoding endpoint for specs and region-agnostic details, then conditionally hide US-only sections (recalls, complaints, and NCAP ratings).

4) Rate limits, retries, and quotas

  • Implement exponential backoff on 429 rate_limit errors.
  • Batch requests server-side and use your cache first to reduce API load.
  • Monitor your monthly quota in your dashboard. If you expect bursts, pre-warm your cache for common VINs.

5) Presenting the “match” semantics

Because ratings are matched by make + model + year, set expectations in your UI. Display vehicle_description to anchor the user’s understanding and retain transparency (“NCAP rating for 2003 Honda Accord 2-DR.”).

Working with status, source, and data envelope

Every API response ships inside a consistent envelope so your client can parse status reliably.

  • status: “success” or “error”.
  • source: For safety ratings, “nhtsa”. In other endpoints, this may vary (e.g., RDW for Dutch plates).
  • data: Present on success. On error, use error.code and error.message.

Always check status before attempting to read data.front fields. For errors, forward error.code to your observability tooling so you can group alerts by failure mode (coverage_us_only vs unauthorized vs rate_limit).

JavaScript snippet (optional, Node.js/fetch)

If you prefer JavaScript, the same request pattern applies using the X-API-Key header.

import fetch from "node-fetch";

const API_KEY = process.env.VEHICLES_API_KEY || "YOUR_API_KEY";
const VIN = "1HGCM82633A004352";

async function getSafetyRatings(vin) {
const url = new URL("https://vehicles-api.com/api/v1/vin/safety-ratings");
url.searchParams.set("vin", vin);

const resp = await fetch(url.toString(), {
headers: { "X-API-Key": API_KEY },
timeout: 10000
});

const payload = await resp.json().catch(() => {
throw new Error(`Non-JSON response with status ${resp.status}`);
});

if (payload.status !== "success") {
const err = payload.error || {};
throw new Error(`Safety ratings error [${err.code || "unknown_error"}]: ${err.message || "Unknown error"}`);
}

const data = payload.data || {};
const front = data.front || {};
return {
vin: data.vin,
vehicle_description: data.vehicle_description,
front_driver: front.driver ?? null,
front_passenger: front.passenger ?? null,
front_overall: front.overall ?? null,
overall: data.overall ?? null,
rollover: data.rollover ?? null,
coverage: data.coverage,
match: data.match,
nhtsa_vehicle_id: data.nhtsa_vehicle_id
};
}

getSafetyRatings(VIN)
.then(r => {
console.log("Vehicle:", r.vehicle_description);
console.log("Frontal driver:", r.front_driver ?? "N/A");
console.log("Frontal passenger:", r.front_passenger ?? "N/A");
console.log("Rollover:", r.rollover ?? "N/A");
})
.catch(err => {
console.error("Error:", err.message);
});

End-to-end flow to add frontal ratings to your app

Step 1 — Start your trial

Create an account at Register. Copy your API key from the dashboard. Starter is $19/mo and all plans include a 7-day free trial.

Step 2 — Wire the request

Call GET /api/v1/vin/safety-ratings with the VIN as a query parameter, sending your key via X-API-Key. For testing, use the control VIN 1HGCM82633A004352. In production, supply your users’ VINs from your inventory, marketplace, or claim workflows.

Step 3 — Parse the envelope and fields

  • Check status === "success".
  • Read data.vehicle_description to label your UI.
  • Use data.front.driver and data.front.passenger as your primary frontal crash stars.
  • Use data.rollover to show rollover rating.
  • Display “N/A” for any null fields (overall and front.overall are commonly null in some model years).

Step 4 — Implement error handling

  • 422 coverage_us_only: Hide ratings for non-US VINs but continue showing other available data (e.g., decoded specs from other endpoints).
  • 401 unauthorized: Refresh or correct your X-API-Key.
  • 429 rate_limit: Retry with exponential backoff and leverage your cache.

Step 5 — Cache for speed and resilience

Cache success responses by VIN. Use an ETag-like hash in your cache key if you post-process values. Set a TTL that fits your SLA. Doing so reduces latency and protects you from rate limits and transient network issues.

Testing behaviors you should verify

  • Null safety: Simulate cases where overall and front.overall are null but driver/passenger are present.
  • Coverage boundary: Verify that non-US VINs return coverage_us_only for this endpoint and that your UI gracefully hides ratings.
  • Resilience: Ensure 401/429 paths work as intended, with retries and clear logs.
  • Caching: Confirm cache hit ratio and that cache invalidation does not surface stale errors.

Notes on data scope and related endpoints

The NCAP endpoints use US-market data from NHTSA and are matched by make + model + year. Vehicle API also supports VIN decoding with global coverage for core specs (year, make, model, trim, engine, transmission, and assembly plant), and official US safety data like recall campaigns and owner complaints. Dutch plate lookups use RDW open data and do not provide a VIN. Avoid presenting these safety ratings as a vehicle history report—they do not include title, accident, or ownership history.

For agents and tooling that integrate via the Model Context Protocol (MCP), an MCP server is available at MCP. For REST integrations and schema details, see the Documentation. You can always return to the main site at vehicles-api.com to explore additional endpoints.

Operational tips for fleets, dealers, marketplaces, and insurers

  • Fleets: Precompute and store frontal driver/passenger and rollover ratings for your common models, then expose them inside your asset pages and maintenance portals.
  • Dealers/marketplaces: Display ratings alongside decoded specs for transparency. Show vehicle_description as returned to ensure the user sees the exact NCAP context.
  • Insurers: Use a lightweight queue to resolve ratings after intake if the VIN is missing; render safely with “N/A” until the result arrives.
  • AI agents: Access the same endpoint via REST or the MCP server, normalizing on the envelope format (status, source, data) and checking for nulls in overall/fields.

Frequently asked questions

Does this endpoint return ratings for every VIN worldwide?
No. NCAP crash ratings are US-market only and matched by make + model + year. A valid non-US VIN returns a coverage_us_only error for this endpoint. VIN decoding coverage is worldwide, but crash ratings, recalls, complaints, and NCAP are US-only.

Why are overall and front.overall sometimes null?
NHTSA may not publish an overall score for some vehicles or years. Do not compute your own overall; display “N/A” when fields are null and rely on driver/passenger values for frontal details.

Are these crash test results specific to an individual VIN?
No. NCAP results are matched by make + model + year, not a per-VIN crash test. The vehicle_description in the response clarifies the matched configuration for your UI.

What should I do when I hit rate limits?
Implement exponential backoff on 429 responses, cache successful lookups by VIN, and batch requests server-side. Monitor your dashboard for quota and adjust your plan if needed.

Can I use license plates to get these ratings?
Dutch plates from RDW are supported but do not include a VIN. US license plate lookup is not live. To show NCAP ratings, you should supply a VIN for a US-market vehicle.

Start your 7-day free trial and add frontal crash ratings to your app in minutes: Register. Explore endpoints, schemas, and usage guidance in the Documentation and learn about agent integration via MCP. For anything else, visit vehicles-api.com.