Frontal Crash Rating Data API

By Vehicle API
Frontal Crash Rating Data API

You need to show reliable frontal crash-test star ratings inside your app, given only a VIN. By the end of this guide, you’ll call the Vehicle API Frontal Crash Rating Data API endpoint, parse its response envelope, handle US-market coverage constraints and null fields, and cache results so your UI stays fast and consistent.

What the frontal crash rating endpoint returns

The Frontal Crash Rating Data API exposes NHTSA NCAP crash-test results for US-market vehicles. Ratings include frontal (driver and passenger), side (driver and passenger), and rollover. An overall value can be null when NHTSA has not published it. For frontal ratings, you will typically consume:

Illustration: Frontal Crash Rating Data API
  • front.driver: Integer star rating for the driver in a frontal impact
  • front.passenger: Integer star rating for the passenger in a frontal impact
  • front.overall: Can be null when NHTSA did not publish an overall frontal rating

Important coverage notes:

  • US-market coverage only for safety ratings: a valid non-US VIN returns error 422 coverage_us_only on this endpoint.
  • Ratings are matched by make + model + year, not by the precise trim-level VIN decode.
  • VIN decoding coverage is global but fullest for US-market vehicles; this endpoint specifically returns US NCAP ratings only.
  • This is not a vehicle history report. It does not include title, accident, or ownership history.

Endpoint and authentication

Base URL: https://vehicles-api.com/api/v1

Endpoint: GET /vin/safety-ratings

Authentication headers:

  • X-API-Key: YOUR_API_KEY
  • Alternatively, Authorization: Bearer YOUR_API_KEY

Example query parameter:

  • vin: the 17-character VIN

Official cURL example

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

Official JSON response example

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

Understanding the response envelope and fields you will use

Every response is wrapped in a consistent envelope:

  • status: "success" for successful calls; for errors you’ll receive status "error" with error.code and error.message.
  • source: "nhtsa" for NCAP safety ratings.
  • data: the ratings payload (or absent when status is "error").

Key fields within data for frontal crash ratings:

  • vin: The VIN you queried. Ratings are matched by make + model + year behind the scenes.
  • coverage: "us" indicates US-market coverage. Non-US VINs for this endpoint return an error (422 coverage_us_only).
  • match: "partial" signifies the mapping is at a broader configuration (such as body style) rather than an exact trim-level; this is expected because NHTSA NCAP matches at make + model + year.
  • vehicle_description: Human-readable description of the matched vehicle configuration from NHTSA.
  • overall: The published overall rating when available; can be null.
  • front: Object containing the frontal ratings you’ll typically display:
    • front.overall: Can be null.
    • front.driver: Integer star rating.
    • front.passenger: Integer star rating.
  • side: Side-impact ratings (same structure as front); included for completeness if you want to show more than frontal.
  • rollover: Integer rating for rollover risk.
  • nhtsa_vehicle_id: Reference identifier if you need to cross-check on NHTSA datasets.

Null fields: When NHTSA has not published a figure, fields like overall or front.overall can be null. Your UI should hide or gracefully message null values rather than showing zero.

JavaScript example: fetching and displaying frontal driver/passenger stars

async function getFrontalRatings(vin) {
const url = `https://vehicles-api.com/api/v1/vin/safety-ratings?vin=${encodeURIComponent(vin)}`;
const res = await fetch(url, {
headers: {
'X-API-Key': 'YOUR_API_KEY'
// Or: 'Authorization': 'Bearer YOUR_API_KEY'
}
});

// Handle non-2xx quickly
if (!res.ok) {
// Attempt to parse structured error
let err;
try { err = await res.json(); } catch (_) {}
if (err && err.status === 'error' && err.error) {
throw new Error(`${err.error.code}: ${err.error.message}`);
} else {
throw new Error(`HTTP ${res.status}`);
}
}

const payload = await res.json();
if (payload.status !== 'success') {
const code = payload.error?.code || 'unknown_error';
const msg = payload.error?.message || 'Unexpected response';
throw new Error(`${code}: ${msg}`);
}

const { data } = payload;

// US-market coverage only for this endpoint
if (data.coverage !== 'us') {
throw new Error('coverage_us_only: Safety ratings are available for US-market vehicles only.');
}

// Extract frontal ratings
const driverStars = data.front?.driver ?? null;
const passengerStars = data.front?.passenger ?? null;
const overallFront = data.front?.overall ?? null;

return {
vin: data.vin,
vehicle: data.vehicle_description,
match: data.match,
front: {
driver: driverStars,
passenger: passengerStars,
overall: overallFront
},
// In case you also want to surface context
source: payload.source, // 'nhtsa'
nhtsaVehicleId: data.nhtsa_vehicle_id
};
}

// Example usage:
getFrontalRatings('1HGCM82633A004352')
.then(r => {
console.log(`Vehicle: ${r.vehicle}`);
console.log(`Frontal (driver): ${r.front.driver} stars`);
console.log(`Frontal (passenger): ${r.front.passenger} stars`);
console.log(`Frontal (overall): ${r.front.overall !== null ? r.front.overall : 'N/A'}`);
})
.catch(err => {
console.error('Ratings fetch failed:', err.message);
});

