How to Use the VIN Assembly Plant API

By Vehicle API
How to Use the VIN Assembly Plant API

You need to show exactly where a vehicle was built—country, state, and city—from a VIN, and you want a reliable field you can ship into dealer back offices, marketplace listings, fleet records, and underwriting flows. By the end of this guide you will be able to call the Vehicle API VIN decoder and read the plant object to display the official assembly plant details for any 17-character VIN.

What you will build

This walkthrough focuses on a single response field—plant—from the VIN decoder endpoint. You will:

Illustration: How to Use the VIN Assembly Plant API
  • Create an account and start a 7-day trial.
  • Get your API key from the dashboard.
  • Send the documented curl request to POST /vin/decode.
  • Parse the official JSON response envelope and read plant.country, plant.state, and plant.city.
  • Handle nulls, errors, rate limits, and caching for production use.

The VIN decoding coverage is worldwide but is fullest for US-market vehicles. Safety datasets like recalls, complaints, and NCAP crash ratings are US-market only and matched by make, model, and year. Dutch plates come from RDW open data and never include a VIN. This API is not a vehicle history report; it does not include title, accident, or ownership history.

Account setup and authentication

Start with the 7-day free trial. The Starter plan is $19/mo after the trial, and every plan includes the same trial period so you can test end-to-end before shipping. Create your account here:

Register

After registration, copy your API key from the dashboard. All REST calls use the base URL https://vehicles-api.com/api/v1. Authenticate with the header X-API-Key: YOUR_API_KEY. Authorization: Bearer YOUR_API_KEY also works if your HTTP client prefers that header, but we will use X-API-Key in the examples.

For agent workflows, the same datasets are available via the Model Context Protocol server at this endpoint:

MCP

Endpoint and request

The VIN Assembly Plant field is returned by the VIN decoder:

  • Endpoint: POST https://vehicles-api.com/api/v1/vin/decode
  • Body: {"vin":"..."} (a 17-character VIN)
  • Headers: X-API-Key and Content-Type: application/json

Use the official control VIN 1HGCM82633A004352 below to verify your integration. This is a 2003 Honda Accord. We use it here to make sure your code matches the documented fields and envelope format. The assembly plant field for your users’ vehicles will vary by VIN.

cURL (copy/paste)

Official Vehicle API docs example. Decodes any 17-character VIN worldwide; fullest for US-market vehicles. Fields NHTSA does not publish come back null.
Source: docs_fixture

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

Official JSON response and the assembly plant field

JSON:

{
    "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."
    }
}

The response envelope always contains top-level keys status and source. On success, data holds the decoded VIN record. The assembly plant is data.plant and includes:

  • data.plant.country: Assembly country as published by NHTSA.
  • data.plant.state: US state (if applicable).
  • data.plant.city: City of the assembly plant.

Use plant for:

  • Dealer listings that display “Built in CITY, STATE, COUNTRY”.
  • Compliance and regulatory reporting that cares about build origin.
  • Fleet and insurance settings where sourcing rules depend on assembly region.

Fields NHTSA does not publish return as null. Expect null for plant.subfields if the issuing dataset does not include them for a given VIN or market.

Language example: Python

This example posts the control VIN to the same endpoint, checks the envelope, and prints the plant fields. Replace YOUR_API_KEY with your key from the dashboard when you are ready to run it.

import json
import sys
import urllib.request

API_URL = "https://vehicles-api.com/api/v1/vin/decode"
API_KEY = "YOUR_API_KEY"

payload = json.dumps({"vin": "1HGCM82633A004352"}).encode("utf-8")
req = urllib.request.Request(API_URL, data=payload, method="POST")
req.add_header("X-API-Key", API_KEY)
req.add_header("Content-Type", "application/json")

