
Vehicle listings and fleet records often need a body style and door count before a developer can build filters or display a useful vehicle summary. This guide shows how to decode a VIN with Vehicle API, read the body and doors fields, and handle missing data without turning an unknown value into a misleading one.
Request a VIN decode
Send the VIN to the POST /vin/decode endpoint. The base URL is https://vehicles-api.com/api/v1, and the request authenticates with the X-API-Key header. Authorization Bearer also works, but the examples here use the API key header.
The following request uses the control VIN from the official documentation. It identifies a 2003 Honda Accord; replace it with the VIN you need to decode when integrating the endpoint into your application.
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"}'
Vehicle API decodes 17-character VINs worldwide, with the fullest data for US-market vehicles. Decoding draws on NHTSA vPIC data, and fields that NHTSA does not publish can be returned as null. A successful request therefore does not guarantee that every vehicle attribute is populated.
Read the official response
The response is an envelope: status describes the outcome, source identifies the data source, and data contains the decoded vehicle. This is the official response for the control VIN:
{
"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."
}
}
For a body-style integration, the primary fields are data.body, which is Coupe in this example, and data.doors, which is the integer 2. The door value is a count, not a measurement. Read both from data after checking the response status.
Use data.vin to associate the result with the requested vehicle, and inspect data.valid before treating the decode as usable. The example also supplies year, make, model, and trim, which provide context for a listing or a review screen. These are the control vehicle’s values, not defaults for another VIN.
Interpret the decoded fields
body is the decoded body-style label; vehicle_type is a broader vehicle classification. Keep them separate in your data model: the example reports a coupe body and a passenger-car vehicle type. Similarly, doors is a separate count rather than something your application needs to derive from the body label.
If either body style or door count is null, preserve that distinction in storage and presentation. Displaying “Unknown” or leaving a field unset is more accurate than substituting an empty string, a door count of zero, or a body style inferred from the model. A filter for a known door count should not silently treat an unknown count as a match.
The nested engine object gives additional vehicle context. In the example, cylinders is a count, displacement_l is measured in liters, and hp is horsepower. configuration, model, and fuel are descriptive values; the top-level fuel_type also reports gasoline for this vehicle.
The electric-vehicle fields are null for this gasoline control vehicle. Where present, battery_kwh is measured in kilowatt-hours and charger_power_kw in kilowatts; electrification_level, ev_drive_unit, and charger_level describe other electrification attributes. A null value means no value was supplied in the response, not a numeric zero.
drive is also null in the example, so the response should not be used to assign a drive configuration. The transmission object reports a style and a speed count. The plant object gives assembly country, city, and state, while manufacturer identifies the manufacturer returned by the source.
These supporting fields can help a user review a decode, but they are not substitutes for body or doors. Store the source value alongside the decode when provenance matters, and avoid changing the returned label into a more specific classification without a separate, explicit mapping policy.
Use the body style in Python
This example uses the requests package to call the same endpoint and read the two fields. It checks the HTTP outcome and the response envelope before accessing data, and it keeps missing values separate from known values.
import requests
url = "https://vehicles-api.com/api/v1/vin/decode"
headers = {"X-API-Key": "YOUR_API_KEY"}
payload = dict(vin="1HGCM82633A004352")
response = requests.post(url, headers=headers, json=payload, timeout=30)
try:
envelope = response.json()
except requests.exceptions.JSONDecodeError as exc:
raise RuntimeError("Vehicle API returned a non-JSON response") from exc
if not response.ok or envelope.get("status") != "success":
error = envelope.get("error") or dict()
code = error.get("code")
message = error.get("message")
raise RuntimeError(f"Vehicle API error: {code} — {message}")
data = envelope.get("data") or dict()
if not data.get("valid"):
raise RuntimeError("The response did not contain a valid VIN decode")
body = data.get("body")
doors = data.get("doors")
print("VIN:", data.get("vin"))
print("Source:", envelope.get("source"))
print("Body style:", body if body is not None else "Unknown")
print("Doors:", doors if doors is not None else "Unknown")
Replace YOUR_API_KEY with your key before running the sample, and supply the VIN from your application rather than leaving the control VIN in production. The code uses is not None so that it tests for a missing value explicitly instead of relying on whether a value is truthy.
For a user-facing form, validate that the submitted VIN has 17 characters before sending it. Still handle an unsuccessful decode: a length check alone does not establish that a VIN is valid or that a body style is available. If the decode is valid but either target field is null, the application can continue with that attribute marked unknown.
Plan for errors, caching, and coverage
Error responses use status with error.code and error.message, rather than the success envelope’s vehicle data. Capture the code and message for diagnosis, but do not assume every failure is a missing body style. Authentication, request, and service problems need a different response from a successful decode containing a null field.
Check the Documentation for current error codes and account-specific rate and monthly quota details. Rate limits govern request pace; a monthly quota governs usage over the billing period. Design the integration to surface a limit-related failure rather than repeatedly submitting the same VIN without checking the cause.
Cache successful decoded VIN results when the same vehicle is likely to be viewed or processed repeatedly. Store the VIN, the returned body and door values, and enough context to distinguish a cached result from a fresh decode. Choose a refresh policy appropriate to your application, because source data can change; do not cache a transient request failure as if it were a permanent unknown body style.
Preserve nulls in the cache as nulls. A null body on a successful decode is useful information about that response, while a failed request does not establish what the body style is. Keeping those states distinct helps a listing editor decide whether to leave an attribute blank, request a refresh, or investigate an error.
VIN decoding is available worldwide, but data is fullest for US-market vehicles. Vehicle API also provides official US safety data for recall campaigns, owner complaints, and NCAP crash ratings; those safety data are US-market only and matched by make, model, and year. They should not be presented as a VIN-specific history of the individual vehicle.
Dutch plate data comes from RDW open data, and Dutch plate responses never include a VIN. Vehicle API is not a vehicle history report: it does not provide title, accident, or ownership history. Developers building AI agents can also use the MCP server, while applying the same coverage and null-value distinctions when an agent presents results.
FAQ
Which field contains the VIN body style?
Read data.body from a successful VIN decode. In the official control response it is Coupe; a different VIN can return a different value or null.
Can I use body style to determine the number of doors?
Read data.doors directly instead. If the door count is null, retain it as unknown rather than deriving a count from the body-style label.
Why can a successful decode contain null fields?
The decode can succeed even when NHTSA does not publish every attribute. Null indicates that the response does not supply a value for that field; it should not automatically be interpreted as zero or as an error.
Does a VIN decode include the vehicle’s accident or ownership history?
No. The decode supplies vehicle attributes, not title, accident, or ownership history. US safety data is matched by make, model, and year and is not a substitute for an individual vehicle history report.
How should I handle repeated requests for the same VIN?
Cache successful decodes and refresh them according to your application’s needs. Check current rate limits and monthly quota details before choosing your request strategy, and handle error codes separately from null decoded fields.
To try the endpoint with your own VIN, Register for a 7-day free trial. Every plan includes the trial, and Starter is $19 per month.