VIN Assembly Plant API Example

By Vehicle API
VIN Assembly Plant API Example

When a dealer tool, fleet application, or AI agent needs to show where a vehicle was assembled, a VIN alone is not a useful location label. By the end of this example, you can send a VIN to Vehicle API, read the plant object, and handle missing location data without confusing it with the manufacturer’s name.

Request a VIN decode

The assembly plant is part of the response from POST /vin/decode, under the base URL https://vehicles-api.com/api/v1. The request accepts a vin value and uses the X-API-Key header for authentication. Authorization Bearer also works.

Illustration: VIN Assembly Plant API Example

This request uses the official control VIN, which decodes as a 2003 Honda Accord. It is a reproducible example, not the VIN of the vehicle your user is looking up. Replace the example VIN with the user’s 17-character VIN in your integration.

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"}'

Vehicle API decodes 17-character VINs worldwide, with the fullest results for US-market vehicles. The decode draws on NHTSA vPIC data; the presence and detail of plant information depend on what NHTSA publishes for the VIN.

Keep the API key on a trusted backend rather than putting it in a public client. For the complete integration reference, see the Documentation.

Read the response and the plant fields

The official response for the control VIN is shown below. The outer envelope identifies the request status and source; the decoded vehicle and its assembly plant are inside 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."
    }
}

For an assembly-location display, read data.plant.country, data.plant.state, and data.plant.city. Here they identify the United States, Ohio, and Marysville. Store the returned strings as source values; if your interface needs different capitalization, apply that as a presentation choice rather than changing the cached source data.

Use data.vin to associate the result with the submitted vehicle and data.valid as the returned validity indicator. The year, make, model, and trim fields provide context so a user can see which vehicle the plant belongs to. A valid indicator does not mean every descriptive field is populated.

The envelope matters when processing the result. In this example, status is success, source is nhtsa, and data contains the decode. On an API error, the envelope has an error status and provides error.code and error.message instead; check the status before treating the response as a decoded vehicle.

Other fields in the same decode

body, doors, and vehicle_type describe the vehicle, not the factory. They can help a reviewer recognize the record alongside the plant location. manufacturer identifies the returned manufacturer; it is a separate field and should not be used as a substitute for the city, state, or country in plant.

The nested engine object contains cylinders, displacement_l, configuration, model, hp, and fuel. Displacement is in liters and hp is horsepower. The top-level fuel_type also identifies the fuel in this example, while transmission.style and transmission.speeds describe the transmission.

The control vehicle is a gasoline car. Its electrification_level, ev_drive_unit, battery_kwh, charger_level, and charger_power_kw are null; drive is also null. When present, battery_kwh is measured in kilowatt-hours and charger_power_kw in kilowatts. A null is not a zero measurement.

Treat missing plant data as unknown

Fields NHTSA does not publish come back null. Check the plant object and each location value before displaying or storing them, rather than assuming that every decoded VIN has a complete city, state, and country. Render a missing value as unavailable, or omit it from a location label; do not infer a plant from the make or manufacturer.

Keep null distinct from an empty string or a fabricated default in your own data model. That distinction lets downstream consumers tell the difference between a value returned by the source and a label added by your application.

Extract the plant in Python

The following sample uses Python’s standard library to call the same endpoint. It checks the response status before reading data, handles a missing plant object or location component, and reports an HTTP error without assuming every failure has a usable JSON body.

import json
from urllib.error import HTTPError, URLError
from urllib.request import Request, urlopen

url = "https://vehicles-api.com/api/v1/vin/decode"
payload = json.dumps({"vin": "1HGCM82633A004352"}).encode("utf-8")

request = Request(
url,
data=payload,
headers={
"X-API-Key": "YOUR_API_KEY",
"Content-Type": "application/json",
},
method="POST",
)

try:
with urlopen(request) as response:
result = json.load(response)
except HTTPError as exc:
try:
result = json.load(exc)
except (ValueError, UnicodeDecodeError):
raise SystemExit("HTTP request failed: " + str(exc.code)) from exc

