@apiverve/vindecoder 1.1.7 → 1.2.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/LICENSE CHANGED
@@ -1,21 +1,21 @@
1
- The MIT License (MIT)
2
-
3
- Copyright (c) 2024 APIVerve, and Evlar LLC
4
-
5
- Permission is hereby granted, free of charge, to any person obtaining a copy
6
- of this software and associated documentation files (the "Software"), to deal
7
- in the Software without restriction, including without limitation the rights
8
- to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
- copies of the Software, and to permit persons to whom the Software is
10
- furnished to do so, subject to the following conditions:
11
-
12
- The above copyright notice and this permission notice shall be included in all
13
- copies or substantial portions of the Software.
14
-
15
- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
- IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
- FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
- AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
- LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
- OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
1
+ The MIT License (MIT)
2
+
3
+ Copyright (c) 2026 APIVerve and EvlarSoft LLC
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
21
  SOFTWARE.
package/README.md CHANGED
@@ -1,260 +1,350 @@
1
- VIN Decoder API
2
- ============
3
-
4
- VIN Decoder is a simple tool for decoding vehicle identification numbers. It returns the make, model, and more of the vehicle.
5
-
6
- ![Build Status](https://img.shields.io/badge/build-passing-green)
7
- ![Code Climate](https://img.shields.io/badge/maintainability-B-purple)
8
- ![Prod Ready](https://img.shields.io/badge/production-ready-blue)
9
-
10
- This is a Javascript Wrapper for the [VIN Decoder API](https://apiverve.com/marketplace/api/vindecoder)
11
-
12
- ---
13
-
14
- ## Installation
15
- npm install @apiverve/vindecoder --save
16
-
17
- ---
18
-
19
- ## Configuration
20
-
21
- Before using the vindecoder API client, you have to setup your account and obtain your API Key.
22
- You can get it by signing up at [https://apiverve.com](https://apiverve.com)
23
-
24
- ---
25
-
26
- ## Usage
27
-
28
- The VIN Decoder API documentation is found here: [https://docs.apiverve.com/api/vindecoder](https://docs.apiverve.com/api/vindecoder).
29
- You can find parameters, example responses, and status codes documented here.
30
-
31
- ### Setup
32
-
33
- ```
34
- var vindecoderAPI = require('@apiverve/vindecoder');
35
- var api = new vindecoderAPI({
36
- api_key: [YOUR_API_KEY],
37
- secure: true //(Optional, defaults to true)
38
- });
39
- ```
40
-
41
- ---
42
-
43
-
44
- ### Perform Request
45
- Using the API client, you can perform requests to the API.
46
-
47
- ###### Define Query
48
-
49
- ```
1
+ # VIN Decoder API
2
+
3
+ VIN Decoder turns a 17-character Vehicle Identification Number into the vehicle it identifies. Returns make, model, year, trim, body class and manufacturer, plus engine specifications, plant of manufacture, and the safety equipment fitted to that specific build. Optionally adds every safety recall issued for that vehicle and its NHTSA 5-star crash-test rating.
4
+
5
+ [![npm version](https://img.shields.io/npm/v/@apiverve/vindecoder.svg)](https://www.npmjs.com/package/@apiverve/vindecoder)
6
+
7
+ This is a JavaScript wrapper for the [VIN Decoder API](https://apiverve.com/marketplace/vindecoder?utm_source=npm&utm_medium=referral&utm_content=readme)
8
+
9
+ ---
10
+
11
+ ## Installation
12
+
13
+ Using npm:
14
+ ```shell
15
+ npm install @apiverve/vindecoder
16
+ ```
17
+
18
+ Using yarn:
19
+ ```shell
20
+ yarn add @apiverve/vindecoder
21
+ ```
22
+
23
+ ---
24
+
25
+ ## Configuration
26
+
27
+ Before using the VIN Decoder API client, you have to setup your account and obtain your API Key.
28
+ You can get it by signing up at [https://apiverve.com](https://apiverve.com?utm_source=npm&utm_medium=referral&utm_content=readme)
29
+
30
+ ---
31
+
32
+ ## Quick Start
33
+
34
+ [Get started with the Quick Start Guide](https://docs.apiverve.com/quickstart?utm_source=npm&utm_medium=referral&utm_content=readme)
35
+
36
+ The VIN Decoder API documentation is found here: [https://docs.apiverve.com/ref/vindecoder](https://docs.apiverve.com/ref/vindecoder?utm_source=npm&utm_medium=referral&utm_content=readme).
37
+ You can find parameters, example responses, and status codes documented here.
38
+
39
+ ### Setup
40
+
41
+ ```javascript
42
+ const vindecoderAPI = require('@apiverve/vindecoder');
43
+ const api = new vindecoderAPI({
44
+ api_key: '[YOUR_API_KEY]'
45
+ });
46
+ ```
47
+
48
+ ---
49
+
50
+ ## Usage
51
+
52
+ ---
53
+
54
+ ### Perform Request
55
+
56
+ Using the API is simple. All you have to do is make a request. The API will return a response with the data you requested.
57
+
58
+ ```javascript
50
59
  var query = {
51
- vin: "1HGCM82633A004352"
52
- };
53
- ```
54
-
55
- ###### Simple Request (using Callback)
56
-
57
- ```
58
- api.execute(query, function (error, data) {
59
- if (error) {
60
- return console.error(error);
61
- } else {
62
- console.log(data);
63
- }
64
- });
65
- ```
66
-
67
- ###### Example Response
68
-
69
- ```
60
+ vin: "1HGCM82633A004352",
61
+ recalls: true,
62
+ safetyRating: true
63
+ };
64
+
65
+ api.execute(query, function (error, data) {
66
+ if (error) {
67
+ return console.error(error);
68
+ } else {
69
+ console.log(data);
70
+ }
71
+ });
72
+ ```
73
+
74
+ ---
75
+
76
+ ### Using Promises
77
+
78
+ You can also use promises to make requests. The API returns a promise that you can use to handle the response.
79
+
80
+ ```javascript
81
+ var query = {
82
+ vin: "1HGCM82633A004352",
83
+ recalls: true,
84
+ safetyRating: true
85
+ };
86
+
87
+ api.execute(query)
88
+ .then(data => {
89
+ console.log(data);
90
+ })
91
+ .catch(error => {
92
+ console.error(error);
93
+ });
94
+ ```
95
+
96
+ ---
97
+
98
+ ### Using Async/Await
99
+
100
+ You can also use async/await to make requests. The API returns a promise that you can use to handle the response.
101
+
102
+ ```javascript
103
+ async function makeRequest() {
104
+ var query = {
105
+ vin: "1HGCM82633A004352",
106
+ recalls: true,
107
+ safetyRating: true
108
+ };
109
+
110
+ try {
111
+ const data = await api.execute(query);
112
+ console.log(data);
113
+ } catch (error) {
114
+ console.error(error);
115
+ }
116
+ }
117
+ ```
118
+
119
+ ---
120
+
121
+ ## Example Response
122
+
123
+ ```json
70
124
  {
71
125
  "status": "ok",
72
126
  "error": null,
73
127
  "data": {
128
+ "vin": "1HGCM82633A004352",
129
+ "valid": true,
130
+ "decoded": true,
131
+ "vehicleDescriptor": "1HGCM826*3A",
74
132
  "make": "HONDA",
75
- "manufacturer": "AMERICAN HONDA MOTOR CO., INC.",
76
133
  "model": "Accord",
77
- "options": {
78
- "abs": "",
79
- "activesafetysysnote": "",
80
- "adaptivecruisecontrol": "",
81
- "adaptivedrivingbeam": "",
82
- "adaptiveheadlights": "",
83
- "additionalerrortext": "",
84
- "airbagloccurtain": "1st and 2nd Rows",
85
- "airbaglocfront": "1st Row (Driver and Passenger)",
86
- "airbaglocknee": "",
87
- "airbaglocseatcushion": "",
88
- "airbaglocside": "1st Row (Driver and Passenger)",
89
- "automaticpedestrianalertingsound": "",
90
- "autoreversesystem": "",
91
- "axleconfiguration": "",
92
- "axles": "",
93
- "baseprice": "",
94
- "batterya": "",
95
- "batterya_to": "",
96
- "batterycells": "",
97
- "batteryinfo": "",
98
- "batterykwh": "",
99
- "batterykwh_to": "",
100
- "batterymodules": "",
101
- "batterypacks": "",
102
- "batterytype": "",
103
- "batteryv": "",
104
- "batteryv_to": "",
105
- "bedlengthin": "",
106
- "bedtype": "Not Applicable",
107
- "blindspotintervention": "",
108
- "blindspotmon": "",
109
- "bodycabtype": "Not Applicable",
110
- "bodyclass": "Coupe",
111
- "brakesystemdesc": "",
112
- "brakesystemtype": "",
113
- "busfloorconfigtype": "Not Applicable",
114
- "buslength": "",
115
- "bustype": "Not Applicable",
116
- "can_aacn": "",
117
- "cashforclunkers": "",
118
- "chargerlevel": "",
119
- "chargerpowerkw": "",
120
- "cib": "",
121
- "coolingtype": "",
122
- "curbweightlb": "",
123
- "custommotorcycletype": "Not Applicable",
124
- "daytimerunninglight": "",
125
- "destinationmarket": "",
126
- "displacementcc": "2998.832712",
127
- "displacementci": "183",
128
- "displacementl": "2.998832712",
129
- "doors": "2",
130
- "driverassist": "",
131
- "drivetype": "",
132
- "dynamicbrakesupport": "",
133
- "edr": "",
134
- "electrificationlevel": "",
135
- "engineconfiguration": "V-Shaped",
136
- "enginecycles": "",
137
- "enginecylinders": "6",
138
- "enginehp": "240",
139
- "enginehp_to": "",
140
- "enginekw": "",
141
- "enginemanufacturer": "",
142
- "enginemodel": "J30A4",
143
- "entertainmentsystem": "",
144
- "errorcode": "0",
145
- "errortext": "0 - VIN decoded clean. Check Digit (9th position) is correct",
146
- "esc": "",
147
- "evdriveunit": "",
148
- "forwardcollisionwarning": "",
149
- "fuelinjectiontype": "",
150
- "fueltypeprimary": "Gasoline",
151
- "fueltypesecondary": "",
152
- "gcwr": "",
153
- "gcwr_to": "",
154
- "gvwr": "Class 1C: 4,001 - 5,000 lb (1,814 - 2,268 kg)",
155
- "gvwr_to": "Class 1: 6,000 lb or less (2,722 kg or less)",
156
- "keylessignition": "",
157
- "lanecenteringassistance": "",
158
- "lanedeparturewarning": "",
159
- "lanekeepsystem": "",
160
- "lowerbeamheadlamplightsource": "",
161
- "makeid": "474",
162
- "manufacturerid": "988",
163
- "modelid": "1861",
164
- "motorcyclechassistype": "Not Applicable",
165
- "motorcyclesuspensiontype": "Not Applicable",
166
- "ncsabodytype": "",
167
- "ncsamake": "",
168
- "ncsamapexcapprovedby": "",
169
- "ncsamapexcapprovedon": "",
170
- "ncsamappingexception": "",
171
- "ncsamodel": "",
172
- "ncsanote": "",
173
- "nonlanduse": "",
174
- "note": "",
175
- "otherbusinfo": "",
176
- "otherengineinfo": "",
177
- "othermotorcycleinfo": "",
178
- "otherrestraintsysteminfo": "Seat Belt (Rr center position)",
179
- "othertrailerinfo": "",
180
- "parkassist": "",
181
- "pedestrianautomaticemergencybraking": "",
182
- "plantcity": "MARYSVILLE",
183
- "plantcompanyname": "",
184
- "plantcountry": "UNITED STATES (USA)",
185
- "plantstate": "OHIO",
186
- "possiblevalues": "",
187
- "pretensioner": "",
188
- "rearautomaticemergencybraking": "",
189
- "rearcrosstrafficalert": "",
190
- "rearvisibilitysystem": "",
191
- "saeautomationlevel": "",
192
- "saeautomationlevel_to": "",
193
- "seatbeltsall": "Manual",
194
- "seatrows": "",
195
- "seats": "",
196
- "semiautomaticheadlampbeamswitching": "",
197
- "series": "",
198
- "series2": "",
199
- "steeringlocation": "",
200
- "suggestedvin": "",
201
- "topspeedmph": "",
202
- "tpms": "",
203
- "trackwidth": "",
204
- "tractioncontrol": "",
205
- "trailerbodytype": "Not Applicable",
206
- "trailerlength": "",
207
- "trailertype": "Not Applicable",
208
- "transmissionspeeds": "5",
209
- "transmissionstyle": "Automatic",
210
- "trim": "EX-V6",
211
- "trim2": "",
212
- "turbo": "",
213
- "valvetraindesign": "Single Overhead Cam (SOHC)",
214
- "vehicledescriptor": "1HGCM826*3A",
215
- "vehicletype": "PASSENGER CAR",
216
- "wheelbaselong": "",
217
- "wheelbaseshort": "",
218
- "wheelbasetype": "",
219
- "wheels": "",
220
- "wheelsizefront": "",
221
- "wheelsizerear": "",
222
- "windows": ""
223
- },
134
+ "year": 2003,
224
135
  "trim": "EX-V6",
225
- "vin": "1HGCM82633A004352",
226
- "year": "2003"
227
- },
228
- "code": 200
229
- }
230
- ```
231
-
232
- ---
233
-
234
- ## Customer Support
235
-
236
- Need any assistance? [Get in touch with Customer Support](https://apiverve.com/contact).
237
-
238
- ---
239
-
240
- ## Updates
241
- Stay up to date by following [@apiverveHQ](https://twitter.com/apiverveHQ) on Twitter.
242
-
243
- ---
244
-
245
- ## Legal
246
-
247
- All usage of the APIVerve website, API, and services is subject to the [APIVerve Terms of Service](https://apiverve.com/terms) and all legal documents and agreements.
248
-
249
- ---
250
-
251
- ## License
252
- Licensed under the The MIT License (MIT)
253
-
254
- Copyright (©) 2024 APIVerve, and Evlar LLC
255
-
256
- Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
257
-
258
- The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
259
-
260
- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
136
+ "trim2": null,
137
+ "series": null,
138
+ "series2": null,
139
+ "manufacturer": "AMERICAN HONDA MOTOR CO., INC.",
140
+ "vehicleType": "PASSENGER CAR",
141
+ "bodyClass": "Coupe",
142
+ "plant": {
143
+ "state": "OHIO",
144
+ "country": "UNITED STATES (USA)",
145
+ "city": "MARYSVILLE"
146
+ },
147
+ "engine": {
148
+ "displacementL": "2.998832712",
149
+ "displacementCc": "2998.832712",
150
+ "engineNumberOfCylinders": "6",
151
+ "engineModel": "J30A4",
152
+ "engineConfiguration": "V-Shaped",
153
+ "engineBrakeHpFrom": "240",
154
+ "displacementCi": "183",
155
+ "fuelTypePrimary": "Gasoline",
156
+ "valveTrainDesign": "Single Overhead Cam (SOHC)"
157
+ },
158
+ "features": {
159
+ "passiveSafetySystem": {
160
+ "otherRestraintSystemInfo": "Seat Belt (Rr center position)",
161
+ "seatBeltType": "Manual",
162
+ "sideAirBagLocations": "1st Row (Driver and Passenger)",
163
+ "curtainAirBagLocations": "1st and 2nd Rows",
164
+ "frontAirBagLocations": "1st Row (Driver and Passenger)"
165
+ },
166
+ "exterior": {
167
+ "grossVehicleWeightRatingFrom": "Class 1C: 4,001 - 5,000 lb (1,814 - 2,268 kg)",
168
+ "grossVehicleWeightRatingTo": "Class 1: 6,000 lb or less (2,722 kg or less)",
169
+ "doors": "2"
170
+ },
171
+ "mechanical": {
172
+ "transmissionStyle": "Automatic",
173
+ "transmissionSpeeds": "5"
174
+ }
175
+ },
176
+ "validation": {
177
+ "errorText": "0 - VIN decoded clean. Check Digit (9th position) is correct",
178
+ "errorCode": "0",
179
+ "errorCodes": [
180
+ "0"
181
+ ]
182
+ },
183
+ "recalls": {
184
+ "count": 13,
185
+ "doNotDrive": false,
186
+ "parkOutside": false,
187
+ "bySeverity": {
188
+ "critical": 0,
189
+ "high": 10,
190
+ "medium": 3,
191
+ "low": 0
192
+ },
193
+ "latestReportedOn": "2019-06-27",
194
+ "items": [
195
+ {
196
+ "id": "19V499000",
197
+ "manufacturerRecallId": "Q5A, Y58",
198
+ "manufacturer": "Honda (American Honda Motor Co.)",
199
+ "reportedOn": "2019-06-27",
200
+ "ownersNotifiedOn": "2019-08-12",
201
+ "initiatedBy": "nhtsa",
202
+ "components": [
203
+ {
204
+ "system": "Air Bags",
205
+ "detail": "Frontal › Driver Side › Inflator Module"
206
+ }
207
+ ],
208
+ "summary": "Honda (American Honda Motor Co.) is recalling certain 2003 Acura 3.2CL, 2002-2003 3.2TL, 2003-2006 MDX, 2001-2007 Honda Accord, 2001-2005 Civic, 2003-2005 Civic Hybrid, 2001-2005 Civic GX NGV, 2002-2006 CR-V, 2003-2011 Element, 2002-2004 Odyssey, 2003-2008 Pilot and 2006 Ridgeline vehicles. These vehicles are equipped with driver frontal air bag inflators assembled as a recall remedy part or replacement service part, that may explode due to propellant degradation occurring after long-term exposure to high absolute humidity, temperature and temperature cycling.",
209
+ "consequence": "An inflator explosion may result in sharp metal fragments striking the driver or other occupants resulting in serious injury or death.",
210
+ "hazards": [
211
+ "injury",
212
+ "death"
213
+ ],
214
+ "doNotDrive": false,
215
+ "parkOutside": false,
216
+ "remedy": {
217
+ "description": "Honda will notify owners, and dealers will replace the driver frontal air bag inflator, free of charge. The recall began August 12, 2019. Owners may contact Honda customer service at 1-888-234-2138. Honda's numbers for this recall are Q5A and Y58.",
218
+ "status": "available",
219
+ "overTheAir": false,
220
+ "freeOfCharge": true
221
+ },
222
+ "unitsAffected": 3947,
223
+ "manufactured": {
224
+ "from": "2000-07-10",
225
+ "to": "2011-02-22"
226
+ },
227
+ "scope": {
228
+ "makes": 2,
229
+ "models": 12,
230
+ "modelYears": {
231
+ "from": 2001,
232
+ "to": 2011
233
+ }
234
+ },
235
+ "url": "https://www.nhtsa.gov/recalls?nhtsaId=19V499000",
236
+ "severity": "high",
237
+ "match": "exact",
238
+ "listedAs": "ACCORD"
239
+ },
240
+ {
241
+ "id": "19V501000",
242
+ "manufacturerRecallId": "E5D, X5C",
243
+ "manufacturer": "Honda (American Honda Motor Co.)",
244
+ "reportedOn": "2019-06-27",
245
+ "ownersNotifiedOn": "2019-08-12",
246
+ "initiatedBy": "nhtsa",
247
+ "components": [
248
+ {
249
+ "system": "Air Bags",
250
+ "detail": "Frontal › Passenger Side › Inflator Module"
251
+ }
252
+ ],
253
+ "summary": "Honda (American Honda Motor Co.) is recalling certain 2003-2006 Acura MDX, 2005-2012 RL, 2003-2007 Honda Accord, 2001-2005 Civic, 2003-2005 Civic Hybrid, 2001-2005 Civic GX NGV, 2002-2006 CR-V, 2003-2011 Element, 2007-2008 Fit, 2002-2004 Odyssey, 2003-2008 Pilot, and 2006-2014 Ridgeline vehicles. The vehicles are equipped with passenger frontal air bag inflators assembled as a recall remedy part or replacement service part, that may explode due to propellant degradation occurring after long-term exposure to high absolute humidity, temperature and temperature cycling.",
254
+ "consequence": "An inflator explosion may result in sharp metal fragments striking the driver or other occupants resulting in serious injury or death.",
255
+ "hazards": [
256
+ "injury",
257
+ "death"
258
+ ],
259
+ "doNotDrive": false,
260
+ "parkOutside": false,
261
+ "remedy": {
262
+ "description": "Honda will notify owners, and dealers will replace the passenger frontal airbag inflator, free of charge. The recall began August 12, 2019. Owners may contact Honda customer service at 1-888-234-2138. Honda's numbers for this recall are E5D and X5C.",
263
+ "status": "available",
264
+ "overTheAir": false,
265
+ "freeOfCharge": true
266
+ },
267
+ "unitsAffected": 1657752,
268
+ "manufactured": {
269
+ "from": "2000-04-25",
270
+ "to": "2014-06-02"
271
+ },
272
+ "scope": {
273
+ "makes": 2,
274
+ "models": 12,
275
+ "modelYears": {
276
+ "from": 2001,
277
+ "to": 2014
278
+ }
279
+ },
280
+ "url": "https://www.nhtsa.gov/recalls?nhtsaId=19V501000",
281
+ "severity": "high",
282
+ "match": "exact",
283
+ "listedAs": "ACCORD"
284
+ }
285
+ ]
286
+ },
287
+ "safetyRating": {
288
+ "testedVehicle": "2003 Honda Accord 2-DR. w/SAB",
289
+ "match": "exact",
290
+ "variantsTested": 4,
291
+ "overall": null,
292
+ "frontal": {
293
+ "overall": null,
294
+ "driver": 5,
295
+ "passenger": 5
296
+ },
297
+ "side": {
298
+ "overall": null,
299
+ "driver": null,
300
+ "passenger": null,
301
+ "barrier": null,
302
+ "pole": null,
303
+ "frontSeat": null,
304
+ "rearSeat": null
305
+ },
306
+ "rollover": {
307
+ "rating": 4,
308
+ "riskPercent": null,
309
+ "tipped": null
310
+ },
311
+ "driverAssist": {
312
+ "electronicStabilityControl": "notAvailable",
313
+ "forwardCollisionWarning": "notAvailable",
314
+ "laneDepartureWarning": "notAvailable"
315
+ }
316
+ }
317
+ }
318
+ }
319
+ ```
320
+
321
+ ---
322
+
323
+ ## Customer Support
324
+
325
+ Need any assistance? [Get in touch with Customer Support](https://apiverve.com/contact?utm_source=npm&utm_medium=referral&utm_content=readme).
326
+
327
+ ---
328
+
329
+ ## Updates
330
+
331
+ Stay up to date by following [@apiverveHQ](https://twitter.com/apiverveHQ) on Twitter.
332
+
333
+ ---
334
+
335
+ ## Legal
336
+
337
+ All usage of the APIVerve website, API, and services is subject to the [APIVerve Terms of Service](https://apiverve.com/terms?utm_source=npm&utm_medium=referral&utm_content=readme) and [Privacy Policy](https://apiverve.com/privacy?utm_source=npm&utm_medium=referral&utm_content=readme).
338
+
339
+ ---
340
+
341
+ ## License
342
+ Licensed under the MIT License (MIT)
343
+
344
+ Copyright (©) 2026 APIVerve, and EvlarSoft LLC
345
+
346
+ Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
347
+
348
+ The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
349
+
350
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
package/index.d.ts ADDED
@@ -0,0 +1,212 @@
1
+ declare module '@apiverve/vindecoder' {
2
+ export interface vindecoderOptions {
3
+ api_key: string;
4
+ secure?: boolean;
5
+ }
6
+
7
+ /**
8
+ * Describes fields the current plan does not unlock. Locked fields arrive as null
9
+ * in `data`; `locked_fields` names them, using dot paths for nested fields.
10
+ * Absent when the plan unlocks everything.
11
+ */
12
+ export interface PremiumInfo {
13
+ message: string;
14
+ upgrade_url: string;
15
+ locked_fields: string[];
16
+ }
17
+
18
+ export interface vindecoderResponse {
19
+ status: string;
20
+ error: string | null;
21
+ data: VINDecoderData;
22
+ code?: number;
23
+ premium?: PremiumInfo;
24
+ }
25
+
26
+
27
+ interface VINDecoderData {
28
+ vin: null | string;
29
+ valid: boolean | null;
30
+ decoded: boolean | null;
31
+ vehicleDescriptor: null | string;
32
+ make: null | string;
33
+ model: null | string;
34
+ year: number | null;
35
+ trim: null | string;
36
+ trim2: null;
37
+ series: null;
38
+ series2: null;
39
+ manufacturer: null | string;
40
+ vehicleType: null | string;
41
+ bodyClass: null | string;
42
+ plant: Plant;
43
+ engine: Engine;
44
+ features: Features;
45
+ validation: Validation;
46
+ recalls: Recalls;
47
+ safetyRating: SafetyRating;
48
+ }
49
+
50
+ interface Engine {
51
+ displacementL: null | string;
52
+ displacementCc: null | string;
53
+ engineNumberOfCylinders: null | string;
54
+ engineModel: null | string;
55
+ engineConfiguration: null | string;
56
+ engineBrakeHPFrom: null | string;
57
+ displacementCi: null | string;
58
+ fuelTypePrimary: null | string;
59
+ valveTrainDesign: null | string;
60
+ }
61
+
62
+ interface Features {
63
+ passiveSafetySystem: PassiveSafetySystem;
64
+ exterior: Exterior;
65
+ mechanical: Mechanical;
66
+ }
67
+
68
+ interface Exterior {
69
+ grossVehicleWeightRatingFrom: null | string;
70
+ grossVehicleWeightRatingTo: null | string;
71
+ doors: null | string;
72
+ }
73
+
74
+ interface Mechanical {
75
+ transmissionStyle: null | string;
76
+ transmissionSpeeds: null | string;
77
+ }
78
+
79
+ interface PassiveSafetySystem {
80
+ otherRestraintSystemInfo: null | string;
81
+ seatBeltType: null | string;
82
+ sideAirBagLocations: null | string;
83
+ curtainAirBagLocations: null | string;
84
+ frontAirBagLocations: null | string;
85
+ }
86
+
87
+ interface Plant {
88
+ state: null | string;
89
+ country: null | string;
90
+ city: null | string;
91
+ }
92
+
93
+ interface Recalls {
94
+ count: number | null;
95
+ doNotDrive: boolean | null;
96
+ parkOutside: boolean | null;
97
+ bySeverity: BySeverity;
98
+ latestReportedOn: Date | null;
99
+ items: Item[];
100
+ }
101
+
102
+ interface BySeverity {
103
+ critical: number | null;
104
+ high: number | null;
105
+ medium: number | null;
106
+ low: number | null;
107
+ }
108
+
109
+ interface Item {
110
+ id: null | string;
111
+ manufacturerRecallID: null | string;
112
+ manufacturer: null | string;
113
+ reportedOn: Date | null;
114
+ ownersNotifiedOn: Date | null;
115
+ initiatedBy: null | string;
116
+ components: Component[];
117
+ summary: null | string;
118
+ consequence: null | string;
119
+ hazards: (null | string)[];
120
+ doNotDrive: boolean | null;
121
+ parkOutside: boolean | null;
122
+ remedy: Remedy;
123
+ unitsAffected: number | null;
124
+ manufactured: Manufactured;
125
+ scope: Scope;
126
+ url: null | string;
127
+ severity: null | string;
128
+ match: null | string;
129
+ listedAs: null | string;
130
+ }
131
+
132
+ interface Component {
133
+ system: null | string;
134
+ detail: null | string;
135
+ }
136
+
137
+ interface Manufactured {
138
+ from: Date | null;
139
+ to: Date | null;
140
+ }
141
+
142
+ interface Remedy {
143
+ description: null | string;
144
+ status: null | string;
145
+ overTheAir: boolean | null;
146
+ freeOfCharge: boolean | null;
147
+ }
148
+
149
+ interface Scope {
150
+ makes: number | null;
151
+ models: number | null;
152
+ modelYears: ModelYears;
153
+ }
154
+
155
+ interface ModelYears {
156
+ from: number | null;
157
+ to: number | null;
158
+ }
159
+
160
+ interface SafetyRating {
161
+ testedVehicle: null | string;
162
+ match: null | string;
163
+ variantsTested: number | null;
164
+ overall: null;
165
+ frontal: Frontal;
166
+ side: Side;
167
+ rollover: Rollover;
168
+ driverAssist: DriverAssist;
169
+ }
170
+
171
+ interface DriverAssist {
172
+ electronicStabilityControl: null | string;
173
+ forwardCollisionWarning: null | string;
174
+ laneDepartureWarning: null | string;
175
+ }
176
+
177
+ interface Frontal {
178
+ overall: null;
179
+ driver: number | null;
180
+ passenger: number | null;
181
+ }
182
+
183
+ interface Rollover {
184
+ rating: number | null;
185
+ riskPercent: null;
186
+ tipped: null;
187
+ }
188
+
189
+ interface Side {
190
+ overall: null;
191
+ driver: null;
192
+ passenger: null;
193
+ barrier: null;
194
+ pole: null;
195
+ frontSeat: null;
196
+ rearSeat: null;
197
+ }
198
+
199
+ interface Validation {
200
+ errorText: null | string;
201
+ errorCode: null | string;
202
+ errorCodes: (null | string)[];
203
+ }
204
+
205
+ export default class vindecoderWrapper {
206
+ constructor(options: vindecoderOptions);
207
+
208
+ execute(callback: (error: any, data: vindecoderResponse | null) => void): Promise<vindecoderResponse>;
209
+ execute(query: Record<string, any>, callback: (error: any, data: vindecoderResponse | null) => void): Promise<vindecoderResponse>;
210
+ execute(query?: Record<string, any>): Promise<vindecoderResponse>;
211
+ }
212
+ }
package/index.js CHANGED
@@ -1,90 +1,209 @@
1
- const axios = require('axios');
2
-
3
- class vindecoderWrapper {
4
-
5
- constructor(options) {
6
- if (!options || typeof options !== 'object') {
7
- throw new Error('Options object must be provided.');
8
- }
9
-
10
- const { api_key, secure = true } = options;
11
-
12
- if (!api_key || typeof api_key !== 'string') {
13
- throw new Error('API key must be provided as a non-empty string.');
14
- }
15
- if (typeof secure !== 'boolean') {
16
- throw new Error('Secure parameter must be a boolean value.');
17
- }
18
-
19
- this.APIKey = api_key;
20
- this.IsSecure = secure;
21
-
22
- // secure is deprecated, all requests must be made over HTTPS
23
- this.baseURL = 'https://api.apiverve.com/v1/vindecoder';
24
- }
25
-
26
- async execute(query, callback) {
27
- if(arguments.length > 1) {
28
- if (!query || typeof query !== 'object') {
29
- throw new Error('Query parameters must be provided as an object.');
30
- }
31
- } else {
32
- callback = query;
33
- query = {};
34
- }
35
-
36
- var requiredParams = ["vin"];
37
- if (requiredParams.length > 0) {
38
- for (var i = 0; i < requiredParams.length; i++) {
39
- if (!query[requiredParams[i]]) {
40
- throw new Error(`Required parameter [${requiredParams[i]}] is missing.`);
41
- }
42
- }
43
- }
44
-
45
- const method = 'GET';
46
- const url = method === 'POST' ? this.baseURL : this.constructURL(query);
47
-
48
- try {
49
- const response = await axios({
50
- method,
51
- url,
52
- headers: {
53
- 'Content-Type': 'application/json',
54
- 'x-api-key': this.APIKey,
55
- 'auth-mode': 'npm-package'
56
- },
57
- data: method === 'POST' ? query : undefined
58
- });
59
-
60
- const data = response.data;
61
- callback(null, data);
62
- return data;
63
- } catch (error) {
64
- if (error.response.data) {
65
- callback(error.response.data, null);
66
- throw error.response.data;
67
- } else {
68
- callback(error, null);
69
- throw error;
70
- }
71
- }
72
- }
73
-
74
- constructURL(query) {
75
- let url = this.baseURL;
76
-
77
- if(query && typeof query === 'object')
78
- {
79
- if (Object.keys(query).length > 0) {
80
- const queryString = Object.keys(query)
81
- .map(key => `${encodeURIComponent(key)}=${encodeURIComponent(query[key])}`)
82
- .join('&');
83
- url += `?${queryString}`;
84
- }
85
- }
86
- return url;
87
- }
88
- }
89
-
90
- module.exports = vindecoderWrapper;
1
+ const axios = require('axios');
2
+
3
+ class vindecoderWrapper {
4
+
5
+ constructor(options) {
6
+ if (!options || typeof options !== 'object') {
7
+ throw new Error('Options object must be provided. See documentation: https://docs.apiverve.com/ref/vindecoder');
8
+ }
9
+
10
+ const { api_key, secure = true } = options;
11
+
12
+ if (!api_key || typeof api_key !== 'string') {
13
+ throw new Error('API key must be provided as a non-empty string. Get your API key at: https://apiverve.com');
14
+ }
15
+
16
+ // Validate API key format (GUID, prefixed keys like apv_xxx, or alphanumeric)
17
+ const apiKeyPattern = /^[a-zA-Z0-9_-]+$/;
18
+ if (!apiKeyPattern.test(api_key)) {
19
+ throw new Error('Invalid API key format. API key must be alphanumeric and may contain hyphens and underscores. Get your API key at: https://apiverve.com');
20
+ }
21
+
22
+ if (typeof secure !== 'boolean') {
23
+ throw new Error('Secure parameter must be a boolean value.');
24
+ }
25
+
26
+ this.APIKey = api_key;
27
+ this.IsSecure = secure;
28
+
29
+ // secure is deprecated, all requests must be made over HTTPS
30
+ this.baseURL = 'https://api.apiverve.com/v1/vindecoder';
31
+
32
+ // Validation rules for parameters (generated from schema)
33
+ this.validationRules = {"vin":{"type":"string","required":true,"minLength":1,"maxLength":17},"recalls":{"type":"boolean","required":false},"safetyRating":{"type":"boolean","required":false}};
34
+ }
35
+
36
+ /**
37
+ * Validate query parameters against schema rules
38
+ * @param {Object} query - The query parameters to validate
39
+ * @throws {Error} - If validation fails
40
+ */
41
+ validateParams(query) {
42
+ const errors = [];
43
+
44
+ for (const [paramName, rules] of Object.entries(this.validationRules)) {
45
+ const value = query[paramName];
46
+
47
+ // Check required
48
+ if (rules.required && (value === undefined || value === null || value === '')) {
49
+ errors.push(`Required parameter [${paramName}] is missing.`);
50
+ continue;
51
+ }
52
+
53
+ // Skip validation if value is not provided and not required
54
+ if (value === undefined || value === null) {
55
+ continue;
56
+ }
57
+
58
+ // Type validation
59
+ if (rules.type === 'integer' || rules.type === 'number') {
60
+ const numValue = Number(value);
61
+ if (isNaN(numValue)) {
62
+ errors.push(`Parameter [${paramName}] must be a valid ${rules.type}.`);
63
+ continue;
64
+ }
65
+
66
+ if (rules.type === 'integer' && !Number.isInteger(numValue)) {
67
+ errors.push(`Parameter [${paramName}] must be an integer.`);
68
+ continue;
69
+ }
70
+
71
+ // Min/max validation for numbers
72
+ if (rules.min !== undefined && numValue < rules.min) {
73
+ errors.push(`Parameter [${paramName}] must be at least ${rules.min}.`);
74
+ }
75
+ if (rules.max !== undefined && numValue > rules.max) {
76
+ errors.push(`Parameter [${paramName}] must be at most ${rules.max}.`);
77
+ }
78
+ } else if (rules.type === 'string') {
79
+ if (typeof value !== 'string') {
80
+ errors.push(`Parameter [${paramName}] must be a string.`);
81
+ continue;
82
+ }
83
+
84
+ // Length validation for strings
85
+ if (rules.minLength !== undefined && value.length < rules.minLength) {
86
+ errors.push(`Parameter [${paramName}] must be at least ${rules.minLength} characters.`);
87
+ }
88
+ if (rules.maxLength !== undefined && value.length > rules.maxLength) {
89
+ errors.push(`Parameter [${paramName}] must be at most ${rules.maxLength} characters.`);
90
+ }
91
+
92
+ // Format validation
93
+ if (rules.format) {
94
+ const formatPatterns = {
95
+ 'email': /^[^\s@]+@[^\s@]+\.[^\s@]+$/,
96
+ 'url': /^https?:\/\/.+/i,
97
+ 'ip': /^(?:(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\.){3}(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)$|^([0-9a-fA-F]{1,4}:){7}[0-9a-fA-F]{1,4}$/,
98
+ 'date': /^\d{4}-\d{2}-\d{2}$/,
99
+ 'hexColor': /^#?([0-9a-fA-F]{3}|[0-9a-fA-F]{6})$/
100
+ };
101
+
102
+ if (formatPatterns[rules.format] && !formatPatterns[rules.format].test(value)) {
103
+ errors.push(`Parameter [${paramName}] must be a valid ${rules.format}.`);
104
+ }
105
+ }
106
+ } else if (rules.type === 'boolean') {
107
+ if (typeof value !== 'boolean' && value !== 'true' && value !== 'false') {
108
+ errors.push(`Parameter [${paramName}] must be a boolean.`);
109
+ }
110
+ } else if (rules.type === 'array') {
111
+ if (!Array.isArray(value)) {
112
+ errors.push(`Parameter [${paramName}] must be an array.`);
113
+ }
114
+ }
115
+
116
+ // Enum validation
117
+ if (rules.enum && Array.isArray(rules.enum)) {
118
+ if (!rules.enum.includes(value)) {
119
+ errors.push(`Parameter [${paramName}] must be one of: ${rules.enum.join(', ')}.`);
120
+ }
121
+ }
122
+ }
123
+
124
+ if (errors.length > 0) {
125
+ throw new Error(`Validation failed: ${errors.join(' ')} See documentation: https://docs.apiverve.com/ref/vindecoder`);
126
+ }
127
+ }
128
+
129
+ async execute(query, callback) {
130
+ // Handle different argument patterns
131
+ if(arguments.length === 0) {
132
+ // execute() - no args
133
+ query = {};
134
+ callback = null;
135
+ } else if(arguments.length === 1) {
136
+ if (typeof query === 'function') {
137
+ // execute(callback)
138
+ callback = query;
139
+ query = {};
140
+ } else {
141
+ // execute(query)
142
+ callback = null;
143
+ }
144
+ } else {
145
+ // execute(query, callback)
146
+ if (!query || typeof query !== 'object') {
147
+ throw new Error('Query parameters must be provided as an object.');
148
+ }
149
+ }
150
+
151
+ // Validate parameters against schema rules
152
+ this.validateParams(query);
153
+
154
+ const method = 'GET';
155
+ const url = method === 'POST' ? this.baseURL : this.constructURL(query);
156
+
157
+ try {
158
+ const response = await axios({
159
+ method,
160
+ url,
161
+ headers: {
162
+ 'Content-Type': 'application/json',
163
+ 'x-api-key': this.APIKey,
164
+ 'auth-mode': 'npm-package'
165
+ },
166
+ data: method === 'POST' ? query : undefined
167
+ });
168
+
169
+ const data = response.data;
170
+ if (callback) callback(null, data);
171
+ return data;
172
+ } catch (error) {
173
+ let apiError;
174
+
175
+ if (error.response && error.response.data) {
176
+ apiError = error.response.data;
177
+ } else if (error.message) {
178
+ apiError = { error: error.message, status: 'error' };
179
+ } else {
180
+ apiError = { error: 'An unknown error occurred', status: 'error' };
181
+ }
182
+
183
+ if (callback) {
184
+ callback(apiError, null);
185
+ return; // Don't throw if callback is provided
186
+ }
187
+
188
+ throw apiError;
189
+ }
190
+ }
191
+
192
+ constructURL(query) {
193
+ let url = this.baseURL;
194
+
195
+ if(query && typeof query === 'object')
196
+ {
197
+ if (Object.keys(query).length > 0) {
198
+ const queryString = Object.keys(query)
199
+ .map(key => `${encodeURIComponent(key)}=${encodeURIComponent(query[key])}`)
200
+ .join('&');
201
+ url += `?${queryString}`;
202
+ }
203
+ }
204
+ return url;
205
+ }
206
+
207
+ }
208
+
209
+ module.exports = vindecoderWrapper;
package/package.json CHANGED
@@ -1,32 +1,47 @@
1
1
  {
2
2
  "name": "@apiverve/vindecoder",
3
- "version": "1.1.7",
4
- "description": "VIN Decoder is a simple tool for decoding vehicle identification numbers. It returns the make, model, and more of the vehicle.",
3
+ "version": "1.2.2",
4
+ "description": "VIN Decoder turns a 17-character Vehicle Identification Number into the vehicle it identifies. Returns make, model, year, trim, body class and manufacturer, plus engine specifications, plant of manufacture, and the safety equipment fitted to that specific build. Optionally adds every safety recall issued for that vehicle and its NHTSA 5-star crash-test rating.",
5
5
  "main": "index.js",
6
+ "types": "index.d.ts",
7
+ "sideEffects": false,
8
+ "engines": {
9
+ "node": ">=18.0.0"
10
+ },
11
+ "files": [
12
+ "index.js",
13
+ "index.d.ts",
14
+ "LICENSE"
15
+ ],
6
16
  "scripts": {
7
- "test": "mocha"
17
+ "test": "mocha",
18
+ "example": "node examples/basic.js"
8
19
  },
9
20
  "repository": {
10
21
  "type": "git",
11
- "url": "git+https://github.com/apiverve/vindecoder-API.git"
22
+ "url": "git+https://github.com/apiverve/vindecoder-api.git",
23
+ "directory": "npm"
12
24
  },
13
25
  "keywords": [
14
- "vin decoder","vin decoder api","vin decoder tool","vin decoder software","vin decoder service"
26
+ "vin decoder api", "vin api", "nhtsa vin decoder api", "vin lookup api", "vin decoder"
15
27
  ],
16
- "author": "APIVerve <hello@apiverve.com> (http://apiverve.com/)",
28
+ "author": {
29
+ "name": "APIVerve",
30
+ "email": "hello@apiverve.com",
31
+ "url": "https://apiverve.com"
32
+ },
17
33
  "license": "MIT",
18
34
  "bugs": {
19
- "url": "https://github.com/apiverve/vindecoder-API/issues"
35
+ "url": "https://github.com/apiverve/vindecoder-api/issues"
20
36
  },
21
- "homepage": "https://apiverve.com/marketplace/api/vindecoder?utm_source=npm",
37
+ "homepage": "https://apiverve.com/marketplace/vindecoder?utm_source=npm&utm_medium=referral&utm_content=homepage",
22
38
  "devDependencies": {
23
39
  "mocha": "^11.0.1",
24
40
  "chai": "^5.1.2",
25
41
  "dotenv": "^16.4.7"
26
42
  },
27
43
  "dependencies": {
28
- "node-fetch": "^3.3.2",
29
- "promise": "^8.3.0",
30
- "axios": "1.7.9"
44
+ "axios": "1.13.2",
45
+ "form-data": "^4.0.1"
31
46
  }
32
47
  }
package/tmp/build.dat DELETED
@@ -1 +0,0 @@
1
- #