
You need a reliable way to get horsepower from a VIN so you can price, filter, insure, or describe vehicles automatically. By the end of this guide you will know exactly how to call the Vehicle API VIN decoding endpoint, read engine.hp from the response, handle errors, cache results, and respect coverage limits.
What this endpoint does (and what it doesn’t)
The VIN decode endpoint returns a normalized vehicle profile from a 17-character VIN. For horsepower specifically, you will read data.engine.hp from the engine object in the response.
- Coverage: VIN decoding works worldwide but is fullest for US-market vehicles.
- US-market safety coverage: recalls, owner complaints and NCAP crash ratings exist only for US-market vehicles and are matched by make, model and year (not by VIN).
- Dutch plates: supported via RDW open data and never include a VIN.
- Not a vehicle history report: no title, accident or ownership history.
You can integrate over HTTPS as a REST JSON API at vehicles-api.com, or as an MCP server for agentic tools at MCP.
Endpoint and authentication
Base URL: https://vehicles-api.com/api/v1
Endpoint: POST /vin/decode
Authentication: Send your key in one of these headers:
- X-API-Key: YOUR_API_KEY
- Authorization: Bearer YOUR_API_KEY
Obtain keys in your dashboard after signup. Every plan includes a 7-day free trial (Starter from $19/mo). Get started here: Register.
Request: decode a VIN and read horsepower
The request body includes a single field: vin. Use a 17-character VIN. The example below uses the control VIN from the documentation. It is provided for testing; it is not your customer’s vehicle.
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"}'
JavaScript example (Node.js or modern browsers)
async function getHorsepower(vin) {
const res = await fetch("https://vehicles-api.com/api/v1/vin/decode", {
method: "POST",
headers: {
"Content-Type": "application/json",
// Either header works; use one:
"X-API-Key": "YOUR_API_KEY"
// Authorization: "Bearer YOUR_API_KEY"
},
body: JSON.stringify({ vin })
});
if (!res.ok) {
// Attempt to parse structured error from the envelope
let err;
try { err = await res.json(); } catch (_) {}
if (err && err.status === "error" && err.error) {
throw new Error(`${err.error.code}: ${err.error.message}`);
}
throw new Error(`HTTP ${res.status}`);
}
const payload = await res.json();
// Envelope: { status, source, data } on success
if (payload.status !== "success") {
throw new Error("Unexpected response status");
}
// Read horsepower; may be null if not published by NHTSA
const hp = payload.data?.engine?.hp ?? null;
return {
vin: payload.data?.vin ?? vin,
horsepower: hp,
// Add a simple cache key to store this decode result
cacheKey: `vin:${payload.data?.vin ?? vin}`
};
}
// Example usage with the control VIN
getHorsepower("1HGCM82633A004352")
.then(({ vin, horsepower }) => {
console.log("VIN:", vin);
console.log("engine.hp:", horsepower);
})
.catch(err => {
console.error("VIN decode failed:", err.message);
});
Official JSON example and field map
Responses are returned in a consistent envelope. On success: status, source and data. On error: status is error and you will receive error.code and error.message. Here is the official example used throughout 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 will commonly use for horsepower and descriptive context:
- status: "success" or "error". Always check this first.
- source: "nhtsa" indicates the decoding source.
- data.vin: The VIN you decoded.
- data.valid: true if the VIN checksum/format is valid.
- data.year, data.make, data.model, data.trim: Core identifiers for display and matching.
- data.engine.hp: Integer horsepower value as published (unit: hp). This is the key for horsepower use cases.
- data.engine.displacement_l, data.engine.cylinders, data.engine.fuel: Useful for powertrain-specific filters.
- Nullability: If NHTSA does not publish a field for a given VIN, it returns null. For example, all electrification fields are null in this gasoline example.
Response envelope and error handling
All responses use the same envelope. Your integration should:
- Parse JSON, then check status.
- If status is success, read source and data.
- If status is error, read error.code and error.message.
Documented error codes you should handle:
| error.code | Meaning | Typical fix |
|---|---|---|
| 401 invalid_api_key | Your API key is missing or not recognized. | Send a valid key via X-API-Key or Authorization: Bearer. |
| 403 no_active_plan | Your account does not have an active subscription. | Activate a plan; every plan includes a 7-day trial. |
| 422 invalid_input | Your request body failed validation (e.g., VIN not 17 chars). | Correct the input format and retry. |
HTTP status codes will align with these errors. On success you receive HTTP 200 with the success envelope. On errors you receive an error envelope with error.code and error.message for a predictable experience.
Practical integration details
Units and normalization
- engine.hp is an integer horsepower quantity (hp).
- Displacement is in liters (engine.displacement_l).
- Make and model strings follow the source’s canonical naming (e.g., HONDA, Accord).
Caching decoded VINs
VIN-decoded attributes are effectively static for a vehicle. To reduce latency and cost, cache the entire response by VIN key (for example, vin:1HGCM82633A004352). Because nullability varies by source and year, cache nulls too—do not retry a VIN solely to “fill” missing fields unless your product policy requires periodic refresh.
Handling null fields
Where the source does not publish a value, the field is null in data. Always use null-safe accessors for nested fields like data.engine.hp. Do not infer values for missing fields.
Rate limits and monthly quota
Rate limits and monthly request quotas are plan-specific. Design for graceful backoff and local caching of decoded VINs. For current limits and behaviors, see the Documentation.
Coverage boundaries in mixed datasets
- VIN decoding is global; richest coverage is for US-market vehicles.
- US safety datasets (recalls, complaints, NCAP) are matched by make-model-year only; they are not VIN-specific. Do not assume per-VIN recall status from this endpoint.
- Dutch plate data comes from RDW and does not include a VIN.
Designing a horsepower feature with confidence
Most apps will either display horsepower or use it to drive filters or pricing. Here is a compact checklist you can adapt:
- Validate VIN length before calling the API. Reject anything not 17 characters to avoid 422 invalid_input.
- Call POST /vin/decode and parse the envelope.
- Read data.engine.hp. If null, decide whether to fall back to a make-model-year rule set or surface “N/A”.
- Cache the entire response by VIN to avoid re-decoding the same vehicle.
- Log source to aid debugging (e.g., source: nhtsa).
- Store year, make, model, trim alongside hp for UI and matching to US safety datasets (if you use them elsewhere in your app).
Testing with the control VIN
Use the documented control VIN 1HGCM82633A004352 to verify that you can retrieve horsepower. The example response includes engine.hp: 240. Treat this as a fixture for integration tests; do not assume other VINs will have the same completeness, and do not substitute it for customer data in production.
Security and key management
- Send keys via HTTPS using either X-API-Key: YOUR_API_KEY or Authorization: Bearer YOUR_API_KEY.
- If you ship a browser-based client, proxy requests through your backend to avoid exposing secrets. The envelope is small and fast to relay.
- Rotate keys in your dashboard if you suspect exposure and update your deployment accordingly.
Operational notes for production
- Idempotency: Decoding the same VIN yields the same attributes; safe to retry on transient network errors.
- Timeouts: Set network timeouts appropriate for your stack; cache successful decodes to prevent repeated calls under load.
- Monitoring: Track error.code frequency (401, 403, 422) to catch misconfigurations early.
- Data drift: Live source datasets evolve. Handle newly introduced fields by ignoring unknown keys and relying on documented ones like engine.hp.
Troubleshooting common scenarios
- engine.hp is null: This can occur if the source did not publish horsepower for that combination. Confirm year/make/model; consider a fallback table by trim or display “N/A”.
- 422 invalid_input: Ensure the VIN is exactly 17 characters and sent as JSON: { "vin": "..." } with Content-Type: application/json.
- 401 invalid_api_key or 403 no_active_plan: Check headers and account status. You can test again after activating your 7-day trial.
- Global VINs: Decoding outside the US works; however, some fields may be null depending on what the source publishes.
Where this fits in your stack
Dealer tools and marketplaces can extract horsepower to drive trim-level merchandising and search facets. Fleet and insurance apps can standardize vehicle power data at ingestion time. AI agents can call the REST API or use the MCP server to ground responses on decoded VIN facts. For end-to-end API behavior and limits, refer to the Documentation at vehicles-api.com.
FAQ
Does engine.hp always exist?
No. If the source does not publish horsepower for a given VIN, engine.hp will be null. Plan a fallback (e.g., show “N/A” or reference your own trim table).
Is this a vehicle history report?
No. The VIN decode returns static build attributes like year, make, model, trim and engine. It does not include title history, accident records or ownership data.
How are recalls, complaints and NCAP ratings returned?
Those US-market datasets are matched by make, model and year only. They are not part of per-VIN horsepower decoding and are outside the scope of this endpoint.
Can I authenticate with Authorization instead of X-API-Key?
Yes. Use either X-API-Key: YOUR_API_KEY or Authorization: Bearer YOUR_API_KEY.
What’s the best way to keep costs low?
Cache decoded responses by VIN. Because VIN build attributes are stable, you can serve subsequent reads from your cache and only call the API for new VINs.
Ready to ship horsepower decoding in your app? Start your 7-day free trial and get your API key here: Register.