How to Use the VIN Body Style API

By Vehicle API
How to Use the VIN Body Style API

You need to turn a raw VIN into a reliable body style and door count so your UI, appraisal model, or rules engine can make accurate decisions. By the end of this guide, you will decode any 17-character VIN to read the vehicle’s body style and number of doors using Vehicle API, verify the response structure, and ship code that handles errors, nulls, and caching.

What you will build: fetch VIN body style and doors

This article focuses on the two fields you need for fitment, listing templates, underwriting rules, and eligibility checks:

Illustration: How to Use the VIN Body Style API
  • data.body — the standardized body style (e.g., Coupe)
  • data.doors — the number of doors (integer)

You will use one endpoint to decode a VIN into a normalized payload that includes body style, door count, along with make, model, trim, engine, and other details. The same payload structure applies whether you hit the HTTP API or connect over the MCP server for agent workflows.

Account setup and authentication

Vehicle API is available at Register with a 7-day free trial on every plan (Starter is $19/mo). After creating an account at vehicles-api.com, copy your API key from the dashboard.

  • Base URL: https://vehicles-api.com/api/v1
  • Auth: send X-API-Key: YOUR_API_KEY (Authorization: Bearer YOUR_API_KEY also works)

We will use the control VIN 1HGCM82633A004352 to show the exact response structure. This is a 2003 Honda Accord used in the official docs. It is not your user’s car.

Endpoint and official cURL request

The VIN Body Style API is part of the decode endpoint. It returns a single response envelope that includes status, source, and data. You will read body and doors from data.

Endpoint:

  • POST https://vehicles-api.com/api/v1/vin/decode

Send your VIN in a JSON body. Here is the official docs sample you can copy and run (replace YOUR_API_KEY with your key):

cURL (official sample)

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 and the fields that matter

Below is the exact JSON envelope from the documentation. You will extract data.body and data.doors. The payload also contains make, model, trim, engine, plant, and more. Electrification fields are null in this sample because the control VIN is a gasoline vehicle.

JSON (official sample)

{
    "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 use

  • status: success or error. Always check this first.
  • source: nhtsa in this example; indicates the upstream data source used for decoding.
  • data.vin: echoes the decoded VIN.
  • data.valid: boolean indicating VIN checksum validity.
  • data.body: standardized body style string you will present or use in rules (e.g., Coupe).
  • data.doors: integer door count (e.g., 2). Use for equipment fitment and quoting rules.
  • Other useful context: year, make, model, trim; engine block for downstream logic; transmission; plant; manufacturer.

Null behavior: Any field not published by NHTSA (or not available for the decoded VIN) will be null. In the example, electrification fields are null because the control VIN is a gasoline car. Always null-check optional fields before storing or displaying them.

Step-by-step: decode a VIN and extract body style and doors

1) Start the 7-day trial and get your API key

Create your account at Register. Copy your key from the dashboard. All plans include a 7-day free trial.

2) Send the decode request

Use the exact cURL above to validate connectivity. The request:

  • Method: POST
  • URL: https://vehicles-api.com/api/v1/vin/decode
  • Headers: X-API-Key: YOUR_API_KEY and Content-Type: application/json
  • JSON body: {"vin": "1HGCM82633A004352"}

3) Read body style and doors from the envelope

Check that status equals success. Then read data.body and data.doors. Treat both as required for your UI if your use case depends on them; if either is null, display a fallback or flag for enrichment.

4) Cache decoded VINs

VIN decoding is deterministic, and you can cache the whole data object keyed by VIN. Refresh the cache on a schedule that fits your SLA and use case. For body and doors, updates are rare for a given VIN, so long TTLs are safe. Caching will reduce rate limit usage and speed up your UI.

5) Handle errors and nulls

  • Envelope convention: On errors, the API returns status: "error" plus error.code and error.message. Check status first and branch accordingly.
  • HTTP status: Use the HTTP status code for transport-level handling (e.g., unauthorized). Then check the body’s status to read error.code and error.message.
  • Null fields: Assume optional keys can be null. If either body or doors is null for a particular VIN, store null and decide on a fallback UX.

JavaScript example: decode and map body style and doors

This JavaScript snippet posts to the same endpoint, validates the envelope, and extracts data.body and data.doors for use in your application.

async function decodeVinBodyStyle(vin) {
const resp = 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 })
});

// Transport-level errors
if (!resp.ok) {
throw new Error(`HTTP ${resp.status}: ${await resp.text()}`);
}

const payload = await resp.json();

// Envelope-level errors
if (payload.status !== "success") {
const code = payload.error && payload.error.code ? payload.error.code : "unknown_error";
const message = payload.error && payload.error.message ? payload.error.message : "Unknown error";
throw new Error(`${code}: ${message}`);
}

