
You need to reliably turn a VIN into year, make, and model on the server so your app can list accurate vehicles, validate user input, and match records against US-market safety datasets. By the end of this guide, you’ll post a VIN to Vehicle API, parse the year/make/model fields you actually need, handle errors, cache results, and ship production-ready server-side code in Python or PHP.
What this endpoint does and how far it goes
The Vehicle API VIN decoder turns any 17-character VIN into structured data and returns a consistent JSON envelope: status, source, and data. The year, make, and model fields are included whenever the VIN is valid.
- VIN decoding coverage: worldwide; data is fullest for US-market vehicles.
- US safety datasets (recalls, owner complaints, NCAP crash ratings): US-market only and matched by make + model + year (not by VIN directly).
- Dutch plates: sourced from RDW open data and never include a VIN.
- This is not a vehicle history report (no title, accident, or ownership history).
The API is available as a JSON REST API at https://vehicles-api.com and as an MCP server at https://vehicles-api.com/mcp for agentic workflows.
Endpoint and authentication
Base URL: https://vehicles-api.com/api/v1
Endpoint for VIN Year Make Model: POST /vin/decode
- Auth headers: X-API-Key: YOUR_API_KEY (recommended). Authorization: Bearer YOUR_API_KEY also works.
- Content-Type: application/json
Use this endpoint server-side only. Never ship API keys in browser code.
Official cURL request
Copy this cURL exactly to post a VIN and get a structured response:
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"}'
Official JSON response
{
"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."
}
}
You’ll primarily read these fields:
- data.year: integer model year (e.g., 2003).
- data.make: manufacturer name in uppercase (e.g., HONDA).
- data.model: model line (e.g., Accord).
Other fields may be present or null. Electrification-related keys are null for gasoline vehicles. If a field isn’t published by the source, it is returned as null rather than omitted, so your parser can rely on stable keys.
Python server-side integration (requests)
This example posts the VIN, enforces a timeout, checks the response envelope (status/source/data), handles errors via error.code and error.message, and extracts year/make/model. Use json= for POST bodies. When you add other GET endpoints, pass query strings with params=; for VIN decoding, POST is required.
import requests
API_BASE = "https://vehicles-api.com/api/v1"
API_KEY = "YOUR_API_KEY"
TIMEOUT_SECONDS = 6.0
def decode_vin(vin: str) -> dict:
url = f"{API_BASE}/vin/decode"
headers = {
"X-API-Key": API_KEY,
"Content-Type": "application/json",
}
# Tip: also works with Authorization: Bearer YOUR_API_KEY if preferred
try:
resp = requests.post(
url,
headers=headers,
json={"vin": vin},
timeout=TIMEOUT_SECONDS,
)
except requests.exceptions.Timeout:
raise RuntimeError("Vehicle API request timed out")
except requests.exceptions.RequestException as e:
raise RuntimeError(f"Vehicle API network error: {e}")
# Expect a JSON envelope with status, source, data OR status error with error.code, error.message
try:
payload = resp.json()
except ValueError:
raise RuntimeError(f"Vehicle API returned non-JSON (status {resp.status_code})")
if payload.get("status") != "success":
err = payload.get("error") or {}
code = err.get("code", "unknown_error")
msg = err.get("message", "Unspecified error")
raise RuntimeError(f"Vehicle API error [{code}]: {msg}")
data = payload.get("data") or {}
# Guard against nulls; year/make/model should exist for valid VINs
year = data.get("year")
make = data.get("make")
model = data.get("model")
if not all([year, make, model]):
# For invalid or partial decodes, decide whether to reject or continue gracefully
raise ValueError("VIN decoded but missing year, make, or model")
return {
"vin": data.get("vin"),
"year": year,
"make": make,
"model": model,
# Keep the full payload if you plan to cache it
"raw": data,
"source": payload.get("source"),
}
if __name__ == "__main__":
result = decode_vin("1HGCM82633A004352")
print(f"{result['year']} {result['make']} {result['model']} (VIN {result['vin']})")
Notes for production:
- Timeouts: set a client-side timeout and handle retries cautiously. VIN decoding is idempotent; safe to retry on transient network errors.
- Caching: cache decoded VINs (e.g., Redis) since the same VIN is often requested repeatedly in dealer, marketplace, and fleet workflows.
- Null handling: treat unknown fields as null rather than missing keys; don’t assume optional attributes are always populated.
- Security: keep keys server-side; never embed in client JavaScript or mobile binaries.
PHP server-side integration (cURL)
This PHP example posts the VIN with a short timeout, checks the standard envelope, and extracts year/make/model. It uses cURL directly; you can substitute your preferred HTTP client.
<?php
function decodeVin(string $vin): array {
$url = "https://vehicles-api.com/api/v1/vin/decode";
$payload = json_encode(["vin" => $vin]);
$ch = curl_init($url);
curl_setopt_array($ch, [
CURLOPT_RETURNTRANSFER => true,
CURLOPT_POST => true,
CURLOPT_HTTPHEADER => [
"X-API-Key: YOUR_API_KEY",
"Content-Type: application/json",
],
CURLOPT_POSTFIELDS => $payload,
CURLOPT_TIMEOUT => 6, // seconds
CURLOPT_CONNECTTIMEOUT => 3,
]);
$raw = curl_exec($ch);
if ($raw === false) {
$err = curl_error($ch);
curl_close($ch);
throw new RuntimeException("Vehicle API network error: $err");
}
$httpCode = curl_getinfo($ch, CURLINFO_HTTP_CODE);
curl_close($ch);
$json = json_decode($raw, true);
if (!is_array($json)) {
throw new RuntimeException("Vehicle API returned non-JSON (HTTP $httpCode)");
}
if (($json["status"] ?? null) !== "success") {
$err = $json["error"] ?? [];
$code = $err["code"] ?? "unknown_error";
$msg = $err["message"] ?? "Unspecified error";
throw new RuntimeException("Vehicle API error [$code]: $msg");
}
$data = $json["data"] ?? [];
$year = $data["year"] ?? null;
$make = $data["make"] ?? null;
$model = $data["model"] ?? null;
if (!$year || !$make || !$model) {
throw new RuntimeException("VIN decoded but missing year, make, or model");
}
return [
"vin" => $data["vin"] ?? null,
"year" => $year,
"make" => $make,
"model" => $model,
"source" => $json["source"] ?? null,
"raw" => $data, // retain for caching and downstream lookups
];
}
try {
$result = decodeVin("1HGCM82633A004352");
echo $result["year"] . " " . $result["make"] . " " . $result["model"] . PHP_EOL;
} catch (Throwable $e) {
// Map to your app’s error handling and logging
error_log($e->getMessage());
http_response_code(502);
echo "Failed to decode VIN";
}
Response envelope, errors, and nulls
Every response is wrapped in an envelope. On success:
- status: "success"
- source: data origin (e.g., "nhtsa")
- data: object with fields such as vin, year, make, model
On error:
- status: "error"
- error.code: short machine-readable code
- error.message: human-readable explanation
Null fields: when a source doesn’t publish a field, it is present but null (example: electrification fields for a gasoline vehicle). Code defensively against nulls; don’t assume optional attributes are always populated.
Practical integration details that save time
Server-only keys and timeouts
Keep API keys on the server. Add both a connect timeout and a total timeout. The examples above use 3 seconds connect and 6 seconds total as a starting point.
Caching decoded VINs
VIN decoding is read-heavy and deterministic. Cache by VIN for hours or days to minimize latency and stay well within quotas and rate limits. Most apps see strong cache hits across inventory lists, form validations, and unified vehicle profiles.
Mapping to US safety datasets
- Recalls, owner complaints, and NCAP crash ratings are US-market only.
- They are matched by make + model + year, not by VIN. Use the decoded fields from this endpoint to perform those lookups in your system.
Dutch plates (RDW)
Dutch plate lookups come from RDW open data and do not include a VIN. Use VIN decoding separately if you need year/make/model from a VIN. Do not expect a plate-to-VIN join in the Dutch dataset.
Rate limits and monthly quota
Vehicle API enforces rate limits and monthly quotas by plan. If you anticipate bursts (e.g., nightly imports), add client-side throttling and caching. For current limits and quotas, see the Documentation.
Plans and trial
The Starter plan is $19/month and every plan includes a 7-day free trial. You can register and start testing now.
Field-by-field: focus on year, make, model
For dealer tools, marketplaces, fleet and insurance apps, these three fields are the backbone of normalization and search:
- year: the integer model year. Store as an integer for quick indexing and range queries.
- make: manufacturer string (uppercased). Normalize to a canonical form in your DB if you join with other datasets.
- model: model line string. Preserve case where needed for display; for joins, normalize whitespace and dashes consistently.
Minimal example of extracting and storing these fields (pseudocode):
# after you have payload from the API:
record = {
"vin": data["vin"],
"year": int(data["year"]),
"make": data["make"].upper(),
"model": data["model"],
"source": source,
"fetched_at": now(),
}
# store in cache + database for deduplication and reuse
Testing, monitoring, and resilience
- Input validation: ensure VINs are 17 characters before calling the API; short-circuit early to reduce unnecessary requests.
- Retries: retry idempotent calls on network timeouts with exponential backoff and jitter. Avoid retry storms by honoring your rate limits.
- Observability: log status, source, latency, and whether year/make/model were present. Track null-rate for optional attributes to improve your UI fallbacks.
- Cold starts: warm your cache with the VINs you already know from inventory lists to reduce p95 latency during user sessions.
Using the MCP server for AI agents
If you are building AI agents that need to decode VINs directly inside a tool-enabled runtime, connect to the MCP server at https://vehicles-api.com/mcp. It exposes the same capability with a consistent contract, ideal for tool-use patterns that need authoritative year/make/model before planning subsequent actions.
Security, privacy, and compliance basics
- Do not embed API keys in front-end code. Call Vehicle API from your server.
- Scope keys per environment (dev, staging, prod) and rotate periodically.
- Log redaction: avoid logging full VINs in plaintext. Store hashes where feasible; show full VINs only in privileged UIs.
End-to-end example flow you can deploy
- Receive a VIN from a user form, CSV import, or upstream integration.
- Validate length (17 chars). Reject early if invalid shape.
- Check your cache by VIN. If hit, return year/make/model immediately.
- If miss, POST to /vin/decode with json={"vin": "..."} and a timeout.
- Check status == "success". If error, surface error.message to logs and return a safe failure to the user.
- Extract data.year, data.make, data.model. If any are missing, handle as an application-level validation error.
- Persist the full payload for observability and future joins (e.g., mapping to US recalls by make/model/year).
- Return normalized year/make/model to your caller.
Link roundup
- Register for the 7-day free trial and get your API key.
- Read the full Documentation for limits and additional endpoints.
- Explore the MCP server for agentic workflows: MCP.
- Home: https://vehicles-api.com
- More product info: Vehicle API
FAQ
Does VIN decoding work outside the United States?
Yes. The VIN decoder works worldwide. Coverage is fullest for US-market vehicles. US safety data (recalls, complaints, NCAP ratings) are US-market only and matched by make + model + year.
Can I look up US plates?
Do not plan on a US plate lookup in your integration. For Dutch registrations, RDW open data is supported but does not include a VIN.
What should I do with null fields?
Null indicates the data source doesn’t publish the value (for example, electrification fields on a gasoline vehicle). Keep your schema stable and handle nulls gracefully in your UI and joins.
How are errors returned?
Errors return an envelope with status = "error" and include error.code and error.message. Check status before reading data.
How do I stay within rate limits?
Cache decoded VINs, validate inputs before calling the API, and add short client-side timeouts and backoff. See the Documentation for current quotas and limits.
Ready to ship a VIN Year Make Model integration? Start your 7-day free trial and get your API key here: Register.