### Vehicle Features Query Parameters Source: https://github.com/kryptobaseddev/cardev-api/blob/main/getting-started-vehicle-listings.md Provides a list of query parameters and their values for filtering vehicle listings by various features. These parameters enable detailed searches based on installed vehicle options. ```APIDOC Parameter: features[]=backup_camera, Value: Backup Camera Parameter: features[]=bluetooth, Value: Bluetooth Parameter: features[]=entertainment, Value: Entertainment Parameter: features[]=handicap_accessible, Value: Handicap Accessible Parameter: features[]=heated_seats, Value: Heated Seats Parameter: features[]=ipod_aux_input, Value: Aux Input Parameter: features[]=lane_departure_warning_system, Value: Lane Departure Warning Parameter: features[]=leather, Value: Leather Parameter: features[]=navigation, Value: Navigation Parameter: features[]=one_owner, Value: One Owner Parameter: features[]=roof_rack, Value: Roof Rack Parameter: features[]=sunroof, Value: Sunroof Parameter: features[]=third_row_seats, Value: Third Row Seat Parameter: features[]=towing, Value: Towing Parameter: features[]=warranty, Value: Warranty ``` -------------------------------- ### Decode VIN using cURL Source: https://github.com/kryptobaseddev/cardev-api/blob/main/getting-started-vin-decode.md Example of how to search for comprehensive vehicle information by VIN using a cURL command, including authentication via the Authorization header. ```bash curl "https://auto.dev/api/vin/ZPBUA1ZL9KLA00848" \ -H "Authorization: Bearer " ``` -------------------------------- ### Filter Vehicle Listings by Make, Model, Features, and Colors Source: https://github.com/kryptobaseddev/cardev-api/blob/main/getting-started-vehicle-listings.md Example curl command to search and filter vehicle listings using a wide range of parameters including make, model, trim, location details, transmission type, specific features, and exterior/interior colors. ```bash curl "https://auto.dev/api/listings?apikey=&year_min=2016&make=Acura&model=MDX&trim[]=Base&trim[]=SH-AWD&city=Los%20Angeles&state=CA&location=Los%20Angeles,%20CA&latitude=34.0522342&longitude=-118.2436849&radius=100&transmission[]=automatic&features[]=sunroof&exterior_color[]=gray&exterior_color[]=silver&interior_color[]=black&page=1" \ -H "Authorization: Bearer " ``` -------------------------------- ### Filter Vehicle Listings by Price, Year, Mileage, and Drivetrain Source: https://github.com/kryptobaseddev/cardev-api/blob/main/getting-started-vehicle-listings.md Example curl command to search and filter vehicle listings using advanced parameters such as maximum price, minimum year, maximum mileage, drivetrain, and condition, along with location and color filters. ```bash curl "https://auto.dev/api/listings?apikey=&price_max=60000&year_min=2016&make=Audi&city=Los%20Angeles&state=CA&location=Los%20Angeles,%20CA&latitude=34.0522342&longitude=-118.2436849&radius=50&mileage=45000&driveline[]=AWD&condition[]=used&condition[]=certified%20pre-owned&exterior_color[]=black&page=1" \ -H "Authorization: Bearer " ``` -------------------------------- ### Filter Vehicle Listings by Interior and Exterior Colors with cURL Source: https://github.com/kryptobaseddev/cardev-api/blob/main/getting-started-vehicle-listings.md This example shows how to filter vehicle listings based on specific interior and exterior colors. The cURL command demonstrates combining multiple color parameters with a make filter to refine search results. ```bash curl "https://auto.dev/api/listings?apikey=&make=Toyota&exterior_color[]=red&interior_color[]=blue&page=1" \ -H "Authorization: Bearer " ``` -------------------------------- ### Filter Vehicle Listings by Pickup Truck Specifications (Bash) Source: https://github.com/kryptobaseddev/cardev-api/blob/main/getting-started-vehicle-listings.md Demonstrates how to use `body_style[]`, `cabin[]`, and `bed[]` query parameters to filter vehicle listings specifically for pickup trucks. This example filters for 'truck' body style, 'crew' cabin, and 'regular' bed type. ```bash curl "https://auto.dev/api/listings?apikey=&body_style[]=truck&cabin[]=crew&bed[]=regular&page=1" \ -H "Authorization: Bearer " ``` -------------------------------- ### Authenticate API Requests with Query Parameter Source: https://github.com/kryptobaseddev/cardev-api/blob/main/getting-started-vehicle-listings.md Shows an alternative method to pass the API access key as an 'apikey' query parameter directly in the URL. This offers convenience and flexibility, though headers are more secure. ```APIDOC https://auto.dev/api/listings?apikey= ``` -------------------------------- ### Filter Vehicle Listings by Category with cURL Source: https://github.com/kryptobaseddev/cardev-api/blob/main/getting-started-vehicle-listings.md This example demonstrates how to filter vehicle listings by a specific category, such as 'electric'. It shows how to combine category filtering with make, model, and radius parameters in a cURL request. ```bash curl "https://auto.dev/api/listings?apikey=&make=Tesla&model=Model%203&category=electric&radius=50&page=1" \ -H "Authorization: Bearer " ``` -------------------------------- ### Paginate Vehicle Listing Results Source: https://github.com/kryptobaseddev/cardev-api/blob/main/getting-started-vehicle-listings.md Explains how to use the 'page' parameter to retrieve specific pages of vehicle listing results. This allows accessing all available listings through the API, one page at a time. ```APIDOC `&condition[]=used&page=3` returns the third page of listings results. You may access every available listing through the API, one page at a time. ``` -------------------------------- ### Vehicle Category Query Parameters Source: https://github.com/kryptobaseddev/cardev-api/blob/main/getting-started-vehicle-listings.md Lists the available query parameters and their corresponding values for filtering vehicle listings by category. This allows users to search for vehicles based on their general classification. ```APIDOC Parameter: -, Value: Any Category Parameter: category=american, Value: American Parameter: category=classic, Value: Classic Parameter: category=commuter, Value: Commuter Parameter: category=electric, Value: Electric Parameter: category=family, Value: Family Parameter: category=fuel_efficient, Value: Fuel Efficient Parameter: category=hybrid, Value: Hybrid Parameter: category=large, Value: Large Parameter: category=muscle, Value: Muscle Parameter: category=off_road, Value: Off Road Parameter: category=small, Value: Small Parameter: category=sport, Value: Sport Parameter: category=supercar, Value: Supercar ``` -------------------------------- ### Engine Cylinders Query Parameters Source: https://github.com/kryptobaseddev/cardev-api/blob/main/getting-started-vehicle-listings.md Provides a list of query parameters and their values for filtering vehicle listings by the number of engine cylinders. This allows for specific searches based on engine configuration. ```APIDOC Parameter: engine_cylinders[]=2, Value: 2 Parameter: engine_cylinders[]=3, Value: 3 Parameter: engine_cylinders[]=4, Value: 4 Parameter: engine_cylinders[]=6, Value: 6 Parameter: engine_cylinders[]=8, Value: 8 Parameter: engine_cylinders[]=10, Value: 10 Parameter: engine_cylinders[]=12, Value: 12 ``` -------------------------------- ### Body Style Query Parameters Source: https://github.com/kryptobaseddev/cardev-api/blob/main/getting-started-vehicle-listings.md Lists the available query parameters and their corresponding values for filtering vehicle listings by body style. These parameters can be appended to the API request URL. ```APIDOC Parameter: body_style[]=convertible, Value: Convertible Parameter: body_style[]=coupe, Value: Coupe Parameter: body_style[]=minivan, Value: Minivan Parameter: body_style[]=crossover, Value: Crossover Parameter: body_style[]=passenger_cargo_vans, Value: Passenger & Cargo Vans Parameter: body_style[]=sedan, Value: Sedan Parameter: body_style[]=suv, Value: SUV Parameter: body_style[]=truck, Value: Truck Parameter: body_style[]=wagon, Value: Wagon ``` -------------------------------- ### API Reference: Advanced Vehicle Listing Search Parameters Source: https://github.com/kryptobaseddev/cardev-api/blob/main/getting-started-vehicle-listings.md Details advanced parameters for filtering vehicle listings, including price, mileage, drivetrain, condition, and options to exclude certain listing types like 'online only' or 'no price' listings. ```APIDOC Search Type | Parameter | Value ------------|-----------|------- Price Range Max | `price_max=60000` | $60,000 Year Range Min | `year_min=2016` | 2016-2022 Make | `make=Audi` | Audi City | `city=Los%20Angeles` | Los Angeles State | `state=CA` | California Location | `location=Los%20Angeles%20CA` | Los Angeles, CA Latitude | `latitude=34.0522342` | 34.0522342 Longitude | `longitude=-118.2436849` | -118.2436849 Radius | `radius=50` | 50 miles Max Mileage | `mileage=45000` | Max Mileage 45,000 Drivetrain | `driveline[]=AWD` | AWD Condition | `condition[]=used` | Used Condition | `condition[]=certified%20pre-owned` | Certified Pre-owned Exterior Color | `exterior_color[]=black` | Black Listing Type | `exclude_regional=true` | Hide "online only" listings Listing Type | `exclude_no_price=true` | Hide listings with no price ``` -------------------------------- ### API Parameters for Vehicle Condition Filtering Source: https://github.com/kryptobaseddev/cardev-api/blob/main/getting-started-vehicle-listings.md Defines query parameters for filtering vehicle listings based on their condition. The `condition[]` parameter supports values such as 'new', 'used', and 'certified pre-owned'. ```APIDOC Parameter: condition[] Values: new: New used: Used certified%20pre-owned: Certified Pre-owned ``` -------------------------------- ### Authenticate API Requests with Authorization Header Source: https://github.com/kryptobaseddev/cardev-api/blob/main/getting-started-vin-decode.md Demonstrates how to pass the application's access key using the HTTP Authorization header for API authentication. This method is generally more secure. ```Text Authorization: Bearer ``` -------------------------------- ### Authenticate API Requests with Query Parameter Source: https://github.com/kryptobaseddev/cardev-api/blob/main/getting-started-vin-decode.md Shows how to pass the access key as an 'apikey' query parameter directly in the URL for API authentication. This method offers convenience and flexibility. ```HTTP https://auto.dev/api/vin/ZPBUA1ZL9KLA00848?apikey= ``` -------------------------------- ### Sort Vehicle Listings by Various Criteria Source: https://github.com/kryptobaseddev/cardev-api/blob/main/getting-started-vehicle-listings.md Example curl command demonstrating how to sort vehicle listings using the 'sort_filter' parameter. This allows ordering results by criteria such as creation date, price, distance, year, and mileage. ```bash curl "https://auto.dev/api/listings?apikey=&sort_filter=created_at:asc&make=Tesla&model=Model%203&radius=50&condition[]=used&page=1" \ -H "Authorization: Bearer " ``` -------------------------------- ### Filter Vehicle Listings by Condition and Fuel Type (Bash) Source: https://github.com/kryptobaseddev/cardev-api/blob/main/getting-started-vehicle-listings.md Demonstrates how to use the `condition[]` and `fuel_type[]` query parameters to filter vehicle listings. Multiple values can be added for each parameter using the `[]` array syntax. This example shows filtering for 'used' condition and 'gasoline' fuel type. ```bash curl "https://auto.dev/api/listings?apikey=&condition[]=used&fuel_type[]=gasoline&page=1" \ -H "Authorization: Bearer " ``` -------------------------------- ### Authenticate API Requests with Bearer Token Header Source: https://github.com/kryptobaseddev/cardev-api/blob/main/getting-started-vehicle-listings.md Demonstrates how to include the API access key in the HTTP Authorization header using a Bearer token. This method is generally recommended for enhanced security. ```APIDOC Authorization: Bearer ``` -------------------------------- ### Exterior Color Query Parameters Source: https://github.com/kryptobaseddev/cardev-api/blob/main/getting-started-vehicle-listings.md Lists the available query parameters and their corresponding values for filtering vehicle listings by exterior color. This allows users to search for vehicles based on their external paint color. ```APIDOC Parameter: exterior_color[]=black, Value: Black Parameter: exterior_color[]=silver, Value: Silver Parameter: exterior_color[]=white, Value: White Parameter: exterior_color[]=gray, Value: Gray Parameter: exterior_color[]=red, Value: Red Parameter: exterior_color[]=green, Value: Green Parameter: exterior_color[]=yellow, Value: Yellow Parameter: exterior_color[]=blue, Value: Blue Parameter: exterior_color[]=brown, Value: Brown Parameter: exterior_color[]=orange, Value: Orange Parameter: exterior_color[]=purple, Value: Purple Parameter: exterior_color[]=gold, Value: Gold ``` -------------------------------- ### API Reference: Top Level Vehicle Listing Search Parameters Source: https://github.com/kryptobaseddev/cardev-api/blob/main/getting-started-vehicle-listings.md Documents the key parameters available for initial filtering of vehicle listings. This includes criteria such as year range, make, model, location details, and specific vehicle attributes like trim, transmission, features, and colors. ```APIDOC Search Type | Parameter | Value ------------|-----------|------- Year Range Min | `year_min=2016` | 2016-2022 Make | `make=Acura` | Acura Model | `model=MDX` | MDX Trim | `trim[]=Base` | Base Trim | `trim[]=SH-AWD` | SH-AWD City | `city=Los%20Angeles` | Los Angeles State | `state=CA` | California Location | `location=Los%20Angeles%20CA` | Los Angeles, CA Latitude | `latitude=34.0522342` | 34.0522342 Longitude | `longitude=-118.2436849` | -118.2436849 Radius | `radius=100` | 100 miles Transmission | `transmission[]=automatic` | Automatic Features | `features[]=sunroof` | Sunroof Exterior Color | `exterior_color[]=gray` | Gray Exterior Color | `exterior_color[]=silver` | Silver Interior Color | `interior_color[]=black` | Black ``` -------------------------------- ### Transmission Query Parameters Source: https://github.com/kryptobaseddev/cardev-api/blob/main/getting-started-vehicle-listings.md Defines the valid query parameters and values for filtering vehicle listings by transmission type. This allows users to specify automatic or manual transmissions. ```APIDOC Parameter: transmission[]=automatic, Value: Automatic Parameter: transmission[]=manual, Value: Manual ``` -------------------------------- ### Interior Color Query Parameters Source: https://github.com/kryptobaseddev/cardev-api/blob/main/getting-started-vehicle-listings.md Defines the valid query parameters and values for filtering vehicle listings by interior color. These can be used to narrow down search results based on the vehicle's interior hue. ```APIDOC Parameter: interior_color[]=black, Value: Black Parameter: interior_color[]=white, Value: White Parameter: interior_color[]=gray, Value: Gray Parameter: interior_color[]=brown, Value: Brown Parameter: interior_color[]=red, Value: Red Parameter: interior_color[]=blue, Value: Blue ``` -------------------------------- ### VIN Decode API Parameters Source: https://github.com/kryptobaseddev/cardev-api/blob/main/getting-started-vin-decode.md Details the primary parameter available for the VIN decode API endpoint, which is the Vehicle Identification Number itself. ```APIDOC Parameter | Value ----------|------- `vin` | ZPBUA1ZL9KLA00848 ``` -------------------------------- ### API Parameters for Pickup Truck Rear Wheel Type Filtering Source: https://github.com/kryptobaseddev/cardev-api/blob/main/getting-started-vehicle-listings.md Defines query parameters for filtering pickup truck listings based on rear wheel type. The `rear_wheel[]` parameter supports 'dual' and 'single' values. ```APIDOC Parameter: rear_wheel[] Values: dual: Dual single: Single ``` -------------------------------- ### API Parameters for Pickup Truck Cabin Type Filtering Source: https://github.com/kryptobaseddev/cardev-api/blob/main/getting-started-vehicle-listings.md Defines query parameters for filtering pickup truck listings based on cabin type. The `cabin[]` parameter supports values such as 'crew', 'extended', and 'regular'. ```APIDOC Parameter: cabin[] Values: crew: Crew extended: Extended regular: Regular ``` -------------------------------- ### Filter Vehicle Listings by Features with cURL Source: https://github.com/kryptobaseddev/cardev-api/blob/main/getting-started-vehicle-listings.md This snippet illustrates how to filter vehicle listings by specific features such as backup camera, leather seats, or heated seats. The cURL command demonstrates how to pass multiple feature parameters to the API. ```bash curl "https://auto.dev/api/listings?apikey=&make=Audi&features[]=backup_camera&features[]=leather&features[]=heated_seats&page=1" \ -H "Authorization: Bearer " ``` -------------------------------- ### Drivetrain Query Parameters Source: https://github.com/kryptobaseddev/cardev-api/blob/main/getting-started-vehicle-listings.md Lists the available query parameters and their corresponding values for filtering vehicle listings by drivetrain type. This includes options like Rear Wheel Drive, Front Wheel Drive, Four Wheel Drive, and All Wheel Drive. ```APIDOC Parameter: driveline[]=RWD, Value: Rear Wheel Drive Parameter: driveline[]=FWD, Value: Front Wheel Drive Parameter: driveline[]=4X4, Value: Four Wheel Drive Parameter: driveline[]=AWD, Value: All Wheel Drive ``` -------------------------------- ### API Reference: Vehicle Listing Sort and Filter Options Source: https://github.com/kryptobaseddev/cardev-api/blob/main/getting-started-vehicle-listings.md Lists the available 'sort_filter' options for ordering vehicle listings. This includes sorting by price, distance, year, mileage, and time on market, with 'Best Match' as the default option. ```APIDOC Parameter | Value ----------|------- - | Best Match (default) `sort_filter=price:asc` | Price (Least Expensive First) `sort_filter=price:desc` | Price (Most Expensive First) `sort_filter=distance:asc` | Distance (Nearest First) `sort_filter=year:asc` | Year (Oldest First) `sort_filter=year:desc` | Year (Newest First) `sort_filter=mileage:asc` | Mileage (Lowest First) `sort_filter=created_at:desc` | Time on Market (Shortest First) `sort_filter=created_at:asc` | Time on Market (Longest First) ``` -------------------------------- ### API Parameters for Fuel Type Filtering Source: https://github.com/kryptobaseddev/cardev-api/blob/main/getting-started-vehicle-listings.md Defines query parameters for filtering vehicle listings based on their fuel type. The `fuel_type[]` parameter supports a wide range of fuel types including gasoline, hybrid, electric, and more. ```APIDOC Parameter: fuel_type[] Values: gasoline: Gasoline hybrid: Hybrid electric: Electric flex%20fuel: Flex Fuel natural%20gas: Natural Gas plug-in%20hybrid: Plug-in Hybrid hydrogen%20fuel%20cell: Hydrogen Fuel Cell diesel: Diesel ``` -------------------------------- ### API Parameters for Pickup Truck Bed Type Filtering Source: https://github.com/kryptobaseddev/cardev-api/blob/main/getting-started-vehicle-listings.md Defines query parameters for filtering pickup truck listings based on bed type. The `bed[]` parameter supports values including 'regular', 'short', 'long', 'step-side', and 'chassis'. ```APIDOC Parameter: bed[] Values: regular: Regular short: Short long: Long step-side: Step-Side chassis: Chassis ``` -------------------------------- ### API Parameters for Miles Per Gallon Filtering Source: https://github.com/kryptobaseddev/cardev-api/blob/main/getting-started-vehicle-listings.md Defines query parameters for filtering vehicle listings based on combined Miles Per Gallon (MPG). Users can specify minimum MPG values using the `combined_mpg` parameter. ```APIDOC Parameter: combined_mpg Values: 20: At least 20 MPG 30: At least 30 MPG 40: At least 40 MPG 50: At least 50 MPG ``` -------------------------------- ### Filter Vehicle Listings by Engine and Economy with cURL Source: https://github.com/kryptobaseddev/cardev-api/blob/main/getting-started-vehicle-listings.md This snippet shows how to filter vehicle listings based on engine and economy parameters like transmission, drivetrain, cylinders, and combined MPG. It demonstrates combining multiple such filters in a single cURL request. ```bash curl "https://auto.dev/api/listings?apikey=&make=Toyota&transmission[]=automatic&engine_cylinders[]=4&combined_mpg=20&page=1" \ -H "Authorization: Bearer " ``` -------------------------------- ### Python VINDecoder Usage Example Source: https://github.com/kryptobaseddev/cardev-api/blob/main/vin-decode-solutions.md This example demonstrates how to instantiate the `VINDecoder` class, decode a single VIN synchronously, extract basic information, and decode multiple VINs concurrently using asynchronous methods. It showcases both immediate and bulk processing patterns. ```python # Usage example decoder = VINDecoder(api_key) # Decode single VIN vehicle = decoder.decode('ZPBUA1ZL9KLA00848') basic_info = decoder.extract_basic_info(vehicle) print(f"{basic_info['year']} {basic_info['make']} {basic_info['model']}") # Decode multiple VINs asynchronously vins = ['ZPBUA1ZL9KLA00848', '5UXCR6C04L9C34567', '1G1YY22G965123456'] results = asyncio.run(decoder.decode_multiple_async(vins)) ``` -------------------------------- ### Filter Vehicle Listings by Body Style with cURL Source: https://github.com/kryptobaseddev/cardev-api/blob/main/getting-started-vehicle-listings.md This snippet demonstrates how to filter vehicle listings by one or more body styles using the auto.dev API. It shows how to include multiple body style parameters in a single cURL request to retrieve relevant vehicle data. ```bash curl "https://auto.dev/api/listings?apikey=&body_style[]=convertible&body_style[]=coupe&page=1" \ -H "Authorization: Bearer " ``` -------------------------------- ### Decode VIN API Example Source: https://github.com/kryptobaseddev/cardev-api/blob/main/README.md Example of decoding a Vehicle Identification Number (VIN) using the Auto.dev API. This request retrieves detailed specifications for the provided VIN. ```bash curl "https://auto.dev/api/vin/ZPBUA1ZL9KLA00848" \ -H "Authorization: Bearer " ``` -------------------------------- ### Search Vehicle Listings API Example Source: https://github.com/kryptobaseddev/cardev-api/blob/main/README.md Example of searching for vehicle listings using the Auto.dev API. This request filters vehicles by year, make, model, and a specified radius, retrieving the first page of results. ```bash curl "https://auto.dev/api/listings?year_min=2016&make=Acura&model=MDX&radius=100&page=1" \ -H "Authorization: Bearer " ``` -------------------------------- ### API: Vehicle Listings Request with Query Parameter Source: https://github.com/kryptobaseddev/cardev-api/blob/main/api-authorization.md Example URL for fetching vehicle listings from the Auto.dev API, passing the API key as a query parameter. ```APIDOC https://auto.dev/api/listings?apikey= ``` -------------------------------- ### Search and Retrieve Vehicle Data from Auto.dev API Source: https://github.com/kryptobaseddev/cardev-api/blob/main/vehicle-listings-solutions.md This section provides code examples in JavaScript/Node.js and Python for interacting with the auto.dev API to search for vehicles based on various criteria and retrieve detailed information for a specific vehicle using its VIN. Both implementations require an API key for authentication. ```javascript const axios = require('axios'); const apiKey = process.env.AUTO_DEV_API_KEY; // Search for vehicles async function searchVehicles(params) { try { const response = await axios.get('https://auto.dev/api/listings', { headers: { 'Authorization': `Bearer ${apiKey}` }, params: { make: params.make, model: params.model, year_min: params.yearMin, price_max: params.priceMax, radius: params.radius, page: params.page || 1 } }); return response.data; } catch (error) { console.error('Error searching vehicles:', error); throw error; } } // Get vehicle details async function getVehicleDetails(vin) { try { const response = await axios.get(`https://auto.dev/api/listings/${vin}`, { headers: { 'Authorization': `Bearer ${apiKey}` } }); return response.data; } catch (error) { console.error('Error getting vehicle details:', error); throw error; } } ``` ```python import requests import os api_key = os.environ.get('AUTO_DEV_API_KEY') headers = {'Authorization': f'Bearer {api_key}'} def search_vehicles(**params): """ Search for vehicles with specified parameters """ url = 'https://auto.dev/api/listings' response = requests.get(url, headers=headers, params=params) response.raise_for_status() return response.json() def get_vehicle_details(vin): """ Get detailed information about a specific vehicle """ url = f'https://auto.dev/api/listings/{vin}' response = requests.get(url, headers=headers) response.raise_for_status() return response.json() # Example usage results = search_vehicles( make='Tesla', model='Model 3', year_min=2020, radius=50, sort_filter='price:asc' ) ``` -------------------------------- ### API: VIN Decode Request with Query Parameter Source: https://github.com/kryptobaseddev/cardev-api/blob/main/api-authorization.md Example URL for decoding a VIN using the Auto.dev API, passing the API key as a query parameter. ```APIDOC https://auto.dev/api/vin/ZPBUA1ZL9KLA00848?apikey= ``` -------------------------------- ### Bash: Vehicle Listings Request with Authorization Header Source: https://github.com/kryptobaseddev/cardev-api/blob/main/api-authorization.md Example `curl` command to fetch vehicle listings from the Auto.dev API, authenticating with an API key in the Authorization header. ```bash curl https://auto.dev/api/listings \ -H "Authorization: Bearer " ``` -------------------------------- ### VIN Decoder Class in JavaScript/Node.js Source: https://github.com/kryptobaseddev/cardev-api/blob/main/vin-decode-solutions.md This JavaScript/Node.js example provides a `VINDecoder` class that encapsulates API interactions. It includes methods for decoding single and multiple VINs, handling API errors, and basic VIN validation. It uses `axios` for HTTP requests. ```javascript const axios = require('axios'); const apiKey = process.env.AUTO_DEV_API_KEY; class VINDecoder { constructor(apiKey) { this.apiKey = apiKey; this.baseURL = 'https://auto.dev/api/vin'; } async decode(vin) { try { const response = await axios.get(`${this.baseURL}/${vin}`, { headers: { 'Authorization': `Bearer ${this.apiKey}` } }); return response.data; } catch (error) { if (error.response?.status === 404) { throw new Error('Invalid VIN or VIN not found'); } throw error; } } async decodeMultiple(vins) { const results = await Promise.all( vins.map(vin => this.decode(vin).catch(err => ({ vin, error: err.message }))) ); return results; } validateVIN(vin) { // Basic VIN validation const vinRegex = /^[A-HJ-NPR-Z0-9]{17}$/; return vinRegex.test(vin); } } // Usage const decoder = new VINDecoder(apiKey); // Single VIN const vehicleData = await decoder.decode('ZPBUA1ZL9KLA00848'); console.log(`${vehicleData.year} ${vehicleData.make} ${vehicleData.model}`); // Multiple VINs const vins = ['ZPBUA1ZL9KLA00848', '5UXCR6C04L9C34567']; const results = await decoder.decodeMultiple(vins); ``` -------------------------------- ### Bash: VIN Decode Request with Authorization Header Source: https://github.com/kryptobaseddev/cardev-api/blob/main/api-authorization.md Example `curl` command to decode a VIN using the Auto.dev API, authenticating with an API key in the Authorization header. ```bash curl https://auto.dev/api/vin/ZPBUA1ZL9KLA00848 \ -H "Authorization: Bearer " ``` -------------------------------- ### Python: Authenticate API Request with Bearer Token Source: https://github.com/kryptobaseddev/cardev-api/blob/main/api-authorization.md Demonstrates how to make an authenticated GET request to the Auto.dev API using `requests` in Python, retrieving the API key from environment variables and including it as a Bearer token in the Authorization header. ```python import requests import os api_key = os.environ.get('AUTO_DEV_API_KEY') # Using Bearer Token headers = { 'Authorization': f'Bearer {api_key}' } response = requests.get('https://auto.dev/api/vin/ZPBUA1ZL9KLA00848', headers=headers) ``` -------------------------------- ### JavaScript: Implement Caching for API Responses Source: https://github.com/kryptobaseddev/cardev-api/blob/main/vehicle-listings-solutions.md This JavaScript example demonstrates how to implement client-side caching for API responses using `node-cache`. It checks if vehicle details are already in the cache before making an API call, reducing redundant requests and improving performance for frequently accessed data. Cached data expires after 10 minutes. ```javascript const NodeCache = require('node-cache'); const cache = new NodeCache({ stdTTL: 600 }); // 10 minute cache async function getCachedVehicleDetails(vin) { const cached = cache.get(vin); if (cached) return cached; const details = await getVehicleDetails(vin); cache.set(vin, details); return details; } ``` -------------------------------- ### Common API Error Response Formats (APIDOC) Source: https://github.com/kryptobaseddev/cardev-api/blob/main/vin-decode-solutions.md This section outlines the standard JSON format for error responses returned by the API. It provides examples for common error scenarios such as invalid VIN format, VIN not found, and rate limit exceedance, including an 'error' message, a 'code', and 'details'. ```json { "error": "Invalid VIN format", "code": "INVALID_VIN", "details": "VIN must be exactly 17 characters" } { "error": "VIN not found", "code": "VIN_NOT_FOUND", "details": "No vehicle data available for this VIN" } { "error": "Rate limit exceeded", "code": "RATE_LIMIT", "details": "Maximum requests per minute exceeded" } ``` -------------------------------- ### Node.js: Authenticate API Request with Bearer Token Source: https://github.com/kryptobaseddev/cardev-api/blob/main/api-authorization.md Demonstrates how to make an authenticated GET request to the Auto.dev API using `axios` in Node.js, retrieving the API key from environment variables and including it as a Bearer token in the Authorization header. ```javascript const axios = require('axios'); const apiKey = process.env.AUTO_DEV_API_KEY; // Using Bearer Token const response = await axios.get('https://auto.dev/api/vin/ZPBUA1ZL9KLA00848', { headers: { 'Authorization': `Bearer ${apiKey}` } }); ``` -------------------------------- ### Search Auto.dev API for Budget-Conscious Used Vehicles Source: https://github.com/kryptobaseddev/cardev-api/blob/main/vehicle-listings-solutions.md This `curl` command shows how to find affordable used vehicles on the Auto.dev API. It filters by maximum price, minimum year, condition (used), maximum mileage, and specific features like backup camera and Bluetooth. Results are sorted by price in ascending order. ```bash curl "https://auto.dev/api/listings?price_max=25000&year_min=2018&condition[]=used&mileage=50000&features[]=backup_camera&features[]=bluetooth&sort_filter=price:asc&page=1" \ -H "Authorization: Bearer " ``` -------------------------------- ### Auto.dev API Reference Source: https://github.com/kryptobaseddev/cardev-api/blob/main/README.md Detailed reference for the Auto.dev API, outlining the capabilities of the Vehicle Listings API and VIN Decode API, including their respective search, filter, and decoding functionalities. ```APIDOC Auto.dev API: Endpoints: /api/listings: Description: Vehicle Listings API Methods: GET: Description: Search and filter vehicle inventory. Parameters: year_min: integer (optional) - Minimum manufacturing year. make: string (optional) - Vehicle manufacturer. model: string (optional) - Vehicle model. radius: integer (optional) - Search radius in miles. page: integer (optional) - Page number for results. Features: - Search by year, make, model, trim, and location. - Filter by price range, mileage, condition, and features. - Sort by price, distance, year, and time on market. - Access detailed vehicle information and images. - Real-time inventory. /api/vin/{vin}: Description: VIN Decode API Methods: GET: Description: Decode a 17-character VIN to get detailed vehicle specifications. Parameters: vin: string (required) - The 17-character Vehicle Identification Number. Features: - Get year, make, model, trim information. - Access detailed specifications and options. - Retrieve MSRP and pricing data. - Get engine and transmission details. Authentication: Type: API Key Methods: - Bearer Token (Recommended): In Authorization header (e.g., "Authorization: Bearer ") - Query Parameter: As 'apikey' query parameter (e.g., "?apikey=") ``` -------------------------------- ### Basic VIN Decode with cURL Source: https://github.com/kryptobaseddev/cardev-api/blob/main/vin-decode-solutions.md This snippet demonstrates how to perform a basic VIN decode API call using `curl`. It shows the required endpoint and how to include the authorization header with your API key. ```bash curl "https://auto.dev/api/vin/ZPBUA1ZL9KLA00848" \ -H "Authorization: Bearer " ``` -------------------------------- ### JavaScript: Implement Pagination for Auto.dev API Source: https://github.com/kryptobaseddev/cardev-api/blob/main/vehicle-listings-solutions.md This JavaScript function demonstrates how to implement pagination to retrieve all listings from the auto.dev API. It iteratively calls the `searchVehicles` function, concatenating results until all records are fetched or no more records are available. This ensures complete data retrieval for large datasets. ```javascript async function getAllListings(searchParams) { let allListings = []; let page = 1; let hasMore = true; while (hasMore) { const response = await searchVehicles({...searchParams, page}); allListings = allListings.concat(response.records); hasMore = response.records.length > 0 && allListings.length < response.totalCount; page++; } return allListings; } ``` -------------------------------- ### Implement Real-time Inventory Monitoring with JavaScript Polling Source: https://github.com/kryptobaseddev/cardev-api/blob/main/vehicle-listings-solutions.md This JavaScript class, `InventoryMonitor`, demonstrates a polling mechanism to check for new vehicle listings in real-time. It periodically queries the `searchVehicles` API, filters for listings created since the last check, and provides a callback for handling new data. The polling interval is configurable. ```javascript class InventoryMonitor { constructor(searchParams, interval = 300000) { // 5 minutes this.searchParams = searchParams; this.interval = interval; this.lastCheck = new Date(); } async checkForNewListings() { const vehicles = await searchVehicles({ ...this.searchParams, sort_filter: 'created_at:desc' }); const newListings = vehicles.records.filter(v => new Date(v.createdAt) > this.lastCheck ); if (newListings.length > 0) { this.onNewListings(newListings); } this.lastCheck = new Date(); } start() { setInterval(() => this.checkForNewListings(), this.interval); } onNewListings(listings) { // Override this method to handle new listings console.log(`Found ${listings.length} new listings`); } } ``` -------------------------------- ### Search Auto.dev API for Luxury Certified Pre-Owned Vehicles Source: https://github.com/kryptobaseddev/cardev-api/blob/main/vehicle-listings-solutions.md This `curl` command illustrates how to find premium vehicles on the Auto.dev API. It filters by minimum price, specific luxury features (leather, navigation, premium audio, heated seats), and condition (certified pre-owned). ```bash curl "https://auto.dev/api/listings?price_min=50000&features[]=leather&features[]=navigation&features[]=premium_audio_system&features[]=heated_seats&condition[]=certified%20pre-owned&page=1" \ -H "Authorization: Bearer " ``` -------------------------------- ### Bash: Build Complex Multi-Parameter Vehicle Queries Source: https://github.com/kryptobaseddev/cardev-api/blob/main/vehicle-listings-solutions.md This `curl` command illustrates how to construct complex queries for the auto.dev API using multiple filtering parameters. It combines criteria such as make, year, price, condition, features, and exterior color to refine search results. The results are sorted by price in ascending order. ```bash curl "https://auto.dev/api/listings?\nmake=BMW&\nyear_min=2019&\nprice_max=50000&\ncondition[]=certified%20pre-owned&\nfeatures[]=navigation&\nfeatures[]=leather&\nexterior_color[]=black&\nexterior_color[]=white&\nsort_filter=price:asc&\npage=1" \ -H "Authorization: Bearer " ``` -------------------------------- ### Authenticate API Requests with Query Parameter Source: https://github.com/kryptobaseddev/cardev-api/blob/main/README.md Shows an alternative method for API authentication by including the API key as a query parameter. This method is generally less secure than using a Bearer Token. ```bash curl https://auto.dev/api/vin/ZPBUA1ZL9KLA00848?apikey= ``` -------------------------------- ### Authenticate API Requests with Bearer Token Source: https://github.com/kryptobaseddev/cardev-api/blob/main/README.md Demonstrates how to authenticate API requests using a Bearer Token in the Authorization header, which is the recommended method for secure access to the Auto.dev API. ```bash curl https://auto.dev/api/vin/ZPBUA1ZL9KLA00848 \ -H "Authorization: Bearer " ``` -------------------------------- ### Retrieve Individual Vehicle Details by VIN from Auto.dev API Source: https://github.com/kryptobaseddev/cardev-api/blob/main/vehicle-listings-solutions.md This `curl` command demonstrates how to retrieve comprehensive information for a specific vehicle from the Auto.dev API using its VIN. This endpoint provides detailed attributes beyond what's available in search results. ```bash curl "https://auto.dev/api/listings/SALGS2RE6KA539103" \ -H "Authorization: Bearer " ``` -------------------------------- ### Implement Caching for VIN Decoding in JavaScript Source: https://github.com/kryptobaseddev/cardev-api/blob/main/vin-decode-solutions.md This JavaScript class demonstrates how to implement a caching strategy using the 'node-cache' library to reduce redundant API calls for VIN decoding. It stores decoded VIN data for a specified time-to-live (TTL), defaulting to 24 hours, and provides methods to retrieve cached data or clear the cache. ```javascript const NodeCache = require('node-cache'); class CachedVINDecoder { constructor(apiKey, ttl = 86400) { // 24 hour cache this.decoder = new VINDecoder(apiKey); this.cache = new NodeCache({ stdTTL: ttl }); } async decode(vin) { const cached = this.cache.get(vin); if (cached) return cached; const data = await this.decoder.decode(vin); this.cache.set(vin, data); return data; } clearCache() { this.cache.flushAll(); } } ``` -------------------------------- ### Search Auto.dev API for Electric Vehicles by Radius Source: https://github.com/kryptobaseddev/cardev-api/blob/main/vehicle-listings-solutions.md This `curl` command demonstrates how to search for electric vehicles within a specified radius using the Auto.dev API. It filters by category and fuel type, and sorts results by distance from the origin. ```bash curl "https://auto.dev/api/listings?category=electric&fuel_type[]=electric&radius=50&sort_filter=distance:asc&page=1" \ -H "Authorization: Bearer " ``` -------------------------------- ### Python VINDecoder Class for API Interaction Source: https://github.com/kryptobaseddev/cardev-api/blob/main/vin-decode-solutions.md This Python class provides methods to interact with a VIN decoding API. It includes functionalities for VIN validation, synchronous and asynchronous single VIN decoding, concurrent decoding of multiple VINs, and extraction of basic vehicle information from decoded data. It requires `requests`, `re`, `typing`, `asyncio`, and `aiohttp`. ```python import requests import re from typing import Dict, List, Optional import asyncio import aiohttp class VINDecoder: def __init__(self, api_key: str): self.api_key = api_key self.base_url = 'https://auto.dev/api/vin' self.headers = {'Authorization': f'Bearer {api_key}'} def validate_vin(self, vin: str) -> bool: """Validate VIN format""" vin_pattern = re.compile(r'^[A-HJ-NPR-Z0-9]{17}$') return bool(vin_pattern.match(vin)) def decode(self, vin: str) -> Dict: """Decode a single VIN""" if not self.validate_vin(vin): raise ValueError(f"Invalid VIN format: {vin}") response = requests.get( f"{self.base_url}/{vin}", headers=self.headers ) response.raise_for_status() return response.json() async def decode_async(self, vin: str, session: aiohttp.ClientSession) -> Dict: """Decode a VIN asynchronously""" async with session.get( f"{self.base_url}/{vin}", headers=self.headers ) as response: return await response.json() async def decode_multiple_async(self, vins: List[str]) -> List[Dict]: """Decode multiple VINs concurrently""" async with aiohttp.ClientSession() as session: tasks = [self.decode_async(vin, session) for vin in vins] return await asyncio.gather(*tasks, return_exceptions=True) def extract_basic_info(self, decoded_data: Dict) -> Dict: """Extract basic vehicle information""" return { 'vin': decoded_data.get('vin'), 'year': decoded_data.get('year'), 'make': decoded_data.get('make'), 'model': decoded_data.get('model'), 'trim': decoded_data.get('trim'), 'msrp': decoded_data.get('msrp'), 'engine': decoded_data.get('engine', {}).get('name'), 'transmission': decoded_data.get('transmission', {}).get('name'), 'drivetrain': decoded_data.get('drivetrain', {}).get('type') } ``` -------------------------------- ### JavaScript: Implement API Rate Limiting with Express Source: https://github.com/kryptobaseddev/cardev-api/blob/main/vehicle-listings-solutions.md This JavaScript snippet shows how to implement server-side API rate limiting using the `express-rate-limit` middleware. It configures a limit of 100 requests per minute per IP address, helping to protect the API from abuse and ensure fair usage among clients. ```javascript const rateLimit = require('express-rate-limit'); const apiLimiter = rateLimit({ windowMs: 60 * 1000, // 1 minute max: 100 // limit each IP to 100 requests per minute }); ``` -------------------------------- ### Search Auto.dev API for Specific Vehicle Listings Source: https://github.com/kryptobaseddev/cardev-api/blob/main/vehicle-listings-solutions.md This `curl` command demonstrates how to search the Auto.dev API for specific vehicle listings. It filters by year, make, model, trim, location (city, state, latitude, longitude, radius), transmission type, features, and exterior/interior colors. Pagination is also included. ```bash curl "https://auto.dev/api/listings?year_min=2016&make=Acura&model=MDX&trim[]=Base&trim[]=SH-AWD&city=Los%20Angeles&state=CA&latitude=34.0522342&longitude=-118.2436849&radius=100&transmission[]=automatic&features[]=sunroof&exterior_color[]=gray&exterior_color[]=silver&interior_color[]=black&page=1" \ -H "Authorization: Bearer " ``` -------------------------------- ### Auto.dev API Search Listings Response Format Source: https://github.com/kryptobaseddev/cardev-api/blob/main/vehicle-listings-solutions.md This JSON object illustrates the typical response structure for vehicle listing search queries from the Auto.dev API. It includes metadata like total counts and an array of `records`, each representing a vehicle with detailed attributes such as VIN, make, model, price, mileage, and dealer information. ```json { "totalCount": 13, "totalCountFormatted": "13", "hitsCount": 13, "records": [ { "vin": "5J8YD3H30JL006762", "displayColor": "Gray", "year": 2018, "make": "Acura", "model": "MDX", "price": "$29,519", "mileage": "35,607 Miles", "city": "Signal Hill", "state": "CA", "lat": 33.8113, "lon": -118.168, "primaryPhotoUrl": "https://auto.dev/images/...", "condition": "used", "dealerName": "EchoPark Automotive Los Angeles", "trim": "Base", "bodyType": "suv", "transmission": "automatic", "eligibleForFinancing": true, "photoUrls": [ "https://auto.dev/images/..." ], "distanceFromOrigin": 17, "humanizedSearchLocation": "Los Angeles, CA" } ] } ``` -------------------------------- ### Auto.dev API Individual Vehicle Details Response Format Source: https://github.com/kryptobaseddev/cardev-api/blob/main/vehicle-listings-solutions.md This JSON object outlines the detailed response structure when retrieving information for a single vehicle by VIN from the Auto.dev API. It includes extensive vehicle attributes such as make, model, trim, price, mileage, condition, body type, colors, driveline, engine, transmission, MPG, features, and comprehensive dealer information. ```json { "vin": "SALGS2RE6KA539103", "year": 2019, "make": "Land Rover", "model": "Range Rover", "trim": "5.0L V8 Supercharged", "price": "$103,995", "mileage": "22,492", "condition": "used", "bodyType": "suv", "colorExterior": "White", "colorInterior": "Black", "driveline": "AWD", "engineType": "5.0L V8 Supercharged", "transmission": "Automatic", "cityMpg": null, "hwyMpg": null, "features": [ "Adaptive Cruise Control", "Blind Spot Assist", "Head-Up Display", "Heated Seats", "Lane Keep Assist", "Navigation System", "Premium Audio System", "Surround Camera System", "... and many more" ], "dealerInfo": { "dealerName": "LA City Cars", "address": "817 N La Brea Ave", "city": "Inglewood", "state": "CA", "zip": "90302", "phone": "(323) 675-2956", "lat": 33.9738, "lon": -118.358 }, "photoUrls": [ "https://auto.dev/images/..." ], "eligibleForFinancing": true, "acceptsLeads": true } ``` -------------------------------- ### API Authorization Header Format Source: https://github.com/kryptobaseddev/cardev-api/blob/main/api-authorization.md Shows the standard Bearer token format for including the API key in the Authorization header. ```APIDOC Authorization: Bearer ``` -------------------------------- ### Handle API Errors with Retry Logic in JavaScript Source: https://github.com/kryptobaseddev/cardev-api/blob/main/vin-decode-solutions.md This asynchronous JavaScript function demonstrates robust error handling for API calls, specifically for VIN decoding. It catches common HTTP errors (400 for invalid format, 404 for not found, 429 for rate limit) and implements specific responses, including a retry mechanism for rate limits after a delay. ```javascript async function safeVINDecode(vin) { try { return await decoder.decode(vin); } catch (error) { if (error.response) { switch (error.response.status) { case 400: console.error(`Invalid VIN format: ${vin}`); return { error: 'Invalid VIN format', vin }; case 404: console.error(`VIN not found: ${vin}`); return { error: 'VIN not found', vin }; case 429: console.error('Rate limit exceeded, retrying...'); await new Promise(resolve => setTimeout(resolve, 60000)); return safeVINDecode(vin); default: console.error(`Unexpected error: ${error.response.status}`); return { error: 'Unexpected error', vin }; } } throw error; } } ```