Skip to content
On this page

GetModelsForMakeIdYear


typescript
async function GetModelsForMakeIdYear(
  params: {
    makeId: string | number
  } & AtLeastOne<{
    modelYear?: string | number
    vehicleType?: string
  }>,
  doFetch?: boolean
): Promise<NhtsaResponse<GetModelsForMakeIdYearResults> | string>

💡 More In Depth

See: Package Reference

Description

GetModelsForMakeIdYear returns the Models in the vPIC dataset for a specified Model Year and Make whose name is LIKE the Make in the vPIC Dataset.

❗ Required Parameters

params.makeId is an integer and is required.

A minimum of one of the following are also required (or a combination of both):

  • params.modelYear year you want to search for (years >= 1995 are supported according to NHTSA docs)
  • params.vehicleType can be a partial name, or a full name for more specificity, e.g., "Vehicle", "Moto", "Low Speed Vehicle", etc.

You can get makeIDs via MAKE_ID key in Results objects of the following endpoints:

  • GetAllMakes endpoint
  • GetMakeForManufacturer endpoint
  • GetModelsForMake endpoint
  • GetModelsForMakeYear endpoint

You can get makeIDs via MakeID key in Results objects of the following endpoints:

  • DecodeVinValues
  • DecodeVinValuesBatch

You can get makeIDs via ValueId key in Results objects of the following endpoints. One of the objects in the Results array will contain both Variable: "Make" and VariableId: 26. The ValueId key in that same object is the makeID for use in this endpoint.

  • DecodeVin
  • DecodeVinExtended

NOTE: This endpoint requires special behind the scenes handling of the params object, such that none of the params are used in the query string and are instead used as part of the URL path for the endpoint.

Parameters

NameTypeDefault ValueDescription
paramsObjectundefinedObject of Query Search names and values to append to the URL as a query string
params.makeIdstring | numberundefinedMake ID to search
params.modelYear?string | numberundefinedA number representing the model year to search (required if !vehicleType)
params.vehicleType?stringundefinedString representing the vehicle type to search (required if !modelYear)
doFetchbooleantrueWhether to fetch the data or just return the URL (default: true)

📝 NOTE

Any params that are not listed in the table above will be ignored.

Set doFetch to false if you want to fetch the data yourself.

Returns

Returns a Promise that resolves to a NhtsaResponse object containing an array of GetModelsForMakeIdYearResults objects in the Results key.

