VIN Assembly Plant API for Developers

By Vehicle API
VIN Assembly Plant API for Developers

You need to reliably identify where a vehicle was built—the assembly plant country, state, and city—from nothing more than a VIN. By the end of this guide, you’ll be able to call Vehicle API’s VIN decoding endpoint server-side, parse the plant field, handle errors and nulls, cache results, and ship a production-ready integration that powers dealer tools, marketplaces, fleet and insurance workflows, and AI agents.

What the assembly plant field gives you (and when to expect nulls)

The plant field in a decoded VIN tells you where the vehicle was assembled, including:

Illustration: VIN Assembly Plant API for Developers
  • plant.country
  • plant.state (where applicable)
  • plant.city

Vehicle API decodes any 17-character VIN worldwide. Coverage is fullest for US‑market vehicles. If the data source (NHTSA vPIC) does not publish a particular attribute for the VIN you submit, the corresponding field will be null. Treat nulls as “unknown,” not “not assembled” or “not applicable.”

Safety data—recalls, owner complaints, and NCAP crash ratings—are US‑market only and matched by make + model + year. Dutch plate lookups 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.

Endpoint, authentication, response envelope, and errors

Base URL: https://vehicles-api.com/api/v1

  • Method and endpoint: POST /vin/decode
  • Auth: send your key in the X-API-Key header (Authorization: Bearer YOUR_API_KEY is also supported)
  • Body: JSON with a single field, vin, containing a 17-character VIN
  • Timeouts: set explicit timeouts in your HTTP client to avoid hanging requests

Every response is wrapped in a standard envelope:

  • status: "success" or "error"
  • source: present for "success" (e.g., "nhtsa")
  • data: present for "success" (decoded vehicle object)
  • error: present for "error", with error.code and error.message

Handle errors by checking status first. Typical causes include invalid VIN length, exhausted quota, or temporary upstream unavailability. When status is "error", do not attempt to read data; log error.code and error.message and react accordingly (e.g., return a 400 to your caller for bad input, or back off and retry later for transient issues).

Rate limits and monthly quota: plans include a monthly request quota and per‑minute/second rate limits. For precise limits and overage behavior, see the Documentation. The Starter plan is $19/month, and every plan includes a 7‑day free trial.

Quickstart: curl and the official JSON

Use the official example VIN 1HGCM82633A004352 (a 2003 Honda Accord). This is a gasoline vehicle; electrification fields are null by design.

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:

