# Recalls

NHTSA recall campaigns issued for the car's model year, make and model (`scope: year_make_model`). This is not a per-VIN result: it does not say whether this car is included in a campaign or has been repaired.
Until the year, make and model has been fetched from NHTSA the answer is `503 reference_data_pending`. When NHTSA answered nothing for the model under any name we tried, in any dataset, the answer is `404 reference_no_match`: an empty list is returned only for a model NHTSA is known to carry. Neither is billed.

## Endpoint

```
GET https://api.motorsdynamic.com/api/v2/recalls/{vin}
```

## Plan and price

| Plan | Access | Price |
| --- | --- | --- |
| Free | Yes | included in the 1,000 monthly calls |
| Growth | Yes | $0.005 per call |
| Scale | Yes | $0.003 per call |
| Enterprise | Yes | contract |

A call is billed when it answers 2xx. See [pricing](https://developers.motorsdynamic.com/pricing.md).

## Parameters

| Name | In | Type | Required | Description |
| --- | --- | --- | --- | --- |
| `vin` | path | string | yes | 17-character VIN (case-insensitive). |

## Example request

curl:

```bash
curl "https://api.motorsdynamic.com/api/v2/recalls/1HGCM82633A004352" \
  -H "x-api-key: $MD_API_KEY"
```

JavaScript:

```javascript
const res = await fetch("https://api.motorsdynamic.com/api/v2/recalls/1HGCM82633A004352", {
  headers: { "x-api-key": process.env.MD_API_KEY },
});
if (!res.ok) throw new Error(`${res.status} ${(await res.json()).error}`);
const data = await res.json();
console.log(data);
```

Python:

```python
import os, requests

res = requests.get(
    "https://api.motorsdynamic.com/api/v2/recalls/1HGCM82633A004352",
    headers={"x-api-key": os.environ["MD_API_KEY"]},
    timeout=10,
)
res.raise_for_status()
print(res.json())
```

## Response fields

| Field | Type | Description |
| --- | --- | --- |
| `meta` | object |  |
| `meta.reference_status` | `loaded` or `no_decode` | loaded = fetched from the source, so an empty result is real; no_decode = the VIN has no usable year, make and model. A model not fetched yet is 503 reference_data_pending. |
| `data` | object |  |
| `data.vin` | string |  |
| `data.vehicle` | object |  |
| `data.vehicle.year` | integer or null |  |
| `data.vehicle.make` | string or null |  |
| `data.vehicle.model` | string or null |  |
| `data.vehicle.trim` | string or null |  |
| `data.scope` | `year_make_model` |  |
| `data.vin_specific` | `false` |  |
| `data.notice` | string |  |
| `data.count` | integer |  |
| `data.recalls[]` | array of object |  |
| `data.recalls[].campaign_number` | string |  |
| `data.recalls[].manufacturer` | string or null |  |
| `data.recalls[].component` | string or null |  |
| `data.recalls[].summary` | string or null |  |
| `data.recalls[].consequence` | string or null |  |
| `data.recalls[].remedy` | string or null |  |
| `data.recalls[].notes` | string or null |  |
| `data.recalls[].report_received_date` | string or null |  |
| `data.recalls[].park_it` | boolean |  |
| `data.recalls[].park_outside` | boolean |  |
| `data.recalls[].over_the_air_update` | boolean or null | null when the source does not say (NHTSA's bulk recall file has no such field). |
| `data.recalls[].source_url` | string |  |
| `data.freshness` | object |  |
| `data.freshness.fetched_at` | string or null |  |
| `data.provenance` | object |  |
| `data.provenance.source` | `nhtsa_recalls` |  |
| `data.provenance.source_url` | string |  |
| `data.provenance.nhtsa_models[]` | array of string | The NHTSA model names this answer came from (NHTSA's names differ from the decode's: Silverado is SILVERADO 1500). |

## Errors

| Status | Code | When |
| --- | --- | --- |
| 400 | `invalid_parameter` | A parameter is missing or malformed. The message names it. |
| 401 | `invalid_api_key` | The key is missing, revoked or mistyped. |
| 403 | `not_entitled` | The key may not read this dealer or source. |
| 404 | `not_found` | Nothing matches the identifier in the path. |
| 429 | `rate_limited or quota_exceeded` | Slow down (see `Retry-After`), or the Free monthly calls are used up. |
| 503 | `error` | See the message. |
| 504 | `query_timeout` | The query passed its 4 second budget. Narrow the filters. Not billed. |

Every error has the same body: `{ "error": "<code>", "message": "..." }`. Full list: [errors](https://developers.motorsdynamic.com/docs/errors.md).
