
You need to extract engine displacement and cylinder count from a VIN, reliably and fast, so you can power pricing rules, fitment, underwriting, or eligibility checks. By the end of this guide, you’ll query a single REST endpoint to decode a VIN and read engine.displacement_l and engine.cylinders in a consistent response envelope you can ship to production.
What this endpoint does
The Vehicle API VIN decoder returns standardized vehicle attributes for any 17-character VIN worldwide (fullest coverage for US-market vehicles). For this article, we focus on engine displacement and cylinder count, delivered in the engine object:
- engine.displacement_l: numeric liters (for example, 3 means 3.0 L)
- engine.cylinders: integer cylinder count (for example, 6)
The endpoint matches VINs against NHTSA vPIC. If NHTSA does not publish a field for a given VIN, the API returns null for that field. This is not a vehicle history report and does not include title, accident, or ownership history. Safety data (recalls, owner complaints, NCAP crash ratings) in the platform are US-market only and matched by make + model + year; Dutch plates are from RDW open data and never include a VIN.
Base URL: https://vehicles-api.com/api/v1. Authenticate with the X-API-Key header (Authorization Bearer also works). See the Documentation for platform-wide details.
Method, path, and parameters
Endpoint: POST /vin/decode
- URL: https://vehicles-api.com/api/v1/vin/decode
- Method: POST
- Headers:
- X-API-Key: YOUR_API_KEY
- Content-Type: application/json
- Body: JSON object with "vin" set to a 17-character VIN
Example VIN for documentation: 1HGCM82633A004352 (a 2003 Honda Accord). This VIN is a gasoline vehicle; electrification fields are therefore null in the example response.
Official cURL request
Copy and run this cURL to see the envelope and the engine object, including displacement_l and cylinders.
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
The API always returns an envelope with status, source, and data (or status:error with error details). Here is the official example from the docs:
{
"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’ll actually use
- status: "success" indicates a successful decode. On error you’ll receive status = "error" with an error object (see Error handling section).
- source: "nhtsa" confirms the data origin for traceability.
- data.vin and data.valid: echo of the requested VIN and a boolean validity check.
- data.engine.displacement_l: engine displacement in liters (number). Use for powertrain rules, emissions bands, and insurance rating factors.
- data.engine.cylinders: integer cylinder count (for example, 6).
- Other helpful context: year, make, model, trim, and transmission for UI display or cross-checks. Unavailable attributes may be null.
Language example: JavaScript (fetch)
This JavaScript sample calls the same endpoint and extracts engine.displacement_l and engine.cylinders. It preserves the response envelope so you can act on status and nulls cleanly.
async function lookupEngineFromVin(vin) {
const res = await fetch("https://vehicles-api.com/api/v1/vin/decode", {
method: "POST",
headers: {
"X-API-Key": "YOUR_API_KEY",
"Content-Type": "application/json"
},
body: JSON.stringify({ vin })
});
// You can also use Authorization: Bearer <YOUR_API_KEY> if preferred.
const payload = await res.json();
if (payload.status !== "success") {
const code = payload?.error?.code || "unknown_error";
const message = payload?.error?.message || "VIN decode failed";
throw new Error(`${code}: ${message}`);
}
const { engine } = payload.data || {};
const displacementL = engine?.displacement_l ?? null;
const cylinders = engine?.cylinders ?? null;
return { displacementL, cylinders, source: payload.source };
}
// Example use:
lookupEngineFromVin("1HGCM82633A004352")
.then(({ displacementL, cylinders, source }) => {
console.log("Engine displacement (L):", displacementL);
console.log("Cylinders:", cylinders);
console.log("Source:", source);
})
.catch(err => {
console.error("Lookup error:", err.message);
});
Response envelope and error handling
Every response is wrapped in a consistent envelope so you can build one parser:
- Success: status = "success", source, and data (object). The data object contains decoded attributes such as engine.displacement_l and engine.cylinders.
- Error: status = "error", plus error.code and error.message. Use code to branch retry logic and message to surface actionable detail to logs or support tools.
Typical error situations include invalid VIN length/characters, authentication issues, or rate limit exhaustion. Do not assume all fields exist; check for nulls and missing keys with defensive parsing. If you need the authoritative contract for error codes, refer to the Documentation.
Coverage and data sources
- VIN decoding: Works worldwide for any 17-character VIN, with the most complete attribute coverage for US-market vehicles via NHTSA vPIC.
- US safety datasets (recalls, owner complaints, NCAP crash ratings): US-market only; matched by make, model, and year. They are not returned by this VIN decode endpoint directly.
- Dutch plate data: Sourced from RDW open data; plates do not include a VIN.
- This is not a vehicle history product (no title, accident, or ownership records).
Rate limits and plan overview
Rate limits are enforced per plan. If you exceed your plan’s per-minute limit, you’ll receive an error response with status = "error". Use client-side backoff and retries where appropriate.
| Plan | Requests per minute |
|---|---|
| Starter | 60 |
| Professional | 120 |
| Business | 240 |
The Starter plan is $19/month, and every plan includes a 7-day free trial. Monthly quotas apply in addition to per-minute limits; check your account dashboard for your current monthly allocation and usage. To get started, head to Register.
Handling nulls and building a resilient integration
Some VINs do not have every field published by NHTSA. When a field is not available, it returns as null. Expect nulls for electrification details on ICE vehicles (as shown), and for drivetrain or trim in edge cases.
- Guard reads of nested objects: engine may exist but some members may be null.
- Use fallback logic: if displacement_l is null, consider alternative heuristics in your product (for example, prompt for manual selection) rather than failing the workflow.
- Keep units consistent: displacement_l is in liters. Do unit conversion on your side when needed, but store the canonical liters value to avoid rounding drift.
Caching decoded VINs
VIN decode data is stable for a given VIN. To reduce latency and cost, cache successful decodes:
- Key by VIN string exactly as returned in data.vin.
- Cache the full response envelope so you can preserve source and any nulls.
- Set a long TTL appropriate to your update cadence; VIN attributes rarely change.
- Warm caches for known high-traffic VINs in inventory, quotes, or listings.
On cache misses, call POST /vin/decode, store the envelope, and reuse engine.displacement_l and engine.cylinders downstream in pricing or eligibility checks.
Production checklist for engine displacement lookups
- Validate input: ensure 17-character VIN before sending the request.
- Authenticate: include X-API-Key: YOUR_API_KEY. Authorization: Bearer YOUR_API_KEY also works.
- Parse envelope: check status, then read data.engine.displacement_l and data.engine.cylinders.
- Handle nulls gracefully: default to safe UI/UX prompts or fallbacks.
- Respect rate limits: implement request queuing or backoff on 429-like conditions.
- Cache results: reduce repeated decodes for the same VIN.
- Log source: retain source for audits (nhtsa in the example).
MCP server option for agents and tools
If you are integrating with AI agents or tools that speak the Model Context Protocol (MCP), Vehicle API is available as an MCP server at MCP. The VIN decode capability maps cleanly to an MCP tool that returns the same envelope and engine object, giving you displacement_l and cylinders with minimal custom glue.
Frequently asked questions
Does the VIN decode work outside the United States?
Yes. The VIN decoder works worldwide for any 17-character VIN, with the most complete attribute coverage for US-market vehicles.
Are recalls or crash ratings returned by this endpoint?
No. Recalls, owner complaints, and NCAP crash ratings are US-market only and matched by make + model + year in other endpoints within the platform. The VIN decode endpoint focuses on attributes like engine and transmission.
What should I do if engine.displacement_l or engine.cylinders is null?
Keep your integration defensive: detect nulls and present a manual chooser or defer rules that depend on those attributes. Cache the response; if the source later publishes more detail, you can refresh selectively.
How do errors come back?
All errors return status = "error" and include error.code and error.message. Use the code to branch retry or user messaging and the message for logs. Check the Documentation for details.
What are the rate limits?
Starter 60/min, Professional 120/min, Business 240/min. Monthly quotas also apply; see your dashboard for current allocation.
Start your 7-day free trial and ship VIN engine displacement lookups with a single POST today. Create your key at Register, then read the Documentation or connect via MCP when you need an agent-accessible toolchain. Visit https://vehicles-api.com for the latest platform capabilities.