{
    "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 actually use for assembly plant logic

  • data.vin: Echo of the decoded VIN; use as cache key.
  • data.valid: Boolean VIN validity from the decoder; check before trusting downstream fields.
  • data.year, data.make, data.model, data.trim: Useful for display and cross-checks.
  • data.plant.country: Plant country string.
  • data.plant.state: Plant state or region (may be null outside the US).
  • data.plant.city: Plant city (may be null when not published).
  • data.manufacturer: Manufacturer legal entity as reported by the source.

If any of plant.country, plant.state, or plant.city is null, treat it as “unknown.” Do not attempt to infer missing components from the others.

Server-side Python integration (requests)

This example posts JSON to decode a VIN and extracts the plant fields. It uses a short timeout, handles the response envelope, and demonstrates error.code and error.message handling. For GET endpoints in this API family, you would pass query parameters with params=; for this POST you must send json=.

import os
import requests

API_BASE = "https://vehicles-api.com/api/v1"
API_KEY = os.environ.get("VEHICLES_API_KEY") # Never hardcode; set in your server env

def decode_vin_get_plant(vin: str, timeout_sec: float = 5.0):
url = f"{API_BASE}/vin/decode"
headers = {
"X-API-Key": API_KEY,
"Content-Type": "application/json",
}
try:
resp = requests.post(url, json={"vin": vin}, headers=headers, timeout=timeout_sec)
except requests.exceptions.RequestException as e:
# Network/timeout/DNS/etc.
raise RuntimeError(f"vehicles-api request failed: {e}") from e

# Raise for non-2xx so you can differentiate network vs. application errors if needed
# But the API returns an envelope either way; read JSON safely.
try:
payload = resp.json()
except ValueError:
raise RuntimeError(f"vehicles-api returned non-JSON (status {resp.status_code})")

status = payload.get("status")
if status != "success":
err = (payload.get("error") or {})
code = err.get("code", "unknown_error")
msg = err.get("message", "Unknown error")
# Map/translate as needed in your app
raise RuntimeError(f"vehicles-api error [{code}]: {msg}")

data = payload.get("data") or {}
plant = data.get("plant") or {}
result = {
"vin": data.get("vin"),
"valid": data.get("valid"),
"plant_country": plant.get("country"),
"plant_state": plant.get("state"),
"plant_city": plant.get("city"),
"manufacturer": data.get("manufacturer"),
"year": data.get("year"),
"make": data.get("make"),
"model": data.get("model"),
"trim": data.get("trim"),
}
return result

if __name__ == "__main__":
vin = "1HGCM82633A004352"
info = decode_vin_get_plant(vin)
if not info["valid"]:
print(f"VIN {vin} is not valid")
else:
print(f"{info['vin']}: {info['plant_city']}, {info['plant_state']}, {info['plant_country']} ({info['manufacturer']})")

Notes:

  • Always keep your API key on the server. Never ship it in browser code or mobile binaries.
  • Set a timeout. If calls are on your request path, a short timeout keeps tail latency under control.
  • Cache decoded VINs server-side (see below). VIN decodes are deterministic; cache hits save quota and latency.

Server-side PHP integration (cURL)

This PHP snippet posts JSON, includes the X-API-Key header, enforces a timeout, and shows how to read the response envelope and surface error.code cleanly.

<?php
$apiBase = "https://vehicles-api.com/api/v1";
$apiKey = getenv("VEHICLES_API_KEY"); // Set in your server environment
$vin = "1HGCM82633A004352";

$ch = curl_init();
$url = $apiBase . "/vin/decode";

$payload = json_encode(["vin" => $vin]);

$headers = [
"X-API-Key: " . $apiKey,
"Content-Type: application/json",
];

curl_setopt_array($ch, [
CURLOPT_URL => $url,
CURLOPT_POST => true,
CURLOPT_HTTPHEADER => $headers,
CURLOPT_POSTFIELDS => $payload,
CURLOPT_RETURNTRANSFER => true,
CURLOPT_CONNECTTIMEOUT => 5,
CURLOPT_TIMEOUT => 5,
]);

$response = curl_exec($ch);

if ($response === false) {
$err = curl_error($ch);
curl_close($ch);
throw new RuntimeException("vehicles-api request failed: " . $err);
}

$httpStatus = curl_getinfo($ch, CURLINFO_HTTP_CODE);
curl_close($ch);

$payload = json_decode($response, true);
if (!is_array($payload) || !isset($payload["status"])) {
throw new RuntimeException("vehicles-api returned non-JSON or unexpected payload (HTTP $httpStatus)");
}

if ($payload["status"] !== "success") {
$err = isset($payload["error"]) ? $payload["error"] : [];
$code = isset($err["code"]) ? $err["code"] : "unknown_error";
$msg = isset($err["message"]) ? $err["message"] : "Unknown error";
throw new RuntimeException("vehicles-api error [$code]: $msg");
}

$data = isset($payload["data"]) ? $payload["data"] : [];
$plant = isset($data["plant"]) ? $data["plant"] : [];

$result = [
"vin" => isset($data["vin"]) ? $data["vin"] : null,
"valid" => isset($data["valid"]) ? $data["valid"] : null,
"plant_country" => isset($plant["country"]) ? $plant["country"] : null,
"plant_state" => isset($plant["state"]) ? $plant["state"] : null,
"plant_city" => isset($plant["city"]) ? $plant["city"] : null,
"manufacturer" => isset($data["manufacturer"]) ? $data["manufacturer"] : null,
];

if (!$result["valid"]) {
echo "VIN appears invalid\n";
} else {
echo $result["vin"] . ": " . $result["plant_city"] . ", " . $result["plant_state"] . ", " . $result["plant_country"] . " (" . $result["manufacturer"] . ")\n";
}

Production tips for PHP:

  • Use persistent connections or a pool if you make many calls per process.
  • Log error.code and error.message for operational visibility and to improve fallbacks.

Caching decoded VINs and handling nulls

VIN decodes are stable over time for the same data source. Cache records keyed by vin and the upstream source (e.g., "nhtsa") to avoid redundant calls and reduce cost. A practical approach:

  • Cache TTL: hours to days. Consider a 30–90 day TTL for VIN decodes; refresh on access if older.
  • Cache structure: store the entire data object alongside status and source so you can surface plant, engine, transmission, and basic attributes in one read.
  • Nulls: cache them too. If plant.state is null, caching it prevents repeated queries for attributes the source does not publish.

Input validation: ensure the VIN is exactly 17 characters and uppercase A–Z and 0–9 (no I, O, Q in proper VINs). If your input may include whitespace or separators, normalize before sending.

Operational behavior, rate limiting, and quotas

Integrate with an assumption of per‑second and per‑minute rate limits and a monthly quota. Recommended patterns:

  • Backoff on 429 responses or when status is "error" with an over‑limit error.code.
  • De‑duplicate in flight: if multiple requests decode the same VIN concurrently, coalesce them behind a single upstream call.
  • Batch decoding: if your workflow allows, queue VINs and process them steadily to stay within rate limits.
  • Obey timeouts and add circuit breakers to protect your app if an upstream dependency slows.

For plan‑specific numbers and overage rules, consult the Documentation. The Starter plan is $19/month and includes a 7‑day free trial.

Coverage notes and what not to expect from assembly plant decoding

  • VIN decoding is worldwide and strongest for US‑market vehicles. The assembly plant data you see in plant.country/state/city is sourced from NHTSA vPIC for applicable VINs.
  • Recalls, owner complaints, and NCAP ratings are US‑market only and matched by make + model + year. These are outside the assembly plant field but often used alongside it.
  • Dutch plate lookups come from RDW open data and do not contain a VIN; use VIN decoding for plant data, not plates.
  • This is not a vehicle history product; no title, accident, or owner history is included.

Using Vehicle API via MCP for AI agents

If you’re building AI agents or tools that run in an MCP runtime, Vehicle API is also available as an MCP server at MCP. The MCP interface exposes the same underlying capability to decode a VIN and read plant fields. For web, mobile, and backend services that require keys, keep using the HTTPS endpoint described above.

End-to-end workflow example

1) Accept and normalize input