error = result.get("error") or {}
raise SystemExit(
"HTTP request failed: "
+ str(exc.code)
+ "; API code: "
+ str(error.get("code"))
+ "; message: "
+ str(error.get("message"))
) from exc
except URLError as exc:
raise SystemExit("Request could not reach the API: " + str(exc.reason)) from exc

if result.get("status") != "success":
error = result.get("error") or {}
raise SystemExit(
"API error: "
+ str(error.get("code"))
+ "; message: "
+ str(error.get("message"))
)

data = result.get("data") or {}
plant = data.get("plant") or {}

print("VIN:", data.get("vin"))
print("Valid:", data.get("valid"))
print("Vehicle:", data.get("year"), data.get("make"), data.get("model"))
print("Plant country:", plant.get("country"))
print("Plant state:", plant.get("state"))
print("Plant city:", plant.get("city"))

Replace YOUR_API_KEY with your key and supply the VIN from your application instead of the control value. In a production service, return a structured result to your caller rather than relying on printed output. Preserve the API error code for diagnosis, but avoid exposing the API key or unnecessary request details in logs.

The sample uses plant = data.get("plant") or {} so a null or absent plant does not cause a lookup on None. The individual get calls then leave missing components as None. Your display layer can decide how to represent those values without implying a location.

Build for limits, caching, and coverage

Handle both transport failures and the API’s error envelope. The response’s error.code is the machine-readable detail to inspect, while error.message gives context for diagnosis. Check the current documentation for the applicable codes and their meanings rather than hard-coding assumptions from a successful decode.

Account for rate limits and your plan’s monthly quota before putting the lookup on a high-volume workflow. When a request is limited, avoid an immediate retry loop: surface a recoverable condition to the caller and use the current documented limit guidance to schedule any retry. Monitor usage against the applicable plan limits, and do not treat a quota-related failure as evidence that the VIN has no plant data.

Cache successful decoded VIN results when the same vehicle is likely to be viewed repeatedly. Key the cache by VIN, retain the returned source and nulls along with the plant values, and choose a refresh policy appropriate to your application. A cached null means the last stored response lacked that value; it should not be presented as a permanent finding about the vehicle.

Do not cache an error as though it were a successful empty decode. Keeping those states separate allows an application to retry a failed request and prevents an outage or quota issue from becoming a misleading “plant unavailable” record.

VIN decoding is worldwide, but the fullest data is for US-market vehicles. Recalls, owner complaints, and NCAP crash ratings are US-market only and are matched by make, model, and year. Those safety datasets are separate from the plant location and should not be described as VIN-specific vehicle history.

Dutch plate data comes from RDW open data, and Dutch plate results never include a VIN. Do not expect a Dutch plate result to supply a VIN for this decode. Vehicle API is also not a vehicle history report: it does not provide title, accident, or ownership history.

For agent integrations, Vehicle API is also available through its MCP server. The same interpretation applies when an agent consumes the data: keep the source and nulls visible, and distinguish the assembly plant from manufacturer information.

FAQ

Which field contains the assembly plant?

Read data.plant in a successful VIN decode. Its country, state, and city values are the location components shown in the official example.

Does a successful decode guarantee a plant city?

No. VIN decoding works worldwide, but results are fullest for US-market vehicles, and fields NHTSA does not publish return null. Check each location component before displaying it.

Can I use a Dutch plate result to get a VIN?

No. Dutch plate data comes from RDW, and Dutch plate results never include a VIN. A VIN must be supplied separately for the decode request in this article.

How should I handle an error or a quota limit?

Check the response status and inspect error.code and error.message when supplied. Consult the current documentation for error meanings and plan limits, avoid uncontrolled retries, and keep failures separate from successful results with null fields.

Register to start the 7-day free trial and test the decode with your own VINs. Every plan includes the trial; Starter is $19 per month.