typescript
=> Promise<NhtsaResponse<GetModelsForMakeIdYearResults>>
typescript
type NhtsaResponse<GetModelsForMakeIdYearResults> = {
  Count: number
  Message: string
  Results: Array<GetModelsForMakeIdYearResults>
  SearchCriteria: string
}
🔍 Click to Show Full Example Response
ts
// Using GetModelsForMakeIdYear({ makeId: 474, modelYear: 2015 })
const exampleResponse = {
  Count: 89,
  Message: 'Results returned successfully',
  Results: [
    {
      Make_ID: 474,
      Make_Name: 'HONDA',
      Model_ID: 1861,
      Model_Name: 'Accord',
    },
    {
      Make_ID: 474,
      Make_Name: 'HONDA',
      Model_ID: 1863,
      Model_Name: 'Civic',
    },
    {
      Make_ID: 474,
      Make_Name: 'HONDA',
      Model_ID: 1864,
      Model_Name: 'Pilot',
    },
    {
      Make_ID: 474,
      Make_Name: 'HONDA',
      Model_ID: 1865,
      Model_Name: 'CR-V',
    },
    {
      Make_ID: 474,
      Make_Name: 'HONDA',
      Model_ID: 1866,
      Model_Name: 'Ridgeline',
    },
    {
      Make_ID: 474,
      Make_Name: 'HONDA',
      Model_ID: 1869,
      Model_Name: 'Odyssey',
    },
    {
      Make_ID: 474,
      Make_Name: 'HONDA',
      Model_ID: 1875,
      Model_Name: 'FCX Clarity',
    },
    {
      Make_ID: 474,
      Make_Name: 'HONDA',
      Model_ID: 2127,
      Model_Name: 'Fit',
    },
    {
      Make_ID: 474,
      Make_Name: 'HONDA',
      Model_ID: 2128,
      Model_Name: 'CR-Z',
    },
    {
      Make_ID: 474,
      Make_Name: 'HONDA',
      Model_ID: 3234,
      Model_Name: 'PCX150',
    },
    {
      Make_ID: 474,
      Make_Name: 'HONDA',
      Model_ID: 3235,
      Model_Name: 'CB1100',
    },
    {
      Make_ID: 474,
      Make_Name: 'HONDA',
      Model_ID: 3245,
      Model_Name: 'CRF250',
    },
    {
      Make_ID: 474,
      Make_Name: 'HONDA',
      Model_ID: 3246,
      Model_Name: 'CTX1300',
    },
    {
      Make_ID: 474,
      Make_Name: 'HONDA',
      Model_ID: 3247,
      Model_Name: 'CTX700',
    },
    {
      Make_ID: 474,
      Make_Name: 'HONDA',
      Model_ID: 3249,
      Model_Name: 'GOLDWING',
    },
    {
      Make_ID: 474,
      Make_Name: 'HONDA',
      Model_ID: 3251,
      Model_Name: 'NC700X',
    },
    {
      Make_ID: 474,
      Make_Name: 'HONDA',
      Model_ID: 3252,
      Model_Name: 'METROPOLITAN',
    },
    {
      Make_ID: 474,
      Make_Name: 'HONDA',
      Model_ID: 3253,
      Model_Name: 'NPS50 (Ruckus)',
    },
    {
      Make_ID: 474,
      Make_Name: 'HONDA',
      Model_ID: 3255,
      Model_Name: 'ST1300PA',
    },
    {
      Make_ID: 474,
      Make_Name: 'HONDA',
      Model_ID: 3256,
      Model_Name: 'INTERCEPTOR',
    },
    {
      Make_ID: 474,
      Make_Name: 'HONDA',
      Model_ID: 3618,
      Model_Name: 'Pacific Coast',
    },
    {
      Make_ID: 474,
      Make_Name: 'HONDA',
      Model_ID: 3654,
      Model_Name: 'VFR 750F',
    },
    {
      Make_ID: 474,
      Make_Name: 'HONDA',
      Model_ID: 3684,
      Model_Name: 'Hawk GT',
    },
    {
      Make_ID: 474,
      Make_Name: 'HONDA',
      Model_ID: 3695,
      Model_Name: 'CB-1',
    },
    {
      Make_ID: 474,
      Make_Name: 'HONDA',
      Model_ID: 3696,
      Model_Name: 'ELITE 250',
    },
    {
      Make_ID: 474,
      Make_Name: 'HONDA',
      Model_ID: 3697,
      Model_Name: 'Tourist Trophy',
    },
    {
      Make_ID: 474,
      Make_Name: 'HONDA',
      Model_ID: 3698,
      Model_Name: 'NS50F',
    },
    {
      Make_ID: 474,
      Make_Name: 'HONDA',
      Model_ID: 3699,
      Model_Name: 'NX250',
    },
    {
      Make_ID: 474,
      Make_Name: 'HONDA',
      Model_ID: 3700,
      Model_Name: 'NX125',
    },
    {
      Make_ID: 474,
      Make_Name: 'HONDA',
      Model_ID: 3701,
      Model_Name: 'SA50',
    },
    {
      Make_ID: 474,
      Make_Name: 'HONDA',
      Model_ID: 3702,
      Model_Name: 'SB50P',
    },
    {
      Make_ID: 474,
      Make_Name: 'HONDA',
      Model_ID: 3703,
      Model_Name: 'VFR750R (RC30)',
    },
    {
      Make_ID: 474,
      Make_Name: 'HONDA',
      Model_ID: 3704,
      Model_Name: 'VTR',
    },
    {
      Make_ID: 474,
      Make_Name: 'HONDA',
      Model_ID: 3705,
      Model_Name: 'XL600V',
    },
    {
      Make_ID: 474,
      Make_Name: 'HONDA',
      Model_ID: 3735,
      Model_Name: 'VT1100C',
    },
    {
      Make_ID: 474,
      Make_Name: 'HONDA',
      Model_ID: 9173,
      Model_Name: 'Crosstour',
    },
    {
      Make_ID: 474,
      Make_Name: 'HONDA',
      Model_ID: 10007,
      Model_Name: 'CBR650',
    },
    {
      Make_ID: 474,
      Make_Name: 'HONDA',
      Model_ID: 10253,
      Model_Name: 'CB500',
    },
    {
      Make_ID: 474,
      Make_Name: 'HONDA',
      Model_ID: 10618,
      Model_Name: 'CRF50',
    },
    {
      Make_ID: 474,
      Make_Name: 'HONDA',
      Model_ID: 10960,
      Model_Name: 'CR250',
    },
    {
      Make_ID: 474,
      Make_Name: 'HONDA',
      Model_ID: 11408,
      Model_Name: 'CR125',
    },
    {
      Make_ID: 474,
      Make_Name: 'HONDA',
      Model_ID: 11409,
      Model_Name: 'XR250R',
    },
    {
      Make_ID: 474,
      Make_Name: 'HONDA',
      Model_ID: 11588,
      Model_Name: 'TRX90',
    },
    {
      Make_ID: 474,
      Make_Name: 'HONDA',
      Model_ID: 11589,
      Model_Name: 'XR600R',
    },
    {
      Make_ID: 474,
      Make_Name: 'HONDA',
      Model_ID: 11650,
      Model_Name: 'NC700XL (NC700X)',
    },
    {
      Make_ID: 474,
      Make_Name: 'HONDA',
      Model_ID: 11651,
      Model_Name: 'NC700XD (NC700X DCT)',
    },
    {
      Make_ID: 474,
      Make_Name: 'HONDA',
      Model_ID: 11652,
      Model_Name: 'NC700XDL (NC700X DCT)',
    },
    {
      Make_ID: 474,
      Make_Name: 'HONDA',
      Model_ID: 11653,
      Model_Name: 'CMX250 (Rebel)',
    },
    {
      Make_ID: 474,
      Make_Name: 'HONDA',
      Model_ID: 11658,
      Model_Name: 'NC700JD (NM4)',
    },
    {
      Make_ID: 474,
      Make_Name: 'HONDA',
      Model_ID: 11670,
      Model_Name: 'VT1300 (Stateline)',
    },
    {
      Make_ID: 474,
      Make_Name: 'HONDA',
      Model_ID: 11674,
      Model_Name: 'XR650',
    },
    {
      Make_ID: 474,
      Make_Name: 'HONDA',
      Model_ID: 11689,
      Model_Name: 'TRX420 (FourTrax Rancher)',
    },
    {
      Make_ID: 474,
      Make_Name: 'HONDA',
      Model_ID: 11718,
      Model_Name: 'TRX420',
    },
    {
      Make_ID: 474,
      Make_Name: 'HONDA',
      Model_ID: 11728,
      Model_Name: 'TRX500 (FourTrax Foreman)',
    },
    {
      Make_ID: 474,
      Make_Name: 'HONDA',
      Model_ID: 11755,
      Model_Name: 'TRX680 (Rincon)',
    },
    {
      Make_ID: 474,
      Make_Name: 'HONDA',
      Model_ID: 11756,
      Model_Name: 'TRX680 (FourTrax Rincon)',
    },
    {
      Make_ID: 474,
      Make_Name: 'HONDA',
      Model_ID: 11759,
      Model_Name: 'NCH50 (GIORNO)',
    },
    {
      Make_ID: 474,
      Make_Name: 'HONDA',
      Model_ID: 11762,
      Model_Name: 'NSS300 (FORZA)',
    },
    {
      Make_ID: 474,
      Make_Name: 'HONDA',
      Model_ID: 11763,
      Model_Name: 'NSS300A (FORZA)',
    },
    {
      Make_ID: 474,
      Make_Name: 'HONDA',
      Model_ID: 11781,
      Model_Name: 'CRF110',
    },
    {
      Make_ID: 474,
      Make_Name: 'HONDA',
      Model_ID: 11782,
      Model_Name: 'CRF125',
    },
    {
      Make_ID: 474,
      Make_Name: 'HONDA',
      Model_ID: 11784,
      Model_Name: 'CRF230',
    },
    {
      Make_ID: 474,
      Make_Name: 'HONDA',
      Model_ID: 11788,
      Model_Name: 'NC750JD/NM4',
    },
    {
      Make_ID: 474,
      Make_Name: 'HONDA',
      Model_ID: 11803,
      Model_Name: 'CBR500',
    },
    {
      Make_ID: 474,
      Make_Name: 'HONDA',
      Model_ID: 11819,
      Model_Name: 'NC750X',
    },
    {
      Make_ID: 474,
      Make_Name: 'HONDA',
      Model_ID: 11827,
      Model_Name: 'CBR300',
    },
    {
      Make_ID: 474,
      Make_Name: 'HONDA',
      Model_ID: 11875,
      Model_Name: 'MSX125 (Grom)',
    },
    {
      Make_ID: 474,
      Make_Name: 'HONDA',
      Model_ID: 11975,
      Model_Name: 'CBR1000',
    },
    {
      Make_ID: 474,
      Make_Name: 'HONDA',
      Model_ID: 12058,
      Model_Name: 'VT750 (Shadow Aero)',
    },
    {
      Make_ID: 474,
      Make_Name: 'HONDA',
      Model_ID: 12077,
      Model_Name: 'MRT260/COTA 4RT/4RT 260',
    },
    {
      Make_ID: 474,
      Make_Name: 'HONDA',
      Model_ID: 12123,
      Model_Name: 'VT1300 (Fury)',
    },
    {
      Make_ID: 474,
      Make_Name: 'HONDA',
      Model_ID: 12132,
      Model_Name: 'VT750 (Shadow Phantom)',
    },
    {
      Make_ID: 474,
      Make_Name: 'HONDA',
      Model_ID: 12158,
      Model_Name: 'VT750 (Aero)',
    },
    {
      Make_ID: 474,
      Make_Name: 'HONDA',
      Model_ID: 12160,
      Model_Name: 'VT1300 (Interstate)',
    },
    {
      Make_ID: 474,
      Make_Name: 'HONDA',
      Model_ID: 12192,
      Model_Name: 'CRF150',
    },
    {
      Make_ID: 474,
      Make_Name: 'HONDA',
      Model_ID: 12203,
      Model_Name: 'TRX500',
    },
    {
      Make_ID: 474,
      Make_Name: 'HONDA',
      Model_ID: 12418,
      Model_Name: 'CH80 (Elite)',
    },
    {
      Make_ID: 474,
      Make_Name: 'HONDA',
      Model_ID: 12573,
      Model_Name: 'CR80',
    },
    {
      Make_ID: 474,
      Make_Name: 'HONDA',
      Model_ID: 12651,
      Model_Name: 'CR500R',
    },
    {
      Make_ID: 474,
      Make_Name: 'HONDA',
      Model_ID: 12663,
      Model_Name: 'Z50R',
    },
    {
      Make_ID: 474,
      Make_Name: 'HONDA',
      Model_ID: 12664,
      Model_Name: 'PC800 (PACIFIC COAST)',
    },
    {
      Make_ID: 474,
      Make_Name: 'HONDA',
      Model_ID: 14008,
      Model_Name: 'Honda Utility Vehicle',
    },
    {
      Make_ID: 474,
      Make_Name: 'HONDA',
      Model_ID: 14060,
      Model_Name: 'CBR600',
    },
    {
      Make_ID: 474,
      Make_Name: 'HONDA',
      Model_ID: 14865,
      Model_Name: 'CB125',
    },
    {
      Make_ID: 474,
      Make_Name: 'HONDA',
      Model_ID: 25272,
      Model_Name: 'CRF450',
    },
    {
      Make_ID: 474,
      Make_Name: 'HONDA',
      Model_ID: 25276,
      Model_Name: 'GL1800',
    },
    {
      Make_ID: 474,
      Make_Name: 'HONDA',
      Model_ID: 26254,
      Model_Name: 'Pioneer',
    },
    {
      Make_ID: 474,
      Make_Name: 'HONDA',
      Model_ID: 27906,
      Model_Name: 'TRX500 (Foreman)',
    },
    {
      Make_ID: 474,
      Make_Name: 'HONDA',
      Model_ID: 27927,
      Model_Name: 'CB300',
    },
  ],
  SearchCriteria: 'Make ID:474 | ModelYear:2015',
}

