
You need to reliably determine a vehicle’s type from a VIN so your app can branch logic (e.g., filter to passenger cars, label listings accurately, or route vehicles to the right workflow). By the end of this guide, you’ll decode a VIN using Vehicle API’s VIN Vehicle Type endpoint, read the vehicle_type field from the official JSON, handle nulls and errors, and ship a production-ready integration.
What you get from VIN Vehicle Type
The VIN Vehicle Type capability is part of Vehicle API’s VIN decoder. It parses any 17-character VIN (worldwide coverage, fullest for US-market vehicles) and returns a normalized JSON envelope with status, source, and data. Inside data, you’ll read key attributes including:
- vehicle_type: high-level classification (e.g., PASSENGER CAR)
- year, make, model, trim, body, doors
- engine (cylinders, displacement_l, configuration, model, hp, fuel), fuel_type
- transmission (style, speeds)
- plant (country, city, state) and manufacturer
Vehicle API sources VIN decode attributes from NHTSA vPIC. Fields NHTSA does not publish return as null. For example, electrification fields are null for non-EV VINs. This is not a vehicle history report; it does not include title, accident, or ownership history.
Safety data (recalls, owner complaints, NCAP crash ratings) are US-market only and matched by make + model + year. Dutch plates are matched to RDW open data and never include a VIN. For multi-source access via LangChain-compatible tooling, Vehicle API is also available as an MCP server at MCP.
Access and authentication
To call the API:
- Start the 7-day free trial (Starter is $19/mo) and create an account via Register.
- Copy your API key from the dashboard.
- Send requests to the base URL: https://vehicles-api.com/api/v1
- Authenticate with the header: X-API-Key: YOUR_API_KEY (Authorization: Bearer YOUR_API_KEY also works).
Every response uses a consistent envelope:
- On success: status = success, source = data provider (e.g., nhtsa), data = decoded object
- On error: status = error, with error.code and error.message
Endpoint and official cURL
The VIN Vehicle Type is delivered by the VIN Decode endpoint. It’s a POST that accepts a JSON body with vin.
Endpoint
POST https://vehicles-api.com/api/v1/vin/decode
cURL
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"}'
Read the official JSON response
This is the official example response for the control VIN (1HGCM82633A004352). The vehicle_type field is highlighted in context within data.
{
"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."
}
}
Fields you will actually use
- status, source: Inspect status for success; source tells you the upstream provider (nhtsa here).
- data.vin, data.valid: Echo of the VIN and validity check (true/false).
- data.vehicle_type: High-level classification you can use for filtering, labeling, or routing (e.g., PASSENGER CAR).
- data.year, data.make, data.model, data.trim: Core identification suitable for UI display and matching to safety datasets (recalls, complaints, NCAP are US-only and matched by make + model + year).
- data.body, data.doors: Useful for fitment, search filters, and lead capture forms.
- data.engine.* and data.fuel_type: Powertrain specs. If NHTSA doesn’t publish a sub-field, it will be null.
- data.transmission.*: Style and gear count when available.
- data.plant.* and data.manufacturer: Assembly metadata and OEM.
JavaScript example: decode a VIN and read vehicle_type
This example calls the same endpoint and extracts the vehicle_type field along with a few essentials. It also demonstrates one simple, effective caching strategy for decoded VINs.
// Minimal Node.js or browser fetch example
const API_BASE = 'https://vehicles-api.com/api/v1';
const API_KEY = 'YOUR_API_KEY'; // copy from your dashboard
// Simple in-memory cache for demonstration. Use Redis or your DB in production.
const vinCache = new Map();
async function decodeVin(vin) {
if (vinCache.has(vin)) {
return vinCache.get(vin);
}
const res = await fetch(`${API_BASE}/vin/decode`, {
method: 'POST',
headers: {
'X-API-Key': API_KEY,
'Content-Type': 'application/json'
// Alternatively: 'Authorization': `Bearer ${API_KEY}`
},
body: JSON.stringify({ vin })
});
const payload = await res.json();
if (payload.status !== 'success') {
// The API standardizes errors as: status = 'error' with error.code and error.message
const code = payload.error && payload.error.code ? payload.error.code : 'unknown_error';
const msg = payload.error && payload.error.message ? payload.error.message : 'Unexpected error';
throw new Error(`VIN decode failed (${code}): ${msg}`);
}
// Persist decoded VINs; they are deterministic and great candidates for long-lived caching.
vinCache.set(vin, payload.data);
return payload.data;
}
(async () => {
try {
const vin = '1HGCM82633A004352'; // control VIN for testing
const data = await decodeVin(vin);
// Read the fields your app needs
const {
vehicle_type,
year, make, model, trim,
body, doors,
engine, transmission
} = data;
console.log('VIN:', data.vin, 'Valid:', data.valid);
console.log('Vehicle Type:', vehicle_type); // e.g., PASSENGER CAR
console.log('MMY/Trim:', year, make, model, trim);
console.log('Body/Doors:', body, doors);
console.log('Engine:', engine);
console.log('Transmission:', transmission);
// Handle nulls: drive and electrification fields may be null if not published.
if (data.drive == null) {
console.log('Drive info not published for this VIN (null).');
}
if (data.electrification_level == null) {
console.log('Electrification fields are null for non-EV VINs.');
}
} catch (err) {
console.error(err.message);
}
})();
Practical implementation details
Response envelope and nulls
- Envelope: Expect status and source at the top level; on success, data contains the decoded VIN object.
- Nulls: Any attribute NHTSA does not publish will be null. Do not coerce nulls into defaults—check for null explicitly before rendering or persisting.
- Electrification: For non-EV vehicles, electrification_level, battery_kwh, charger_level, charger_power_kw, and ev_drive_unit will be null.
Error handling
- On failure, status is error and includes error.code and error.message. Use code for programmatic branching and message for logs or operator surfaces.
- Return appropriate HTTP status handling in your client, but rely on the JSON envelope for the authoritative state.
- For transient network errors, retry with backoff. Avoid re-trying invalid VINs (valid: false in data or structured error).
Rate limits and monthly quota
- Plans include a monthly quota and rate limits. If you approach quota or rate ceilings, requests may be throttled or rejected.
- Do not guess limits in code. Read the Documentation and design for backoff and caching.
Caching decoded VINs
- VIN decodes are deterministic and stable. Cache results indefinitely with occasional refresh if your UI needs canonical updates from the upstream.
- Use the VIN as the cache key. Store the raw data object including vehicle_type for downstream reuse.
- Recommended layers: in-memory LRU for hot paths and a persistent store (Redis, Postgres) for long-term hits. Use soft TTLs only if you require periodic validation.
Coverage specifics you should account for
- VIN decoding: Works worldwide; coverage is fullest for US-market vehicles. Some fields may be null outside the US.
- Safety data: Recalls, owner complaints, and NCAP crash ratings are US-market only and matched by make + model + year. Use year/make/model from the decode to query those datasets.
- Dutch plates (RDW): Dutch registrations do not include a VIN. If you work with NL plates, you will not receive a vin field from RDW data.
Focusing on vehicle_type in your application
The vehicle_type field is the anchor for categorizing vehicles. Common uses:
- Inventory filters: Expose vehicle_type facets to segment PASSENGER CAR vs. other categories.
- Workflow routing: Route PASSENGER CAR units to passenger-car valuation and inspection flows.
- Eligibility rules: Apply policy or underwriting rules that depend on vehicle_type (e.g., exclude non-passenger vehicles from a consumer insurance program).
In the official sample above, vehicle_type is PASSENGER CAR. Keep your UI tolerant to formatting (uppercase strings) and consider mapping to your internal taxonomy if you need localized labels.
Field-by-field quick reference
These are the fields you will most likely persist for search, filtering, and analytics. Values are determined by NHTSA vPIC for the decoded VIN and may be null if unpublished.
| Field | Type | Purpose |
|---|---|---|
| vin | string | Primary key for caching and lookup. |
| valid | boolean | VIN checksum/format validation flag. |
| vehicle_type | string | Top-level classification (e.g., PASSENGER CAR) used for routing and UX labels. |
| year, make, model, trim | various | Canonical identity; also used for US safety data joins (recalls, complaints, NCAP). |
| body, doors | string, number | Body style and door count for fitment and filters. |
| engine.cylinders, displacement_l, configuration, model, hp, fuel | various | Powertrain details; display and insurance underwriting inputs. |
| fuel_type | string | Normalized fuel category; often mirrors engine.fuel. |
| transmission.style, transmission.speeds | string, number | Transmission metadata for merchandising. |
| plant.country, plant.city, plant.state | strings | Assembly metadata; sometimes used in compliance or analytics. |
| manufacturer | string | Official manufacturer of record from NHTSA. |
| electrification_level, ev_drive_unit, battery_kwh, charger_level, charger_power_kw | various (nullable) | EV/hybrid attributes. Expect null for gasoline control VINs and for vehicles where NHTSA does not publish these attributes. |
| drive | string (nullable) | Drive configuration if available; may be null when not published. |
End-to-end workflow checklist
- Authenticate to https://vehicles-api.com/api/v1 with X-API-Key: YOUR_API_KEY.
- POST to /vin/decode with body { "vin": "1HGCM82633A004352" }.
- Check status === success. Read source for auditing (nhtsa in the example).
- Cache the entire data object by vin. It is safe and cost-effective to cache long-term.
- Read vehicle_type to drive UI, routing, or policy rules. Normalize or map to your internal taxonomy if desired.
- Handle nulls for optional attributes (e.g., drive, electrification fields). Avoid failing UI rendering due to nulls.
- If you need US safety data, query those by make + model + year; they are US-market only.
- For Dutch plates, consume RDW open data separately; no VIN will be present.
- Monitor rate-limit headers or dashboards and implement backoff for bursts. Review your plan’s monthly quota in the Documentation.
Troubleshooting and edge cases
- Invalid VIN length: The decoder requires exactly 17 characters. Strip whitespace and uppercase the VIN before sending.
- Ambiguous trims: For some vehicles, trim may be null. Use year/make/model plus engine/transmission/body to differentiate SKUs.
- International VINs: Decode coverage is worldwide; some attributes may be null if the upstream does not publish them for your market.
- Stale caches: When OEM schemas change, your cached entries remain valid. If you want periodic verification, set a soft TTL (e.g., monthly) and revalidate on miss.
- Error parsing: Always branch on payload.status. Do not assume HTTP 200 means success; inspect status and handle error.code, error.message when present.
Building with Vehicle API beyond the endpoint
If you are building AI agents, dealer tools, or insurance workflows and prefer tool-call orchestration, use the MCP server at MCP to expose VIN decoding as a tool. You’ll get the same fields, including vehicle_type, over an agent-friendly interface.
For REST integrations, keep requests minimal and cache aggressively. Decode once per unique VIN; re-use vehicle_type and other decoded fields across listings, underwriting, and fleet records.
FAQ
Does the VIN decoder work outside the US?
Yes. VIN decoding works worldwide, with fullest coverage for US-market vehicles. Some fields may be null for vehicles where NHTSA does not publish that attribute.
Is safety data like recalls included in the VIN response?
Safety data is available for US-market vehicles and is matched by make + model + year, not by VIN in this endpoint. Use the decoded year/make/model to query those datasets.
Do Dutch plates include a VIN?
No. Dutch plates are from RDW open data and never include a VIN. Treat NL registration lookups as a separate flow.
How should I cache VIN decodes?
Cache indefinitely by VIN. The results are stable, and caching reduces latency and cost. Consider an LRU in-memory cache for hot paths plus a durable store (Redis/SQL) for long-term hits.
What happens when a field is missing?
If NHTSA does not publish a field for a VIN, it will be null. Always null-check optional attributes like drive and electrification fields before use.
Ready to ship? Start your 7-day free trial and get your API key from the dashboard: Register. For endpoint specifics and plan details, read the Documentation.