try:
with urllib.request.urlopen(req, timeout=15) as resp:
body = resp.read().decode("utf-8")
doc = json.loads(body)
except urllib.error.HTTPError as e:
# The API returns an error envelope on failure
try:
err_doc = json.loads(e.read().decode("utf-8"))
# Example error shape: {"status":"error","error":{"code":"...","message":"..."}}
print(f"API error: {err_doc.get('error', {}).get('code')} - {err_doc.get('error', {}).get('message')}", file=sys.stderr)
except Exception:
print(f"HTTP error: {e.code}", file=sys.stderr)
sys.exit(1)

if doc.get("status") != "success":
err = doc.get("error", {})
print(f"API error: {err.get('code')} - {err.get('message')}", file=sys.stderr)
sys.exit(1)

data = doc.get("data", {})
plant = data.get("plant") or {}

country = plant.get("country")
state = plant.get("state")
city = plant.get("city")

# Handle nulls explicitly so your UI logic is predictable
def safe(x):
return x if x is not None else "N/A"

print(f"VIN: {data.get('vin')}")
print(f"Assembly Plant: {safe(city)}, {safe(state)}, {safe(country)}")

Step-by-step: reading plant reliably in production

1) Use the response envelope

Every response wraps your data in an envelope with status and source. On success:

  • status: "success"
  • source: "nhtsa" (for VIN decode)
  • data: object with vehicle details, including plant

On error, the envelope changes to:

  • status: "error"
  • error.code: machine-friendly code string
  • error.message: human-readable message

Always branch on status before reading data fields. Do not assume data exists on error responses.

2) Expect nulls where datasets are silent

Some VINs and markets do not include every field in NHTSA’s vPIC dataset. The API returns null for missing fields, including for plant subfields when the plant location is not fully published. Build your UI to render partial data gracefully, like “CITY, COUNTRY” when state is null.

3) Cache decoded VINs

VIN decode results are stable for a given 17-character VIN. To reduce latency and API calls, cache by VIN key:

  • Cache key: the exact VIN string in uppercase.
  • Cache TTL: can be long-lived since decode metadata does not change for a fixed VIN. If you mix in safety datasets by make+model+year, cache those separately with shorter TTLs as they update as NHTSA publishes new data.
  • Invalidate when you upgrade your app logic or need newly published enrichments for other endpoints.

4) Handle rate limits and monthly quota

The API enforces plan limits. If you reach rate or monthly quota, requests return an error envelope. Implement retries with backoff only for transient conditions, and surface hard-limit errors to the user or job queue for later reprocessing. Consult the Documentation for current rate limit and quota details. Avoid guessing limits in code.

5) Production headers and timeouts

  • Authorization: Use X-API-Key: YOUR_API_KEY. Authorization: Bearer YOUR_API_KEY is also accepted.
  • Content-Type: application/json is required for the POST body.
  • Timeouts: Set client timeouts so worker threads are not pinned; 10–20 seconds is typical for network safety.

6) Logging and observability

  • Log request ID and VIN for traceability (do not log API keys).
  • Log the top-level status and error.code/error.message on failures.
  • Capture frequency of null plant fields so product teams can adjust UI copy.

Field map for assembly plant

Use only the plant object delivered by the decoder. These are the keys you will reference:

  • data.plant.country: "UNITED STATES (USA)" in the sample.
  • data.plant.state: "OHIO" in the sample (null outside US or if not published).
  • data.plant.city: "MARYSVILLE" in the sample.

Render formats that work well in practice:

  • Short form: CITY, STATE (COUNTRY)
  • International form: CITY, COUNTRY (omit state when null or not applicable)

Store plant as normalized text exactly as provided. Do not attempt to geocode or abbreviate unless you maintain your own verified mapping table.

Coverage, data sources, and what not to expect

VIN decoding is global, but the most complete coverage is for US-market vehicles. The decoder sources include NHTSA vPIC for the US. Fields not present in NHTSA remain null. Electrification fields in the control example are null because the sample VIN is a gasoline vehicle; never infer EV values when they are null.