If doFetch is set to false

Returns a URL string that can be used to fetch the data, does not fetch the data internally.

typescript
=> Promise<string>

// ex: => 'https://vpic.nhtsa.dot.gov/api/vehicles/GetModelsForMakeIdYear/makeId/474/modelyear/2015/vehicleType/car?format=json'

Type - GetModelsForMakeIdYearResults

ts
type GetModelsForMakeIdYearResults = {
  Make_ID: number
  Make_Name: string
  Model_ID: number
  Model_Name: string
}

Ƭ GetModelsForMakeIdYearResults: Object

Objects returned in the Results array of GetModelsForMakeIdYear endpoint response.

Examples

Examples 1-3:

  • Fetches data from VPIC API
  • Returns:
typescript
=> Promise<NhtsaResponse<GetModelsForMakeIdYearResults>>

Example 1: Get Models for makeId and modelYear

ts
import { GetModelsForMakeIdYear } from '@shaggytools/nhtsa-api-wrapper'

const response = await GetModelsForMakeIdYear({
  makeId: 474,
  modelYear: 2015,
})

Example 2: Get Models for makeId and vehicleType

ts
import { GetModelsForMakeIdYear } from '@shaggytools/nhtsa-api-wrapper'

const response = await GetModelsForMakeIdYear({
  makeId: 474,
  vehicleType: 'truck',
})

