
You have inventory photos, a VIN, and a checkout flow — but pricing, insurance, and parts all hinge on the exact trim level. By the end of this guide, you’ll integrate the Vehicle API VIN Trim Level endpoint server-side, decode a VIN into year/make/model/trim reliably, handle errors and timeouts, and cache results so your app is fast and predictable.
What this endpoint solves and when to use it
The VIN Trim Level endpoint decodes any 17-character VIN worldwide and returns normalized details, including the trim. It’s the starting point for pairing vehicles to features, options, pricing guides, parts catalogs, and underwriting logic. Coverage is fullest for US-market vehicles because the source is NHTSA vPIC; fields that NHTSA doesn’t publish may be null.
Vehicle safety data such as recall campaigns, owner complaints, and NCAP crash ratings are also US-market only and matched by make + model + year, not by VIN. Dutch registration (plate) data is sourced from RDW and never includes a VIN. Vehicle API is not a vehicle history report; it does not provide title, accident, or ownership history.
Endpoint and authentication
Base URL: https://vehicles-api.com/api/v1
- Endpoint: POST /vin/decode
- Headers: X-API-Key: YOUR_API_KEY (Authorization: Bearer YOUR_API_KEY also works)
- Content-Type: application/json
All responses are returned in a standard envelope with the following top-level keys:
- status: "success" or "error"
- source: data provider name on success (e.g., "nhtsa")
- data: object on success, absent on error
- error: object on error with error.code and error.message
For the VIN Trim Level endpoint, the request body is a JSON object with a single required field: vin.
Official cURL and JSON example
Use the following request to decode the control VIN. This is a known sample for documentation and testing. It decodes to a 2003 Honda Accord EX-V6 (the trim field is the core target).
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 envelope and payload:
{
"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."
}
}
Field focus: trim and other attributes you will use
The trim field is the primary purpose of this endpoint for pricing and equipment mapping. In the example above, data.trim is "EX-V6". Downstream systems typically use:
- year, make, model: basis for safety data matching (recalls, complaints, NCAP) in the US market.
- trim: SKU-equivalent for features/options and insurance group mappings.
- body, doors, vehicle_type: listing templates and retail filters.
- engine: normalization for parts and underwriting (cylinders, displacement_l, configuration, hp, fuel).
- transmission.style and transmission.speeds: merchandising and valuation adjustments.
- plant and manufacturer: provenance fields for OEM and compliance reporting.
Null fields are expected in some cases. Electrification-related fields (electrification_level, battery_kwh, charger_level, charger_power_kw, ev_drive_unit) are null for the control VIN because it is a gasoline vehicle. Some drive or equipment fields may be null if the source does not publish them for that VIN. Do not attempt to infer nulls on your own; instead, fall back to year/make/model-level defaults or prompt a manual review workflow.
VIN decoding is available worldwide, but coverage depth is fullest for US-market vehicles. Safety data (recalls, complaints, NCAP) is US-market only and is matched by year + make + model, not by VIN. Dutch plates from RDW do not carry VIN data.
Python server-side integration (requests)
This example shows a production-friendly POST call with json=, headers, a short timeout, and structured error handling using the response envelope (status, error.code, error.message). Never ship your API key in browser code; keep calls server-side.
import requests
API_URL = "https://vehicles-api.com/api/v1/vin/decode"
API_KEY = "YOUR_API_KEY" # store securely (env var, secret manager)
def decode_vin(vin: str, timeout_seconds: float = 5.0) -> dict:
headers = {
"X-API-Key": API_KEY,
"Content-Type": "application/json",
}
try:
resp = requests.post(
API_URL,
headers=headers,
json={"vin": vin},
timeout=timeout_seconds,
)
except requests.exceptions.Timeout:
# surface a retriable error to your caller
return {
"status": "error",
"error": {"code": "timeout", "message": "Request timed out"}
}
except requests.exceptions.RequestException as e:
return {
"status": "error",
"error": {"code": "network_error", "message": str(e)}
}
# Parse the standard envelope
try:
payload = resp.json()
except ValueError:
return {
"status": "error",
"error": {"code": "invalid_json", "message": "Non-JSON response"}
}
# The API always returns status: success|error at top-level
if payload.get("status") != "success":
err = payload.get("error") or {}
return {
"status": "error",
"error": {
"code": err.get("code", "unknown_error"),
"message": err.get("message", "Unknown error"),
},
}
data = payload.get("data") or {}
# Pull out fields you need; handle nulls without guessing
result = {
"vin": data.get("vin"),
"valid": data.get("valid"),
"year": data.get("year"),
"make": data.get("make"),
"model": data.get("model"),
"trim": data.get("trim"),
"body": data.get("body"),
"doors": data.get("doors"),
"engine": data.get("engine"), # may include cylinders, hp, etc.
"transmission": data.get("transmission"),
"fuel_type": data.get("fuel_type"),
"electrification_level": data.get("electrification_level"), # can be null
"drive": data.get("drive"), # can be null
"plant": data.get("plant"),
"manufacturer": data.get("manufacturer"),
"source": payload.get("source"), # e.g., "nhtsa"
}
return {"status": "success", "data": result}
# Example usage (do not hardcode keys in frontend code)
if __name__ == "__main__":
decoded = decode_vin("1HGCM82633A004352")
if decoded["status"] == "success":
v = decoded["data"]
print(f"{v['year']} {v['make']} {v['model']} — trim: {v['trim']}")
else:
print(f"Error: {decoded['error']['code']} - {decoded['error']['message']}")
Note: For other GET endpoints in Vehicle API, pass query strings using params= in requests.get(...). The VIN Trim Level endpoint shown here is POST and uses json=.
PHP (cURL) server-side integration
This PHP example posts the VIN payload, sets the X-API-Key header, enforces a timeout, and decodes the envelope while surfacing error.code and error.message upstream.
<?php
$apiUrl = "https://vehicles-api.com/api/v1/vin/decode";
$apiKey = "YOUR_API_KEY"; // store in env or secrets manager
function decodeVin($vin, $timeoutSeconds = 5) {
global $apiUrl, $apiKey;
$ch = curl_init($apiUrl);
$payload = json_encode(["vin" => $vin]);
curl_setopt_array($ch, [
CURLOPT_RETURNTRANSFER => true,
CURLOPT_HTTPHEADER => [
"X-API-Key: " . $apiKey,
"Content-Type: application/json",
],
CURLOPT_POST => true,
CURLOPT_POSTFIELDS => $payload,
CURLOPT_TIMEOUT => $timeoutSeconds,
]);
$raw = curl_exec($ch);
if ($raw === false) {
$err = curl_error($ch);
curl_close($ch);
return [
"status" => "error",
"error" => ["code" => "network_error", "message" => $err]
];
}
curl_close($ch);
$resp = json_decode($raw, true);
if ($resp === null) {
return [
"status" => "error",
"error" => ["code" => "invalid_json", "message" => "Non-JSON response"]
];
}
if (!isset($resp["status"]) || $resp["status"] !== "success") {
$e = isset($resp["error"]) ? $resp["error"] : [];
return [
"status" => "error",
"error" => [
"code" => isset($e["code"]) ? $e["code"] : "unknown_error",
"message" => isset($e["message"]) ? $e["message"] : "Unknown error"
]
];
}
$data = isset($resp["data"]) ? $resp["data"] : [];
// Extract normalized values; allow nulls for fields not provided by source
return [
"status" => "success",
"data" => [
"vin" => isset($data["vin"]) ? $data["vin"] : null,
"valid" => isset($data["valid"]) ? $data["valid"] : null,
"year" => isset($data["year"]) ? $data["year"] : null,
"make" => isset($data["make"]) ? $data["make"] : null,
"model" => isset($data["model"]) ? $data["model"] : null,
"trim" => isset($data["trim"]) ? $data["trim"] : null,
"body" => isset($data["body"]) ? $data["body"] : null,
"doors" => isset($data["doors"]) ? $data["doors"] : null,
"engine" => isset($data["engine"]) ? $data["engine"] : null,
"transmission" => isset($data["transmission"]) ? $data["transmission"] : null,
"fuel_type" => isset($data["fuel_type"]) ? $data["fuel_type"] : null,
"electrification_level" => isset($data["electrification_level"]) ? $data["electrification_level"] : null,
"drive" => isset($data["drive"]) ? $data["drive"] : null,
"plant" => isset($data["plant"]) ? $data["plant"] : null,
"manufacturer" => isset($data["manufacturer"]) ? $data["manufacturer"] : null,
"source" => isset($resp["source"]) ? $resp["source"] : null,
]
];
}
$result = decodeVin("1HGCM82633A004352");
if ($result["status"] === "success") {
$v = $result["data"];
echo $v["year"] . " " . $v["make"] . " " . $v["model"] . " — trim: " . $v["trim"];
} else {
echo "Error: " . $result["error"]["code"] . " - " . $result["error"]["message"];
}
Response envelope, errors, and nulls
Always key off the top-level status field. When status is "error", the response includes error.code and error.message; do not attempt to parse data in this case. For production, surface the error.code upstream and optionally map it to retry or user-messaging behavior. Examples of retryable conditions include network timeouts you detect on the client side. The API will also return a structured error when requests exceed your plan’s rate limit or monthly quota; check the Documentation and your dashboard for plan-specific details.
Null fields are part of the contract. If a given attribute is not published by NHTSA for that VIN, Vehicle API returns null instead of guessing. In your schema, prefer nullable columns or JSON blobs for engine and transmission. When trimming inventory feeds, treat null trim as an unresolved status and prompt either a manual correction or a secondary lookup flow (for example, merchant-provided trim selection constrained by year/make/model).
Caching decoded VINs
VINs are immutable identifiers; once decoded, their attributes do not change for the same source. Cache successful decodes keyed by VIN with a long TTL (e.g., 30+ days). A recommended approach:
- Write-through cache on "success" responses: cache the data object.
- Cache "not found" or "invalid" markers briefly to avoid hammering the API on bad inputs.
- For null-bearing fields (e.g., drive), cache the nulls as-is to keep deterministic behavior.
Because safety data (recalls, complaints, NCAP) is matched by year/make/model and can change over time, you should cache VIN decodes separately from safety results and choose a shorter TTL for safety lookups.
Deployment details for marketplaces, fleets, insurance, and agents
- Server-only: Keep X-API-Key on the server. If you integrate with frontends, proxy requests through your backend.
- Timeouts: Set a client-side timeout of about 3–5 seconds for the VIN decode call; backoff and retry with jitter if this call is on a user-critical path.
- Idempotency: The same VIN returns the same decode payload from the same source; you can safely de-duplicate queuing by VIN key.
- Localization: The decoded payload uses normalized English labels from NHTSA. If your app is localized, map trim/body labels downstream.
- Compliance: If you store manufacturer or plant fields, capture source and a retrieval timestamp in your database to support audit trails.
Coverage behavior and interoperability with safety and registration data
VIN decoding works worldwide, with the richest granularity for US-market vehicles. Safety data (recalls, complaints, NCAP ratings) is US-market only and matched by make + model + year; this means you should use the VIN decode to canonicalize those three attributes first. For Dutch registrations, data comes from RDW open data and does not include VINs; integrate plate-based flows separately if you need to validate a Netherlands vehicle without a VIN.
If you are building an AI agent that needs deterministic vehicle understanding, decode the VIN first, store year/make/model/trim/engine/transmission, and then fetch safety data by the normalized trio of year/make/model for US-market vehicles only.
Testing and monitoring
- Use the control VIN 1HGCM82633A004352 in CI to verify trim parsing logic and null handling.
- Assert that status is "success" and source is present before dereferencing data.* fields.
- Record error.code and error.message when status is "error"; aggregate by code to spot rate/plan or input-quality issues.
- Monitor cache hit rate for VIN decodes; low hit rates may indicate duplicate decoding across services or missing cache keys.
Working with MCP and agent frameworks
If you are building with Model Context Protocol, Vehicle API is also available as an MCP server at MCP. Use the same authentication strategy server-side, and route VIN decode actions through your agent’s tool abstraction. Keep the same caching and error-handling patterns to maintain determinism for multi-step plans.
Operational guidance: quotas, rate limits, and throughput
Every plan has a monthly quota and rate limits. When limits are exceeded, you will receive a structured error in the standard envelope; inspect error.code and error.message and either throttle or queue the request. Horizontal scaling is straightforward: the endpoint is stateless, and VIN decode responses are cacheable by VIN. Consider a request budget in high-traffic paths (e.g., search results pages) and pre-warm your cache for known inventory VINs.
Starter is $19/mo and every plan includes a 7-day free trial. You can register and get your key immediately. See pricing and quotas on the dashboard after signup.
Security and key management
- Store YOUR_API_KEY in a secrets manager or environment variable. Never commit it to source control.
- Do not expose keys in browser or mobile apps; route calls via your backend.
- Rotate keys periodically and on developer offboarding; update CI/CD and container secrets accordingly.
End-to-end flow example
- User or partner provides a 17-character VIN.
- Your backend POSTs to /vin/decode with the X-API-Key header and a 3–5 second timeout.
- On status=success, you parse year, make, model, trim, and engine/transmission details. Save the payload and source to your database and cache it keyed by VIN.
- If status=error, you bubble up error.code and decide:
- Retry with backoff if you saw a timeout on your side.
- Queue for later if you have burst traffic and are near plan limits.
- Return a 400 to your client with a helpful message for invalid VIN input.
- For US vehicles, use the decoded year/make/model to fetch recalls, complaints, and NCAP ratings from Vehicle API’s safety endpoints as needed in your flow.
Quick links and next steps
Get oriented on the platform and sign up for the trial:
- Register for a 7-day free trial (Starter is $19/mo).
- Read the full Documentation for response envelopes, quotas, and additional endpoints.
- Explore the MCP server for agent integrations: MCP.
If you need a quick overview of the platform or want to share it with your team, start at vehicles-api.com. Production status and updates are available at vehicles-api.com as well.
FAQ
Does the VIN Trim Level endpoint work outside the US?
Yes. VIN decoding works worldwide; however, coverage depth is fullest for US-market vehicles. If a field isn’t published by the source, it will be returned as null.
Do recall campaigns, owner complaints, and NCAP ratings come from the VIN?
No. Those are US-market only and matched by year + make + model, which you extract from the VIN decode. They are not matched by VIN itself.
Can I look up a Dutch (Netherlands) plate and get the VIN?
No. Dutch plate data is from RDW open data and does not include a VIN. Keep VIN-based and plate-based flows separate.
How should I handle null trim or missing fields?
Preserve nulls and avoid guessing. Use fallbacks based on year/make/model where appropriate, and optionally flag the record for manual review. Cache the response so subsequent operations remain consistent.
What happens when I exceed my rate limit or monthly quota?
You will receive a response with status="error" and a structured error.code and error.message. Throttle or queue requests and review your plan limits in the Documentation and dashboard.
Start decoding VINs to trims in minutes. Sign up for the 7-day free trial and get your key: Register.