From your form or import job, uppercase the VIN and strip spaces/dashes. Reject anything not exactly 17 characters server‑side.

2) Check cache

Look up the VIN in your cache. If present (and TTL not expired), return plant fields immediately.

3) Decode

POST to /vin/decode with json={"vin": "..."} and a short timeout. Authenticate with X-API-Key. Never put YOUR_API_KEY in browser JavaScript or a mobile app binary.

4) Handle the envelope

If status is "success", read data.plant.country/state/city. If status is "error", react based on error.code: bad input (surface validation error), over limit (retry later or queue), or transient upstream (backoff and retry).

5) Persist and cache

Store the entire data object in your database or cache, including null fields. Include metadata like source and fetch timestamp for observability and refresh logic.

6) Render and guard against nulls

When displaying plant, prefer a join like “city, state, country” while skipping empty components. For example: if state is null, render “city, country.” If city and state are null, render just “country.”

Security and compliance

  • Keys: store your API key in server-only environment variables or a secret manager. Rotate on schedule.
  • Least privilege: scope access to your integration environment only.
  • Logging: log request IDs, VINs (if allowed by your privacy model), and error codes for debugging; avoid logging secrets.

Testing and monitoring

  • Use the control VIN in this article to validate your parser and null handling quickly.
  • Write contract tests for the response envelope: assert that status is required, and that plant is either an object with country/city/state keys or absent/null when not published.
  • Monitor error.code rates and set alerts when transient or quota errors spike.

When to re-decode a VIN

VIN structure is static, but upstream data can occasionally be corrected or expanded. Reasonable policies:

  • On read: if cache is older than your TTL, refresh in the background and serve cached data immediately.
  • On error: on transient errors, keep serving cached values; retry later.
  • On nulls: recheck null plant subfields on a slower cadence (e.g., every few weeks) if your product benefits from late-arriving upstream corrections.

Get access and start decoding assembly plants

Sign up to get your API key, try the VIN decoding endpoint, and integrate the plant fields server-side. The Starter plan is $19/month and every plan includes a 7‑day free trial. Create your account here: Register. For complete endpoint details, see the Documentation.

FAQ

Does the plant field always include country, state, and city?
No. If the source does not publish a component for a given VIN, that subfield will be null. Handle nulls gracefully in your UI and downstream logic.

Is VIN decoding global?
Yes. The decoder accepts any 17‑character VIN worldwide. Coverage depth is strongest for US‑market vehicles. Safety data (recalls, owner complaints, NCAP ratings) are US‑market only and matched by make + model + year.

Can I decode a Dutch plate to get the plant?
Dutch plates (RDW open data) do not include a VIN. Use VIN decoding to retrieve plant information.

How do I authenticate?
Send your key in the X-API-Key header. Authorization: Bearer YOUR_API_KEY is also supported. Keep keys on the server; do not embed them in browsers or mobile apps.

What are the rate limits and monthly quotas?
Plans include per‑interval rate limits and a monthly request quota. See the Documentation for current limits. Use caching to minimize calls.