# NHTSA Vehicles Scraper (`xtracto/nhtsa-vehicles-scraper`) Actor

Decode VINs and pull that vehicle's recalls, owner complaints and crash-test ratings in one run. NHTSA answers an unknown model name with a clean HTTP 200 zero - 'F-150' returns nothing while 'F-150 SUPERCAB' returns 1,425 complaints - so model names are resolved and deduplicated first.

- **URL**: https://apify.com/xtracto/nhtsa-vehicles-scraper.md
- **Developed by:** [Farhan Febrian Nauval](https://apify.com/xtracto) (community)
- **Categories:** Other
- **Features:** Limited permissions
- **Stats:** 2 total users, 1 monthly users, 100.0% runs succeeded, 0 bookmarks
- **User rating**: No ratings yet

## Pricing

from $0.67 / 1,000 results

This Actor is paid per event and usage. You are charged both the fixed price for specific events and for Apify platform usage.
Since this Actor supports Apify Store discounts, the price gets lower the higher subscription plan you have.

Learn more: https://docs.apify.com/actors/running/actors-in-store.md#pay-per-event

## What's an Apify Actor?

An Actor is a serverless cloud program that runs on the Apify platform. It has two run modes.
In Batch mode, an Actor accepts a well-defined JSON input, performs an action which can take anything from a few seconds to a few hours,
and optionally produces a well-defined JSON output, datasets with results, or files in key-value store.
In Standby mode, an Actor provides a web server which can be used as a website, API, or an MCP server.

Apify vocabulary and the platform model are defined once, in the agent quickstart at https://apify.com/agents.md.

## How to integrate an Actor?

If asked about integration, you help developers integrate Actors into their projects.
You adapt to their stack and deliver integrations that are safe, well-documented, and production-ready.

Do not guess an integration path. Every one of them is in the agent quickstart at https://apify.com/agents.md: the Apify MCP server, Agent Skills with the Apify CLI, the JavaScript and Python clients, the REST API, and the account-free path for an agent with no human to sign in. It also carries the rule on stating cost before the first paid run.

For examples already wired to this Actor's own input schema, see the [API](#api) section below.

Each client library has reference documentation the quickstart does not restate: [JavaScript/TypeScript](https://docs.apify.com/api/client/js/docs.md) (`npm install apify-client`) and [Python](https://docs.apify.com/api/client/python/docs.md) (`pip install apify-client`).

# README

## NHTSA Vehicles Scraper

Decode a VIN and pull that exact vehicle's **safety recalls, owner complaints
and NCAP crash-test ratings in one run** — straight from NHTSA's own open-data
APIs. No API key. No login.

### The thing other NHTSA scrapers get wrong

Ask NHTSA for a 2015 Ford F-150's complaints the obvious way:

```
make=ford  model=F-150  modelYear=2015
  ->  HTTP 200   {"count": 0, "message": "Results returned successfully"}
```

Zero complaints. Clean. Successful. For one of the most-complained-about
vehicles in America — and it is the model name vPIC hands you when you decode
that truck's own VIN.

api.nhtsa.gov does not know a model called `F-150`. It knows `F-150 REGULAR
CAB`, `F-150 SUPER CREW` and `F-150 SUPERCAB`.

**And the obvious fix is wrong too.** Those three are aliases for *one* set of
complaints, not disjoint body styles: 1,425 unique complaints across all three,
2,850 duplicates. Fan out and add them up and you report 4,275.

This actor tries the name you gave first, falls back to NHTSA's own vocabulary
only when that comes back empty, and deduplicates by the record's own id. It
tells you on every run which name actually served your data.

**It also has to, because the two lookups want opposite names:**

| model name | complaints | recalls | safety ratings |
| --- | --- | --- | --- |
| `F-150` | 0 rows | **14 rows** | 0 rows |
| `F-150 SUPERCAB` | **1,425 rows** | HTTP 400 | **2 rows** |

NHTSA's own model list lists only the long names — including for
recalls, which rejects them.

### Modes

| Mode | Input | Output |
| --- | --- | --- |
| **Decode VINs** | up to 50 VINs per batch | a `VEHICLE` row each, plus recalls / complaints / ratings if you tick them |
| **Recalls** | make, model, year | `RECALL` rows |
| **Complaints** | make, model, year | `COMPLAINT` rows |
| **Safety ratings** | make, model, year | `SAFETY_RATING` rows, one per rated variant |

### Output

One `SEARCH_SUMMARY` per run, typed rows, and an `ERROR` row for anything that
failed — every input maps to at least one row.

- **`VEHICLE`** — make, model, year, body class, engine, drive type, plant, plus
  `vpicRaw` carrying all 154 decoded fields verbatim
- **`RECALL`** — campaign number, component, summary, consequence, remedy, and
  NHTSA's `parkIt` / `parkOutSide` severity flags
- **`COMPLAINT`** — ODI number, components, crash/fire booleans, injuries,
  deaths, incident date, full narrative
- **`SAFETY_RATING`** — overall, front, side, rollover stars per rated variant

#### Two things NHTSA will not tell you, that this will

**A VIN with a wrong check digit decodes into a full, plausible record.**
`1HGCM82633A004353` (one digit off) comes back as a 2003 Honda Accord with
exactly as many fields filled as the real VIN. `errorCodes` and `decodedCleanly`
are the only things that separate them — and `ErrorCode` is a comma-separated
*list* upstream (`"6,7,11,400"`), so anything treating it as a number breaks.

**An empty field means NHTSA has no data, not that the car lacks the feature.**
NHTSA says so in its own response message. 154 fields come back and ~45 are
filled; blanks are emitted as `null`, and `decodedFieldCount` tells you how many
were real.

### Honesty flags on the summary row

- `modelResolutions` — per surface: the name you asked for, the names tried, and
  how it resolved (`literal`, `exact`, `prefix-fanout`, `unknown-to-upstream`)
- `duplicateRowsDropped` — alias rows removed rather than summed
- `rejectedCombinations` — NHTSA answers a bad make, a bad model, a bad year and
  a *missing* parameter with the same HTTP 400 carrying the body `{"Count":0,
  "Message":"Results returned successfully"}`. The status is the only signal and
  it cannot say which one it was, so every rejection is listed.
- `vinsWithErrorCodes`, `vinsNotDecoded`, `timeoutsRetried`

### Known limits

- The batch VIN lookup **hangs at random and then works fine** — one probe sat
  for 180 s with zero bytes, the identical request answered in 735 ms minutes
  later. The client retries and falls back to single decodes; `timeoutsRetried`
  reports it.
- `DecodeVinValuesExtended` is not used: it returned byte-identical fields to
  the single lookup for every VIN tried.
- Safety ratings are per rated variant, not per model — one model year is
  several separately crash-tested vehicles.

# Actor input Schema

## `mode` (type: `string`):

vin = decode VINs, optionally pulling that vehicle's recalls, complaints and safety ratings in the same run. The other three query one make/model/year directly.

## `vins` (type: `array`):

For mode='vin'. 17 characters each; dashes and spaces are stripped. Decoded in batches of 50. WARNING about NHTSA itself: a VIN with a WRONG CHECK DIGIT still decodes into a full, plausible-looking record — only errorCodes and decodedCleanly separate it from a real one.

## `make` (type: `string`):

For the recalls / complaints / safetyRatings modes. Case-insensitive.

## `model` (type: `string`):

For the recalls / complaints / safetyRatings modes. api.nhtsa.gov uses its own model vocabulary: 'F-150' returns a clean zero, because it knows only 'F-150 REGULAR CAB', 'F-150 SUPER CREW' and 'F-150 SUPERCAB'. Leave the model resolver on and this is handled for you.

## `modelYear` (type: `string`):

Four-digit year, for the recalls / complaints / safetyRatings modes.

## `includeRecalls` (type: `boolean`):

After decoding each VIN, also pull that vehicle's recall campaigns.

## `includeComplaints` (type: `boolean`):

After decoding each VIN, also pull owner complaints filed with NHTSA. Popular vehicles have thousands — use Max rows.

## `includeSafetyRatings` (type: `boolean`):

After decoding each VIN, also pull NCAP crash-test star ratings. One model year is several separately rated vehicles (2-door, 4-door, with and without side airbags), so this returns a row per rated variant.

## `resolveModelName` (type: `boolean`):

On by default, and you almost certainly want it. NHTSA answers an unknown model name with HTTP 200, count 0 and 'Results returned successfully' — indistinguishable from a vehicle with no records. This looks the name up first, and when several variants match it fetches all of them and deduplicates: the F-150 variants are aliases for ONE set of 1,425 complaints, so summing them would report 4,275.

## `maxResults` (type: `integer`):

Set 0 for unlimited. In VIN mode this caps the ENRICHMENT rows per VIN (recalls + complaints + ratings) so that no vehicle you named is ever dropped from the output; in the other modes it caps the whole run.

## `maxConcurrency` (type: `integer`):

How many VINs to enrich at once in VIN mode.

## `minRequestInterval` (type: `integer`):

Politeness pacing shared across all workers. 0 uses the built-in default. NHTSA publishes no rate limit and never returned a 429 in reconnaissance; this is courtesy toward a public service, not a measured ceiling.

## `proxyConfiguration` (type: `object`):

Off by default. These are published US government open-data APIs with no WAF — there is nothing to get past.

## Actor input object example

```json
{
  "mode": "vin",
  "vins": [
    "1HGCM82633A004352",
    "5YJ3E1EA6PF384836"
  ],
  "make": "ford",
  "model": "F-150",
  "modelYear": "2015",
  "includeRecalls": false,
  "includeComplaints": false,
  "includeSafetyRatings": false,
  "resolveModelName": true,
  "maxResults": 100,
  "maxConcurrency": 4,
  "minRequestInterval": 0,
  "proxyConfiguration": {
    "useApifyProxy": false
  }
}
```

# Actor output Schema

## `items` (type: `string`):

One row per scraped record. See the dataset's default view for field definitions.

# API

You can run this Actor programmatically using our API. Below are code examples in JavaScript, Python, and CLI, as well as the OpenAPI specification and MCP server setup.

## JavaScript example

```javascript
import { ApifyClient } from 'apify-client';

// Initialize the ApifyClient with your Apify API token
// Replace the '<YOUR_API_TOKEN>' with your token
const client = new ApifyClient({
    token: '<YOUR_API_TOKEN>',
});

// Prepare Actor input
const input = {
    "vins": [
        "1HGCM82633A004352"
    ]
};

// Run the Actor and wait for it to finish
const run = await client.actor("xtracto/nhtsa-vehicles-scraper").call(input);

// Fetch and print Actor results from the run's dataset (if any)
console.log('Results from dataset');
console.log(`💾 Check your data here: https://console.apify.com/storage/datasets/${run.defaultDatasetId}`);
const { items } = await client.dataset(run.defaultDatasetId).listItems();
items.forEach((item) => {
    console.dir(item);
});

// 📚 Want to learn more 📖? Go to → https://docs.apify.com/api/client/js/docs

```

## Python example

```python
from apify_client import ApifyClient

# Initialize the ApifyClient with your Apify API token
# Replace '<YOUR_API_TOKEN>' with your token.
client = ApifyClient("<YOUR_API_TOKEN>")

# Prepare the Actor input
run_input = { "vins": ["1HGCM82633A004352"] }

# Run the Actor and wait for it to finish
run = client.actor("xtracto/nhtsa-vehicles-scraper").call(run_input=run_input)

# Fetch and print Actor results from the run's dataset (if there are any)
print(f"💾 Check your data here: https://console.apify.com/storage/datasets/{run.default_dataset_id}")
for item in client.dataset(run.default_dataset_id).iterate_items():
    print(item)

# 📚 Want to learn more 📖? Go to → https://docs.apify.com/api/client/python/docs/quick-start

```

## CLI example

```bash
echo '{
  "vins": [
    "1HGCM82633A004352"
  ]
}' |
apify call xtracto/nhtsa-vehicles-scraper --silent --output-dataset

```

## MCP server setup

```json
{
    "mcpServers": {
        "apify": {
            "type": "http",
            "url": "https://mcp.apify.com/?tools=fetch-actor-details,xtracto/nhtsa-vehicles-scraper"
        }
    }
}
```

The hosted server signs you in with OAuth on first connect, so no API token belongs in this config. Clients without OAuth support can send an `Authorization: Bearer <APIFY_API_TOKEN>` header instead, using a token from API & Integrations in Apify Console (https://console.apify.com/settings/integrations).

## OpenAPI specification

Download the OpenAPI definition: https://api.apify.com/v2/actors/lkuIjB5n7unPVbmJq/builds/0v1zogmuKvvlaR0Tq/openapi.json
