# Decode a VIN

Send a VIN:

```bash
curl "https://api.cardog.app/v2/vin/2T3R1RFV7MW180266" \
  -H "x-api-key: $CARDOG_API_KEY" \
  -H "Cardog-Version: 2026-10-26"
```

Get the vehicle back:

```json
{
  "vin": "2T3R1RFV7MW180266",
  "valid": true,
  "year": 2021,
  "make": "Toyota",
  "model": "RAV4",
  "trim": "XLE HV",
  "refs": {
    "make": "make:toyota",
    "model": "model:toyota/rav4",
    "modelYear": "model-year:toyota/rav4/2021",
    "bodyStyle": "body-style:sport-utility-vehicle-suv-multi-purpose-vehicle-mpv",
    "fuelType": "fuel-type:gasoline",
    "driveType": "drive-type:4wd-4-wheel-drive-4x4",
    "transmission": null,
    "country": "country:canada"
  },
  "nano": "nano:2T3R1RFVMW",
  "squish": "squish:2T3R1RFVM",
  "links": {
    "recalls": "/v2/vin/2T3R1RFV7MW180266/recalls",
    "listings": "/v2/vin/2T3R1RFV7MW180266/listings",
    "instrument": "/v2/vin/2T3R1RFV7MW180266/instrument",
    "specs": "/v2/specs/model-year%3Atoyota%2Frav4%2F2021",
    "quote": "/v2/quotes/model-year%3Atoyota%2Frav4%2F2021"
  }
}
```

A decode costs 2 credits. The response above is trimmed; the
[VIN reference](https://cardog.app/docs/reference/vin) lists every field.

## What comes back

![Exploded line drawing of a generic SUV: the body lifted above the engine, the transmission and the chassis with its axles and wheels.](https://cardog.app/images/docs/decode-exploded.png)

- **`valid`**: `true` when the VIN decoded. When `false`, every other
  field is null and `reasons` says why. We never fill in a VIN from
  similar vehicles.
- **`year`, `make`, `model`, `trim`**: names to show your users.
- **`refs`**: the same facts as IDs, such as `model-year:toyota/rav4/2021`.
  Other endpoints take these.
- **`nano` and `squish`**: codes for grouping identical vehicles, covered
  [below](#group-vehicles-with-nano-and-squish).
- **`links`**: the next calls for this VIN, ready to request.


## Store the refs, show the names

Write `make:toyota` into your database, not "Toyota". Every endpoint takes
the ref, and it never changes meaning. The names are for display.

A `null` ref means the VIN does not tell us that fact. It is not a lookup
that failed, and retrying will not change it. Every ref that is not null is
safe to store as is.

## Decode many VINs at once

Send up to 1,000 VINs in one call. Each is billed as one decode.

```bash
curl -X POST "https://api.cardog.app/v2/vin/batch" \
  -H "x-api-key: $CARDOG_API_KEY" \
  -H "Cardog-Version: 2026-10-26" \
  -H "content-type: application/json" \
  -d '{"vins":["2T3R1RFV7MW180266","2T3R1RFV7MW18026"]}'
```

You get one row per VIN, in the order you sent them. A bad VIN fails only
its own row: here the second VIN is one character short, so its row has
`ok: false` and an `error`, and the first still decodes. `meta` counts
`requested`, `decoded` and `failed`.

## With the TypeScript SDK

```typescript
import { CardogClient } from "@cardog/api";

const client = new CardogClient({ apiKey: process.env.CARDOG_API_KEY });
const vehicle = await client.v2.vin.getByVin("2T3R1RFV7MW180266");

await db.vehicles.update(id, {
  makeRef: vehicle.refs.make,           // "make:toyota"
  modelYearRef: vehicle.refs.modelYear, // "model-year:toyota/rav4/2021"
  squish: vehicle.squish,               // "squish:2T3R1RFVM"
});
```

## Group vehicles with `nano` and `squish`

Both are read straight from the VIN's characters:

- **`squish`** groups VINs of the same configuration and model year. Market
  prices are quoted at this level, so it works as a
  [market data](https://cardog.app/docs/market-data) key.
- **`nano`** is `squish` plus the assembly plant: VINs that share it are
  the same build. Use it to find identical vehicles.

You can compute both without calling the API, using
[`@cardog/entities`](https://www.npmjs.com/package/@cardog/entities):

```typescript
import { squishFromVin, nanoFromVin } from "@cardog/entities";

squishFromVin("2T3R1RFV7MW180266"); // "2T3R1RFVM"
nanoFromVin("2T3R1RFV7MW180266");   // "2T3R1RFV*MW"
```

The API returns the same codes with a prefix, `squish:2T3R1RFVM` and
`nano:2T3R1RFVMW` (the `*` stands for the check digit and is dropped).
[VIN structure](https://cardog.app/docs/vin#how-cardog-keys-on-a-vin) shows which characters
each one keeps.

## Next calls

Each entry in `links` is a path you can request as is:

- `recalls`: recalls for this VIN. See [Recalls](https://cardog.app/docs/recalls).
- `specs`: the full spec sheet for the model year.
- `quote` and `instrument`: market prices. See [Market data](https://cardog.app/docs/market-data).
- `listings`: listings for this VIN.

## Errors

Every error has the same shape. A malformed VIN:

```json
{
  "code": "invalid_vin",
  "message": "Not a valid VIN: 2T3R1RFV7MW18026",
  "hint": "A VIN is 17 characters, A–Z (no I/O/Q) and 0–9. If the vehicle is real and we have it wrong, report it at POST /v2/feedback",
  "docs_url": "https://cardog.app/docs/errors/invalid_vin.md",
  "links": { "feedback": "/v2/feedback" }
}
```

Branch on `code`; `hint` says what to do next. If we decoded a VIN
wrong, [report it](https://cardog.app/docs/feedback) at no charge. All codes are in
[Errors](https://cardog.app/docs/errors).

---

Previous: [Report a wrong or missing record](https://cardog.app/docs/feedback.md) (Getting started)
Next: [VIN structure](https://cardog.app/docs/vin.md) (Vehicle identity)
