
Developers often need a reliable, structured way to extract engine displacement and cylinder count from a VIN to power quoting, fitment, underwriting, and inventory workflows. By the end of this guide, you’ll be able to decode a VIN with Vehicle API, read engine.displacement_l and engine.cylinders from the response, and ship production-grade logic that handles coverage, nulls, caching, and rate limits.
What this endpoint returns for engine displacement and cylinders
The Vehicle API VIN decoder provides engine specifications from NHTSA’s vPIC dataset, including:
- engine.displacement_l — the engine’s displacement in liters (L)
- engine.cylinders — the number of cylinders
These values are returned by a single request to the VIN decode endpoint and are part of a consistent response envelope. VIN decoding works worldwide and is fullest for US-market vehicles. Where NHTSA does not publish a field, the value will be null. This is not a vehicle history report; it does not include title, accident, or ownership history.
For additional context, Vehicle API also aggregates official US safety data (recall campaigns, owner complaints, and NCAP crash ratings), which are matched by make + model + year for US-market vehicles only. Dutch plates are supported via RDW open data and never include a VIN. If you need an MCP server for your agent or tool, see the MCP endpoint.
Endpoint and coverage
Use the VIN decode endpoint to retrieve engine displacement and cylinder count:
- Method and URL: POST https://vehicles-api.com/api/v1/vin/decode
- Auth: X-API-Key: YOUR_API_KEY (Authorization: Bearer YOUR_API_KEY also works)
- Body: JSON with the VIN string
- Source: NHTSA vPIC for VIN decoding
Coverage details:
- VIN decoding: worldwide; fullest for US-market vehicles
- US recalls, complaints, NCAP ratings: US-market only, matched by make + model + year (not by VIN)
- Dutch plates (RDW): plate-based data only; no VIN
Because engine displacement and cylinder count are sourced from NHTSA vPIC, fields not published for a given VIN may return null. Always implement null-safe logic.
Request and authentication
Base URL: https://vehicles-api.com/api/v1. Authenticate with the X-API-Key header. Content type is application/json.
The Vehicle API uses a consistent response envelope for all responses:
- status: "success" or "error"
- source: the data source (e.g., "nhtsa") when status is "success"
- data: an object containing decoded VIN fields when status is "success"
- error: when status is "error", includes error.code and error.message
If you are building an agent or tool that benefits from a stateful server interface, consider the MCP server for Vehicle API.
Copy-paste cURL to decode a VIN
The following is the official Vehicle API example. It decodes a 17-character VIN, and returns fields including engine.displacement_l and engine.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 example
This is the official example response from the documentation. The control VIN is a gasoline car, so the electrification fields are null.
{
"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 guide: extracting engine displacement and cylinders
To calculate or display engine size and configuration, read these fields from data.engine:
- engine.displacement_l — numeric (liters). Convert to cc by multiplying by 1000 (e.g., 3.0 L → 3000 cc).
- engine.cylinders — integer (e.g., 6 for a V6). Useful for underwriting, parts fitment, and search filters.
- engine.configuration — string (e.g., "V-Shaped"). Provides layout context (V, Inline, etc.), may be useful for UI, but not required to compute displacement.
- engine.model — manufacturer engine code (e.g., "J30A4"), helpful for parts mapping.
- engine.hp — horsepower when published.
- engine.fuel and top-level fuel_type — fuel string (e.g., "Gasoline").
Nullability: When NHTSA does not publish a value, those fields may be null. Always guard your logic and present fallbacks (e.g., hide displacement if null, or compute cc only when displacement_l is present).
Quick reference for key engine fields
| Field | Type | Units | Can be null? | Notes |
|---|---|---|---|---|
| engine.displacement_l | number | liters (L) | Yes | Use L × 1000 for cc. Display with up to one decimal place where appropriate. |
| engine.cylinders | integer | n/a | Yes | Often present; null when not published for the VIN’s market/trim. |
| engine.configuration | string | n/a | Yes | Examples: V-Shaped, Inline. Helpful for UI and parts mapping. |
| engine.model | string | n/a | Yes | Manufacturer engine code (e.g., J30A4). |
| engine.hp | number | hp | Yes | Published for some VINs; do not assume present. |
Minimal Python example to read displacement and cylinders
This sample posts a VIN, validates the envelope, and accesses engine.displacement_l and engine.cylinders. It also shows how to handle nulls safely and convert liters to cc.
import requests
API_URL = "https://vehicles-api.com/api/v1/vin/decode"
API_KEY = "YOUR_API_KEY"
payload = {"vin": "1HGCM82633A004352"}
headers = {
"X-API-Key": API_KEY,
"Content-Type": "application/json",
}
resp = requests.post(API_URL, json=payload, headers=headers, timeout=10)
resp.raise_for_status()
body = resp.json()
if body.get("status") != "success":
err = body.get("error", {})
code = err.get("code", "unknown_error")
msg = err.get("message", "Unknown error")
raise RuntimeError(f"Vehicle API error: {code} - {msg}")
data = body.get("data", {}) or {}
engine = data.get("engine", {}) or {}
displacement_l = engine.get("displacement_l") # may be None
cylinders = engine.get("cylinders") # may be None
if displacement_l is not None:
displacement_cc = int(round(displacement_l * 1000))
print(f"Displacement: {displacement_l:.1f} L ({displacement_cc} cc)")
else:
print("Displacement: unavailable")
if isinstance(cylinders, int):
print(f"Cylinders: {cylinders}")
else:
print("Cylinders: unavailable")
Handling nulls, units, and data quality
Vehicle API mirrors NHTSA vPIC’s VIN decoding data. If a field isn’t published for a given VIN and market, the API returns null for that field. This is expected behavior and not an error condition.
- Units: engine.displacement_l is in liters (L). If your UI standard is cubic centimeters (cc), compute cc = liters × 1000. Avoid over-rounding; keep at most one decimal place for L when displaying.
- Null handling: Always check for None/null before calculations and UI rendering. Do not infer displacement from unrelated fields.
- Gas vs. EV: For gasoline vehicles, EV-related fields (electrification_level, battery_kwh, charger_level, charger_power_kw, ev_drive_unit) can be null. Do not assume otherwise.
Caching decoded VINs
VIN decoding is deterministic for a given VIN and source. To reduce API calls and latency:
- Cache “success” responses keyed by VIN for a reasonable TTL (e.g., days to months). Invalidate if your business rules change or if you detect updated source data.
- Cache “not found” or partial results with a short TTL if you need to backfill later.
- Normalize your VINs (uppercase, trim spaces) before cache lookup.
Decoding via the MCP server also benefits from local caching within your agent framework.
Error handling, rate limits, and quotas
All responses follow an envelope. On errors, parse error.code and error.message. Common scenarios include invalid input length (VIN must be 17 characters), unauthorized (check your key), or upstream service issues. Implement exponential backoff for transient errors and avoid tight retry loops.
Rate limits and monthly quota depend on your plan. The Starter plan begins at $19/month, and every plan includes a 7-day free trial. For the current limits, quotas, and best practices on pagination and concurrency, review the Documentation. If you’re evaluating, you can start quickly at vehicles-api.com.
Production checklist for engine displacement integrations
- Validate input VINs are 17 characters and uppercase.
- Authenticate with X-API-Key: YOUR_API_KEY. Authorization: Bearer YOUR_API_KEY also works.
- Parse the envelope: check status == "success" before reading data.engine.*.
- Guard against nulls for engine.displacement_l and engine.cylinders.
- Convert L to cc only when displacement_l is present and numeric.
- Cache decoded VINs to reduce cost and latency.
- Implement error handling and backoff for transient failures.
- Document unit conventions in your app (L or cc) to avoid user confusion.
Notes on related datasets
While your primary target here is engine displacement and cylinder count, be aware of adjacent datasets within Vehicle API that you might integrate later:
- US safety data: Recall campaigns, owner complaints, and NCAP crash ratings are available for US-market vehicles only and are matched by make + model + year.
- Dutch plates (RDW): You can look up RDW open data using Dutch plates; RDW does not include VINs in the plate dataset, so VIN-based joins aren’t available for RDW records.
Both datasets complement VIN decoding for market-specific features, but they are not required to extract engine.displacement_l and engine.cylinders. See the Vehicle API site for an overview.
Common pitfalls and how to avoid them
- Assuming displacement is always available: Some regions or trims may not publish it. Handle nulls gracefully and avoid blocking flows that don’t require displacement.
- Confusing fuel_type and electrification fields: For gasoline vehicles, electrification fields are null; don’t treat nulls as errors here.
- Mixing units in UI: If your marketplace lists some vehicles in L and others in cc, standardize to one and convert as necessary.
- Not caching: Repeatedly decoding the same VIN wastes quota. Cache aggressively with sensible TTLs.
Testing strategy
Before deploying to production:
- Test with known-good VINs representative of your market and inventory mix.
- Simulate nulls by selecting VINs where some engine fields are not published; verify UI and calculations degrade gracefully.
- Load-test your decoding path to confirm you respect rate limits and handle backoffs.
- Exercise error paths: invalid VIN length, missing auth, and timeout conditions.
End-to-end example flow
- Receive a VIN from your form or ingestion pipeline; normalize it (uppercase, trim).
- Check your cache for the decoded VIN payload; if miss, POST to /api/v1/vin/decode.
- Validate status == "success", read data.engine.displacement_l and data.engine.cylinders.
- If displacement_l is present, compute cc = L × 1000; round appropriately for display.
- Store the full response envelope in your cache with the VIN as the key.
- Render engine size and cylinder count in your UI, hiding unavailable values.
Envelope shape recap and example parsing
Your code should work against the envelope rather than assuming fields exist:
- status: "success" → read source and data
- status: "error" → read error.code and error.message; avoid reading data
This approach keeps your integration robust across network issues and partial outages. When successful, you can rely on data.engine.displacement_l and data.engine.cylinders when they are published for the VIN.
Security and operational notes
- Do not hardcode your API key in mobile apps or front-end clients. Proxy calls through your backend.
- Rotate keys and monitor usage. Enforce per-service quotas internally if needed.
- Log the response envelope minimally (status, error) to avoid persisting unnecessary PII; VINs are identifiers—treat them accordingly.
FAQ
Does VIN decoding include all markets?
Yes, VIN decoding works worldwide, with the most complete coverage for US-market vehicles. Fields not published by NHTSA come back as null.
Are recalls, complaints, and NCAP ratings tied to the VIN?
They are matched by make + model + year for US-market vehicles only, not directly by VIN.
Do Dutch plate lookups return a VIN?
No. RDW open data for Dutch plates does not include a VIN.
What happens if engine.displacement_l is missing?
It will be null. Handle nulls gracefully and avoid failing business flows that don’t strictly require displacement. Do not try to infer displacement from unrelated fields.
How should I handle rate limits and quotas?
Implement caching for decoded VINs, backoff on retries, and consult the current limits in the Documentation.
Build your displacement and cylinder decoding in minutes. The Starter plan is $19/month and every plan includes a 7-day free trial—start now: Register. For a quick overview of the platform, visit vehicles-api.com.

