Developers

Four endpoints, plain JSON, built for PHP

Every response is CORS-enabled and cacheable, so server-side file_get_contents and browser fetch both work without a proxy or an API key.

Endpoint reference

GET

/api/public/vin/{vin}

Decoded vehicle details. Returns { ok, vin, title, vehicle, groups }. An invalid or unknown VIN returns HTTP 400 with { ok: false, error }.

GET

/api/public/vin/{vin}/parts

Paginated matching parts. Query: page (default 1), limit (default 20, max 100), category, keyword. Returns { ok, vin, title, vehicle, filters, pagination, parts }.

GET

/api/public/parts/{sku}?vin={vin}

One part in full: spec table, fitment notes, warranty, price, availability and an absolute image.url, plus related parts. Missing vin returns 400; an unmatched SKU returns 404.

GET

/api/public/parts/fitment/{sku}?vin={vin}

Vehicle coverage behind a SKU. Optional vins (comma separated, max 10) returns a fit / no-fit verdict per VIN with the equivalent SKU and price.

Decode a VIN from PHP

Replace the host with your published address, then render the grouped fields inside your own template.

PHP example
<?php
$vin = '1HGCM82633A004352';
$json = file_get_contents("https://YOUR-APP.lovable.app/api/public/vin/{$vin}");
$data = json_decode($json, true);

if (!empty($data['ok'])) {
  echo '<h2>' . htmlspecialchars($data['title']) . '</h2>';
  foreach ($data['groups'] as $group) {
    echo '<h3>' . htmlspecialchars($group['title']) . '</h3><ul>';
    foreach ($group['fields'] as $field) {
      echo '<li>' . htmlspecialchars($field['label']) . ': '
         . htmlspecialchars($field['value']) . '</li>';
    }
    echo '</ul>';
  }
} else {
  echo 'VIN could not be decoded.';
}

Page through matching parts

Pagination metadata carries page, limit, total, totalPages, hasNextPage and hasPreviousPage, so paging links are a one-liner.

PHP example
<?php
$vin  = '1HGCM82633A004352';
$page = max(1, (int)($_GET['page'] ?? 1));
$url  = "https://YOUR-APP.lovable.app/api/public/vin/{$vin}/parts"
      . "?page={$page}&limit=10&category=Brakes";

$data = json_decode(file_get_contents($url), true);

if (!empty($data['ok'])) {
  foreach ($data['parts'] as $part) {
    echo '<li>' . htmlspecialchars($part['name']) . ' — '
       . htmlspecialchars($part['price']) . ' ('
       . htmlspecialchars($part['sku']) . ')</li>';
  }
  $p = $data['pagination'];
  echo "<p>Page {$p['page']} of {$p['totalPages']} — {$p['total']} parts</p>";
  if ($p['hasNextPage']) {
    echo '<a href="?page=' . ($p['page'] + 1) . '">Next page</a>';
  }
} else {
  echo 'No parts found for that VIN.';
}

Caching and stability

SKUs are deterministic for a vehicle profile, so responses are safe to cache. Part and coverage responses are served with a one-hour cache header; store the decoded vehicle against your order rather than re-decoding on every page view.