Error handling, coverage rules, and nulls

  • US-only: If you pass a valid VIN that is not a US-market vehicle, this endpoint returns an error with HTTP 422 and code coverage_us_only. You should catch this and either skip ratings or fall back to a regional flow if you have one.
  • Nulls: It is normal for overall or front.overall to be null when NHTSA has not published a combined star rating. Display driver and passenger stars independently and omit missing aggregates.
  • Partial match: match: "partial" indicates that the result corresponds to a broader configuration (e.g., body style). That is expected because NHTSA NCAP ties to make + model + year. If you surface trim names elsewhere from VIN decoding, make sure your UI labels the safety section with vehicle_description from the rating payload to avoid implying trim-level precision.
  • Envelope errors: On failures, you receive status: "error" with error.code and error.message. Check both fields to drive user-facing messages or programmatic fallbacks.

Practical integration details

Rate limits and monthly quota

Vehicle API enforces plan-specific rate limits and a monthly quota. Exact limits depend on your plan and are visible in your dashboard. Build retries with backoff for 429 responses and instrument logs so you can see when your integration nears its quota. For more, check the Documentation.

Caching strategy

  • Cache by VIN: Ratings are matched by make + model + year. For stability, cache the entire ratings payload keyed by the VIN you queried.
  • TTL: Ratings rarely change for a given model year. Use a long TTL (e.g., days to weeks) and refresh opportunistically. If your app serves the same VIN repeatedly (dealer re-listings, fleet inventories), this saves calls and makes pages load faster.
  • Null persistence: Preserve nulls. Do not convert null to 0. When a field is null, continue to display available non-null components (e.g., driver and passenger stars).

UI rendering tips

  • Use integers as-is for stars. If you support half stars in your UI, do not synthesize halves unless present; use the integer values returned.
  • Label the source (NHTSA) and the vehicle_description for clarity, especially when match is "partial".
  • When overall is null, omit it and display the component ratings (front.driver, front.passenger).

Building a robust server-side endpoint

If you proxy this call from your backend, normalize the response envelope so your front end always gets the same shape. For example:

  • On success: Pass through status, source, and data. Consider whitelisting fields you actually use (vin, vehicle_description, front, side, rollover, nhtsa_vehicle_id).
  • On error: Map Vehicle API’s error.code and error.message to your domain errors. For 422 coverage_us_only, return a clear message that US NCAP ratings are not available for that VIN.
  • Cache headers: If you store results server-side, add your own Cache-Control for downstream clients, reflecting your chosen TTL.

Working alongside VIN decoding and other safety data

In production, you will often fetch VIN specs (year, make, model, trim), then call safety ratings. Keep in mind:

  • VIN decoding works worldwide but is fullest for US-market vehicles. Safety ratings, recalls, and complaints are US-market only and matched by make + model + year.
  • Dutch plates from RDW do not include a VIN; they are separate open-data records and are not part of this endpoint.
  • This safety ratings endpoint is independent of history products; it does not include title, accident, or ownership history.

If you are building an AI agent that needs to retrieve the same ratings via a tool interface, Vehicle API is also available as an MCP server: MCP.

Operational guidance and troubleshooting

  • Monitoring: Track error.code frequencies in logs (e.g., coverage_us_only) to quantify how often your inventory lacks US ratings.
  • Fallbacks: If ratings are unavailable or null in key fields, hide that portion of the UI or show a subtle “Not rated by NHTSA for this configuration” message.
  • Idempotency: GET calls are safe to retry on transient 5xx errors. Use exponential backoff and circuit breakers to avoid thundering herds during deploys.
  • Data freshness: While NCAP ratings for past model years are stable, they can be revised or clarified by NHTSA. Your cache-refresh policy should allow periodic revalidation.

Security and keys

  • Server-side calls: Prefer proxying requests from your backend with the X-API-Key header to avoid exposing keys in browsers.
  • Client-side calls: If you must call directly from the browser, configure a thin backend token exchange and domain restrictions.
  • Key rotation: Prepare to rotate YOUR_API_KEY without redeploy by loading it from environment or secrets management.

Testing with the control VIN

The control VIN 1HGCM82633A004352 decodes to a 2003 Honda Accord and is used in the official example. Use it to validate your integration and UI before wiring this into your production flows. Remember that NCAP ratings are matched by make + model + year and are US-market only.

FAQ

Does this endpoint return ratings for non-US vehicles?
No. Safety ratings are US-market only. A valid non-US VIN returns HTTP 422 with code coverage_us_only for this endpoint.

Why is overall or front.overall null?
NHTSA may not have published an overall rating for that configuration. Use the available component ratings (front.driver, front.passenger) and omit the missing aggregate.

Are these ratings tied to the exact trim decoded from the VIN?
They are matched by make + model + year. The match field may be "partial", and vehicle_description provides the NHTSA configuration label you should display.

What error shape should I expect on failure?
Responses include status: "error" with error.code and error.message. Handle 422 coverage_us_only specifically, and implement generic handling for other 4xx/5xx with retries where appropriate.

What about quotas and rate limits?
Each plan has a rate limit and monthly quota shown in your dashboard. Implement caching for repeated VINs and backoff for 429 responses. See the Documentation for operational details.

Start integrating the Frontal Crash Rating Data API now. Every plan includes a 7-day free trial. Register and ship a safety-aware experience with trustworthy NCAP data surfaced from https://vehicles-api.com.

Keep reading