US safety datasets such as recall campaigns, owner complaints, and NCAP crash ratings are US-market only and matched by make, model, and year. They are not VIN-specific in this API. If you surface those alongside assembly plant, label them clearly as US-market safety data matched by M/M/Y.

Dutch plate data comes from RDW open data. Dutch plate responses never include a VIN, so do not attempt to cross-walk a Dutch plate to a VIN in this API. US plate lookup is not live; do not rely on it in production flows.

Error handling patterns

Expect and handle the error envelope shape to keep your integration robust:

  • On any failure, the JSON envelope will look like: {"status":"error","error":{"code":"...","message":"..."}}
  • Do not parse data when status is error.
  • Map error.code to retryable vs. non-retryable categories in your client. Use exponential backoff for transient classes (consult the docs for specifics). Surface non-retryable classes directly to operators or end-users.

If you receive malformed VIN errors, validate input length (17 characters) and permissible VIN characters before calling the API to save calls against your quota.

Testing and rollout checklist

  • Use the provided control VIN 1HGCM82633A004352 in development to verify the envelope and plant fields exactly match the official JSON.
  • Add unit tests that:
    • Assert status == "success" paths read data.plant.country/state/city.
    • Assert null-tolerant rendering when any plant field is null.
    • Assert error envelope parsing when status == "error".
  • Enable caching by VIN to avoid redundant decode calls.
  • Set alerting for error rates and for hitting rate or quota limits.
  • Document your downstream formatting rules so UX stays consistent across teams.

Troubleshooting common issues

  • Plant fields are null: This typically means the underlying dataset does not publish those fields for that VIN or market. Verify with another known US-market VIN to compare behavior. Do not invent values when null.
  • Mixed-case or whitespace VINs: Normalize by trimming whitespace and uppercasing before making the request and before using as a cache key.
  • Error envelope instead of data: Check your X-API-Key header, JSON content type, and body format. Ensure your HTTP client is sending a POST with a JSON body exactly as shown.
  • Rate or quota reached: Implement backoff and surface a friendly message in your UI or queue for retry after the appropriate window. Refer to the documentation for plan-specific details.

Why use the decoder for assembly plant vs DIY parsing?

While some VIN positions can indicate a country or region, the complete plant details (city and state) come from authoritative decoding and reference data. The decoder returns plant as a structured object in the same envelope as other key attributes like year, make, model, engine, and transmission, so you can fetch everything you need with one POST and a single integration surface.

Next steps

You now have a working pattern to fetch and display assembly plant details from a VIN. Keep the same envelope parsing and null handling as you expand to other fields. For AI agents or LLM-powered workflows, the MCP server provides the same datasets in a tool-friendly format:

MCP

When you are ready, start your 7-day free trial and integrate the VIN decoder into your app:

Register

For full endpoint reference, error codes, and plan details, see the Documentation.

FAQ

Does the decoder work for non-US VINs?
Yes. VIN decoding works worldwide, with the fullest coverage for US-market vehicles. If the plant fields are not published by the source for a given VIN, they will return null.

Are recalls, complaints, and NCAP ratings tied to the VIN?
In this API they are US-market datasets matched by make, model, and year—not by VIN. They are separate from the decoder and update as NHTSA publishes new data.

Can I get a VIN from a Dutch plate?
No. Dutch plate data comes from RDW open data and never includes a VIN in this API.

How should I cache results?
Cache by the 17-character VIN (uppercase) with a long TTL. VIN decode data is stable. If you also use safety datasets, cache those separately with shorter TTLs because they can change.

What happens when I exceed my plan limits?
You will receive an error envelope with status set to error and an error.code/error.message. Implement backoff for transient limits and consult the docs for plan-specific rate and quota details.

Ship your assembly plant integration today. Start your 7-day free trial and get your API key here: Register. Explore more endpoints and field definitions anytime in the Documentation on vehicles-api.com.