const data = payload.data || {};
const bodyStyle = data.body || null; // e.g., "Coupe"
const doors = Number.isInteger(data.doors) ? data.doors : null; // e.g., 2

// Basic guardrails for downstream logic
return {
vin: data.vin || vin,
valid: data.valid === true,
body: bodyStyle,
doors: doors
};
}

// Example usage with the control VIN
decodeVinBodyStyle("1HGCM82633A004352")
.then(result => console.log("Body style:", result.body, "Doors:", result.doors))
.catch(err => console.error("Decode failed:", err.message));

Understanding coverage and data sources

  • VIN decoding coverage: works worldwide for any 17-character VIN; coverage is fullest for US-market vehicles. Where the upstream source does not publish a field, the API returns null.
  • US safety datasets: recalls, owner complaints, and NCAP crash ratings are US-market only and are matched by make, model, and year. They are not decoded per-VIN.
  • Dutch plates: sourced from RDW open data and do not include a VIN. Use them when you are working with Dutch registrations, but do not expect VIN fields to be present.
  • This is not a vehicle history report: there is no title, accident, or ownership history in this API.

Response envelope, errors, rate limits, and quota

Every response follows a simple envelope you can rely on:

  • On success: {"status":"success","source":"...","data":{...}}
  • On error: {"status":"error","error":{"code":"...","message":"..."}}

Practical tips:

  • Check status first. Do not assume data exists when status is error.
  • Log error.code and error.message for observability. These will help you distinguish auth errors from malformed VINs or other conditions.
  • Rate limits and monthly quota: limits apply by plan. To avoid overages, cache decoded VINs and dedupe requests in-flight. For current limits, see the Documentation.
  • Retries: only retry on transient network/5xx responses. Do not loop on 4xx or on status: "error" with a deterministic error.code.

Data hygiene for body style and door count

Body style and doors are simple fields but sit on top of complex OEM mapping across markets. A few implementation notes:

  • Normalization: The body style string is normalized consistently (e.g., "Coupe"). Do not re-normalize unless you are mapping to a limited UI vocabulary.
  • Display vs. rules: Your UI can show body as-is; for rule engines, prefer strict equality against known strings or maintain a mapping table to your own categories.
  • Integer handling: doors is an integer. Guard against undefined or null when writing to strongly typed stores.
  • Cache keys: Use the VIN as a primary key for the entire data object so you can avoid extra calls when your logic later needs engine or transmission fields.

Testing and monitoring

Use the control VIN 1HGCM82633A004352 during development to validate parsing and envelope handling. Confirm that:

  • status is success
  • source is nhtsa
  • data.body equals "Coupe"
  • data.doors equals 2

Add synthetic checks in CI that verify null-safety for optional keys like electrification_level, drive, and charger_power_kw. For smoke tests in production, probe the endpoint with a known-good VIN on a scheduled basis and alert on unexpected schema changes or elevated error rates.

Working with the MCP server

If you are building an AI agent or integrating via a tool stack that supports Model Context Protocol, connect to the MCP server at MCP. You will receive the same VIN decoding semantics and the same data fields, including body and doors, through a tool-augmented interface. Use this when your agent needs to ground its responses with trustworthy vehicle data in real time.

Production checklist

  • Authentication: send X-API-Key: YOUR_API_KEY on every request.
  • VIN validation: ensure the input is a 17-character VIN before posting.
  • Envelope handling: check status first, then read source and data.
  • Field parsing: read data.body (string) and data.doors (integer). Guard for nulls.
  • Caching: cache the entire data object keyed by VIN with a long TTL.
  • Rate limits and quota: consult plan limits in the Documentation and monitor usage.
  • Logging: record error.code and error.message for any status: error responses.
  • Coverage notes: VIN decoding works worldwide; US safety datasets are US-only by make/model/year; Dutch plates never include a VIN.

FAQ

Does the VIN Body Style API work outside the US?
Yes. VIN decoding works worldwide for any 17-character VIN. Coverage is fullest for US-market vehicles. If a field is not published for a given VIN, it will be null.

Are recalls, complaints, or NCAP ratings part of this response?
No. Those US-market datasets are matched by make, model, and year and are not per-VIN in this endpoint. Use VIN decoding for body, doors, and other specs; use safety datasets separately when needed.

What happens if body or doors is not available?
The field will be null. Handle nulls in your UI or rules engine and consider a fallback. You can also log these VINs for later enrichment.

How should I handle rate limits and monthly quota?
Cache decoded VINs and avoid duplicate in-flight requests. For current rate limits and quotas by plan, see the Documentation.

Can I use Vehicle API with an AI agent?
Yes. Connect via the MCP server to ground your agent with VIN decoding, including body style and doors.

Start your 7-day free trial and get your API key in minutes. Decode a VIN, read body style and doors, and ship your integration today: Register. For full reference material, see vehicles-api.com and the Documentation.