Example 3: Get Models for makeId and modelYear and vehicleType

ts
import { GetModelsForMakeIdYear } from '@shaggytools/nhtsa-api-wrapper'

const response = await GetModelsForMakeIdYear({
  makeId: 474,
  modelYear: 2015,
  vehicleType: 'truck',
})

Examples 4-6:

typescript
=> Promise<string>

Example 4: Get Models for makeId and modelYear and doFetch = false

ts
import { GetModelsForMakeIdYear } from '@shaggytools/nhtsa-api-wrapper'

const url = await GetModelsForMakeIdYear(
  {
    makeId: 474,
    modelYear: 2015,
  },
  false
)

// url: 'https://vpic.nhtsa.dot.gov/api/vehicles/GetModelsForMakeIdYear/makeId/474/modelyear/2015?format=json'

Example 5: Get Models for makeId and vehicleType and doFetch = false

ts
import { GetModelsForMakeIdYear } from '@shaggytools/nhtsa-api-wrapper'

const url = await GetModelsForMakeIdYear(
  {
    makeId: 474,
    vehicleType: 'truck',
  },
  false
)

// url: 'https://vpic.nhtsa.dot.gov/api/vehicles/GetModelsForMakeIdYear/makeId/474/vehicleType/truck?format=json'

Example 6: Get Models for makeId and modelYear and vehicleType and doFetch = false

ts
import { GetModelsForMakeIdYear } from '@shaggytools/nhtsa-api-wrapper'

const url = await GetModelsForMakeIdYear(
  {
    makeId: 474,
    modelYear: 2015,
    vehicleType: 'truck',
  },
  false
)

// url: 'https://vpic.nhtsa.dot.gov/api/vehicles/GetModelsForMakeIdYear/makeId/474/modelyear/2015/vehicleType/truck?format=json'

Released under the MIT License.