
A VIN can give a dealer tool, marketplace, fleet application or insurance workflow a consistent starting point for year, make and model—but only if the integration handles missing fields and failures as carefully as successful decodes. By the end of this guide, you can call the VIN decode endpoint, read its response envelope, branch on documented errors and decide what to cache or refresh.
Send a VIN decode request
Use POST https://vehicles-api.com/api/v1/vin/decode with a JSON body containing vin. Authenticate with the X-API-Key header; an Authorization Bearer token also works. The API base URL is https://vehicles-api.com/api/v1.
This complete request uses the documentation’s control VIN. It represents a 2003 Honda Accord, not necessarily the vehicle your user entered.
curl -X POST "https://vehicles-api.com/api/v1/vin/decode" -H "X-API-Key: YOUR_API_KEY" -H "Content-Type: application/json" -d '{"vin":"1HGCM82633A004352"}'
Replace YOUR_API_KEY with your key before running the request. In an application, obtain the VIN from the user or your vehicle record rather than leaving the control VIN in production code. Keep the key on the server or in another protected environment; do not embed it in a publicly distributed client.
The endpoint decodes 17-character VINs worldwide, with the fullest decoding for US-market vehicles. Vehicle API uses NHTSA vPIC as its VIN decoding source. A response can still have null fields when NHTSA does not publish particular values, so a successful call is not a promise that every vehicle attribute will be populated.
Read the response envelope
The official response for the request above is:
{
"status": "success",
"source": "nhtsa",
"data": {
"vin": "1HGCM82633A004352",
"valid": true,
"year": 2003,
"make": "HONDA",
"model": "Accord",
"trim": "EX-V6",
"body": "Coupe",
"doors": 2,
"vehicle_type": "PASSENGER CAR",
"engine": {
"cylinders": 6,
"displacement_l": 3,
"configuration": "V-Shaped",
"model": "J30A4",
"hp": 240,
"fuel": "Gasoline"
},
"fuel_type": "Gasoline",
"electrification_level": null,
"ev_drive_unit": null,
"battery_kwh": null,
"charger_level": null,
"charger_power_kw": null,
"drive": null,
"transmission": {
"style": "Automatic",
"speeds": 5
},
"plant": {
"country": "UNITED STATES (USA)",
"city": "MARYSVILLE",
"state": "OHIO"
},
"manufacturer": "AMERICAN HONDA MOTOR CO., INC."
}
}
Read status before treating data as a decoded vehicle. The envelope’s source identifies the data source; here it is nhtsa. An error response instead has an error status and an error object containing code and message.
The primary fields for this integration are data.year, data.make and data.model. In this example they are the number 2003 and the strings HONDA and Accord. Keep the field names separate in your storage or application model, even if you combine them for a display label.
Use data.vin to associate the response with the requested vehicle identifier, and inspect data.valid rather than inferring validity from a display label. The example also includes trim, body, doors and vehicle_type for applications that need more detail than year, make and model.
Engine, transmission and plant details are nested under engine, transmission and plant. For example, engine.displacement_l is displacement in litres, while engine.hp is horsepower. These attributes are useful context, but they should not replace the VIN or the separate year, make and model fields in your records.
The control vehicle uses gasoline. Its electrification and charging fields are null, as is drive. Preserve null as unavailable rather than converting it to zero, an empty specification or an assertion about the vehicle. Likewise, avoid assuming that a nested attribute will always be present for every VIN.
Integrate the decode in Python
The following standard-library example calls the same endpoint and reads the three primary fields. It handles documented error codes without trying to interpret the human-readable error message as a stable identifier. Replace the key and, in your application, supply the actual VIN to decode_vin.
import json
import sys
from urllib.error import HTTPError, URLError
from urllib.request import Request, urlopen
API_KEY = "YOUR_API_KEY"
URL = "https://vehicles-api.com/api/v1/vin/decode"
def decode_vin(vin):
payload = json.dumps(dict(vin=vin)).encode("utf-8")
request = Request(
URL,
data=payload,
headers=dict(
[
("X-API-Key", API_KEY),
("Content-Type", "application/json"),
]
),
method="POST",
)
try:
with urlopen(request) as response:
result = json.load(response)
except HTTPError as exc:
try:
result = json.load(exc)
except (ValueError, UnicodeDecodeError):
result = dict()
error = result.get("error") or dict()
code = error.get("code")
message = error.get("message") or "Request failed"
if exc.code == 502:
action = "Upstream unavailable; retry with backoff"
elif code == "invalid_api_key":
action = "Check the API key"
elif code == "no_active_plan":
action = "Check the active plan"
elif code == "not_found":
action = "Review the lookup input"
elif code == "invalid_vin":
action = "Correct the VIN"
elif code in ("invalid_plate", "invalid_vehicle", "coverage_us_only"):
action = "Review the input or coverage"
elif code == "rate_limit_exceeded":
action = "Slow requests and retry later"
elif code == "quota_exceeded":
action = "Check the monthly quota"
else:
action = "Review the error and documentation"
raise RuntimeError(
f"{action}: HTTP {exc.code}, {code}, {message}"
) from exc
except URLError as exc:
raise RuntimeError("Could not reach Vehicle API") from exc
if result.get("status") != "success":
error = result.get("error") or dict()
raise RuntimeError(
f"Decode failed: {error.get('code')}, {error.get('message')}"
)
data = result.get("data") or dict()
return data.get("year"), data.get("make"), data.get("model")
try:
year, make, model = decode_vin("1HGCM82633A004352")
print("Year:", year)
print("Make:", make)
print("Model:", model)
except RuntimeError as exc:
print(exc, file=sys.stderr)
sys.exit(1)
The sample reports a retry action for an upstream failure; it does not implement a retry loop. In production, schedule bounded retries with backoff for that condition and handle network failures according to your application’s policy. A failed decode should remain visibly unresolved instead of silently populating a vehicle with the example’s values.
The code uses get for the requested fields, so missing or null values appear as Python None. Decide whether your workflow can proceed with an incomplete result or needs a user review. For example, a listing form can show the returned values for confirmation without treating an absent field as a decoding failure.
Handle errors and usage limits
Use the HTTP status to understand the broad outcome and error.code for the documented application-specific branch. Keep error.message available for diagnostics, but do not make the wording your program’s decision key.
- 401,
invalid_api_key: check the configured key and authentication header. Repeating the request unchanged will not correct the credential. - 403,
no_active_plan: check the account’s plan before retrying. - 404,
not_found: review the lookup input and present a no-result state rather than a vehicle record. - 422,
invalid_vin: ask for the VIN to be corrected. The API also documentsinvalid_plate,invalid_vehicleandcoverage_us_onlyfor input or coverage problems in relevant lookups; do not label all 422 responses as an invalid VIN. - 429,
rate_limit_exceeded: reduce request pressure and retry later. 429,quota_exceeded: check the monthly quota and plan rather than continuously retrying. - 502, upstream unavailable: retry with backoff. Use the status for this branch; do not assume an undocumented
error.codevalue.
Rate limits and monthly quota are distinct operational constraints. A short burst can require a slower request rate, whereas an exhausted monthly quota needs account or quota attention. Check the current plan details in the Documentation; do not hard-code a limit that has not been confirmed for your plan.
For user-facing flows, distinguish a correction the user can make from an account or upstream problem. An invalid VIN can return the user to the input field; a plan or provider issue should not ask them to repeatedly re-enter the same VIN. Log the status and documented error code with enough context to investigate, while protecting API credentials.
Cache decoded data and respect coverage
Cache successful decode results by VIN so repeated views of the same vehicle do not require repeated decoding. Store the separate year, make and model values, along with any additional decoded fields your application uses. Retaining the source and when your application retrieved the result helps you decide when to refresh or investigate a change.
Choose a refresh policy for your own workflow rather than assuming the example response is permanently complete. NHTSA may not publish every attribute, and an unavailable value should remain distinguishable from a value your application has confirmed. If a user edits a decoded display value, keep that action distinct from the source data where your product needs an audit trail.
Safety information has a different refresh requirement. Vehicle API also provides official US recall campaigns, owner complaints and NCAP crash ratings, matched by make, model and year. Those safety datasets cover US-market vehicles only; a worldwide VIN decode does not extend their coverage worldwide. Refresh recall and complaint data because NHTSA adds new data, rather than treating a cached decode as a current safety-data check.
Make the matching scope clear in the interface: make, model and year are useful for finding applicable US-market safety data, but a match is not a VIN-specific vehicle history. Vehicle API is not a vehicle history report and does not provide title, accident or ownership history. Do not present decoded specifications or model-level safety data as proof of an individual vehicle’s past.
Vehicle API also supports Dutch plate data from RDW open data; Dutch plate results never include a VIN. Keep a plate lookup separate from this VIN decode flow and do not assume you can obtain a VIN from a Dutch plate result. For AI-agent integrations, the MCP server provides another way to access Vehicle API capabilities; the request and response examples in this guide are for the REST endpoint.
FAQ
Can I decode a VIN from outside the United States?
Yes. The endpoint decodes 17-character VINs worldwide, though results are fullest for US-market vehicles. Individual fields can be null when NHTSA does not publish them.
Does a successful decode include current recalls?
The decode response shown here contains vehicle specifications, not a current recall result. US-market recall and complaint data should be refreshed separately because NHTSA adds new data, and safety data is matched by make, model and year.
What should I do with a null year, make or model?
Treat the value as unavailable, not as zero or a verified blank. Preserve the returned data and give the user a way to review or complete the record if your workflow requires that field.
Should I retry every failed request?
No. Retry an upstream 502 with backoff and slow down for a rate limit. Correct invalid input or credentials, resolve an inactive plan, and check monthly quota exhaustion before making the same request again.
Register to start the 7-day free trial and test the decode with your own VINs. Every plan includes the trial; Starter is $19 per month.