CarGurus Parser Quick Start
Get started with the CarGurus parser in 5 minutes. Extract automotive data from US, Canada, and UK markets with our step-by-step guide.
What You'll Learn
- Complete setup in 5 minutes
- Multi-market configuration for US, Canada, UK
- First API call with working code examples
- Error handling and troubleshooting
- Best practices for production use
🚀 Prerequisites
Before you begin, ensure you have:
:::
info Requirements
- Carapis Account - Sign up at dashboard.carapis.com
- API Key - Get your CarGurus parser API key
- Programming Knowledge - Basic understanding of HTTP requests
- Target Markets - Decide which markets you need (US, Canada, UK) :::
📋 Step 1: Get Your API Key
1.1 Sign Up for Carapis
- Visit dashboard.carapis.com
- Click "Sign Up" and create your account
- Verify your email address
1.2 Activate CarGurus Parser
- Log in to your Carapis dashboard
- Navigate to "Parsers" section
- Find "CarGurus" and click "Activate"
- Choose your plan based on your needs
1.3 Get Your API Key
- Go to "API Keys" in your dashboard
- Copy your CarGurus parser API key
- Your key will look like:
cargurus_parser_sk_1234567890abcdef1234567890abcdef
API Key Security
- Keep your API key secure - Never share it publicly
- Use environment variables - Store keys securely in your application
- Rotate keys regularly - Update keys for security
- Monitor usage - Track API usage in your dashboard
🔧 Step 2: Choose Your Target Market
The CarGurus parser supports three major markets:
Market Options
Market | Code | Coverage | Currency | Key Features |
---|---|---|---|---|
United States | us | 2M+ vehicles | USD | Deal Rating, EPA ratings |
Canada | ca | 500K+ vehicles | CAD | Provincial data, bilingual |
United Kingdom | uk | 500K+ vehicles | GBP | MOT data, UK standards |
💻 Step 3: Make Your First API Call
JavaScript Example
const axios = require('axios');
// Configuration
const API_KEY = 'YOUR_API_KEY';
const BASE_URL = 'https://api.carapis.com/v1/parsers/cargurus';
// Search for vehicles in US market
async function searchVehicles() {
try {
const response = await axios.post(
`${BASE_URL}/search`,
{
query: 'Ford F-150 2020',
max_price: 45000,
location: 'New York',
market: 'us',
transmission: 'automatic',
fuel_type: 'gasoline',
limit: 10,
},
{
headers: {
Authorization: `Bearer ${API_KEY}`,
'Content-Type': 'application/json',
},
},
);
console.log('Success! Found vehicles:', response.data.data.listings.length);
console.log('First vehicle:', response.data.data.listings[0]);
return response.data;
} catch (error) {
console.error('Error:', error.response?.data || error.message);
throw error;
}
}
// Run the search
searchVehicles();
Python Example
import requests
import json
# Configuration
API_KEY = 'YOUR_API_KEY'
BASE_URL = 'https://api.carapis.com/v1/parsers/cargurus'
def search_vehicles():
"""Search for vehicles in US market"""
url = f"{BASE_URL}/search"
headers = {
'Authorization': f'Bearer {API_KEY}',
'Content-Type': 'application/json'
}
data = {
'query': 'Ford F-150 2020',
'max_price': 45000,
'location': 'New York',
'market': 'us',
'transmission': 'automatic',
'fuel_type': 'gasoline',
'limit': 10
}
try:
response = requests.post(url, json=data, headers=headers)
response.raise_for_status()
result = response.json()
vehicles = result['data']['listings']
print(f"Success! Found {len(vehicles)} vehicles")
print(f"First vehicle: {vehicles[0]}")
return result
except requests.exceptions.RequestException as e:
print(f"Error: {e}")
if hasattr(e, 'response'):
print(f"Response: {e.response.text}")
raise
# Run the search
if __name__ == "__main__":
search_vehicles()
cURL Example
# Search for vehicles in US market
curl -X POST "https://api.carapis.com/v1/parsers/cargurus/search" \
-H "Authorization: Bearer YOUR_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"query": "Ford F-150 2020",
"max_price": 45000,
"location": "New York",
"market": "us",
"transmission": "automatic",
"fuel_type": "gasoline",
"limit": 10
}'
🌍 Step 4: Multi-Market Examples
Canada Market Example
// Search for vehicles in Canada
const canadaSearch = {
query: 'Toyota Camry 2021',
max_price: 35000,
location: 'Toronto',
market: 'ca',
transmission: 'automatic',
fuel_type: 'gasoline',
limit: 10,
};
const canadaResponse = await axios.post(`${BASE_URL}/search`, canadaSearch, { headers: { Authorization: `Bearer ${API_KEY}`, 'Content-Type': 'application/json' } });
UK Market Example
# Search for vehicles in UK
uk_search = {
'query': 'BMW 3 Series 2020',
'max_price': 30000,
'location': 'London',
'market': 'uk',
'transmission': 'automatic',
'fuel_type': 'gasoline',
'limit': 10
}
uk_response = requests.post(
f"{BASE_URL}/search",
json=uk_search,
headers={'Authorization': f'Bearer {API_KEY}', 'Content-Type': 'application/json'}
)
📊 Step 5: Understanding the Response
Sample Response Structure
{
"success": true,
"data": {
"listings": [
{
"id": "123456789",
"title": "Ford F-150 XLT",
"price": {
"amount": 42000,
"currency": "USD",
"formatted": "$42,000"
},
"deal_rating": {
"score": 9.2,
"label": "Great Deal",
"explanation": "Priced $2,500 below market average"
},
"specifications": {
"year": 2020,
"mileage": 35000,
"fuel_type": "Gasoline",
"transmission": "Automatic",
"engine_size": "3.5L V6",
"power": "400 hp",
"drivetrain": "4WD"
},
"location": {
"city": "New York",
"state": "NY",
"country": "United States",
"coordinates": {
"lat": 40.7128,
"lng": -74.006
}
},
"seller": {
"name": "NYC Ford Dealership",
"type": "dealer",
"rating": 4.7,
"certified": true
},
"features": ["Navigation", "Leather Seats", "Towing Package"],
"images": ["url1", "url2"],
"url": "https://www.cargurus.com/...",
"extracted_at": "2024-01-15T10:30:00Z"
}
],
"total_count": 1200,
"search_metadata": {
"query": "Ford F-150 2020",
"market": "us",
"filters_applied": {
"max_price": 45000,
"location": "New York"
}
}
}
}
Key Response Fields
Response Structure
Field | Description | Business Value |
---|---|---|
listings | Array of vehicle data | Core vehicle information |
total_count | Total available vehicles | Market size assessment |
search_metadata | Search parameters used | Query tracking |
deal_rating | CarGurus deal evaluation | Pricing insights |
specifications | Technical vehicle details | Product analysis |
seller | Dealer information | Business intelligence |
🔍 Step 6: Advanced Search Parameters
Complete Search Options
const advancedSearch = {
// Basic search
query: 'Ford F-150',
// Price filters
min_price: 25000,
max_price: 50000,
// Year range
year_from: 2020,
year_to: 2024,
// Mileage filters
mileage_min: 10000,
mileage_max: 50000,
// Location and market
location: 'New York',
market: 'us',
// Vehicle specifications
fuel_type: 'gasoline',
transmission: 'automatic',
drivetrain: '4wd',
body_style: 'truck',
// Dealer filters
dealer_type: 'franchise',
// Pagination
limit: 50,
offset: 0,
// Sorting
sort_by: 'price',
sort_order: 'asc',
};
Market-Specific Parameters
Market Parameters
Market | Special Parameters | Description |
---|---|---|
US | epa_rating , us_standards | EPA fuel economy ratings |
Canada | province , bilingual | Provincial data, French support |
UK | mot_status , uk_standards | MOT certification, UK regulations |
⚠️ Step 7: Error Handling
Common Error Responses
// Rate limit error
if (error.response?.status === 429) {
const resetTime = error.response.headers['x-ratelimit-reset'];
console.log(`Rate limit exceeded. Reset at: ${resetTime}`);
// Implement retry logic with exponential backoff
}
// Authentication error
if (error.response?.status === 401) {
console.log('Invalid API key. Please check your credentials.');
// Verify API key in dashboard
}
// Invalid parameters
if (error.response?.status === 400) {
console.log('Invalid request parameters:', error.response.data.error);
// Check parameter values and formats
}
Python Error Handling
import time
from requests.exceptions import RequestException
def handle_api_request(url, data, headers, max_retries=3):
"""Handle API requests with retry logic"""
for attempt in range(max_retries):
try:
response = requests.post(url, json=data, headers=headers)
response.raise_for_status()
return response.json()
except requests.exceptions.HTTPError as e:
if e.response.status_code == 429:
reset_time = e.response.headers.get('x-ratelimit-reset')
wait_time = int(reset_time) - int(time.time())
if wait_time > 0:
print(f"Rate limit exceeded. Waiting {wait_time} seconds...")
time.sleep(wait_time)
continue
elif e.response.status_code == 401:
print("Authentication error - check your API key")
break
else:
print(f"HTTP Error: {e.response.status_code}")
break
except RequestException as e:
print(f"Request Error: {e}")
if attempt < max_retries - 1:
time.sleep(2 ** attempt) # Exponential backoff
continue
break
return None
🚀 Step 8: Production Best Practices
Rate Limiting Implementation
class CarGurusAPI {
constructor(apiKey) {
this.apiKey = apiKey;
this.baseURL = 'https://api.carapis.com/v1/parsers/cargurus';
this.requestQueue = [];
this.rateLimit = 100; // requests per minute
this.requestCount = 0;
this.lastReset = Date.now();
}
async makeRequest(endpoint, data) {
// Check rate limit
const now = Date.now();
if (now - this.lastReset >= 60000) {
this.requestCount = 0;
this.lastReset = now;
}
if (this.requestCount >= this.rateLimit) {
const waitTime = 60000 - (now - this.lastReset);
await new Promise((resolve) => setTimeout(resolve, waitTime));
}
this.requestCount++;
// Make the request
const response = await axios.post(`${this.baseURL}${endpoint}`, data, {
headers: {
Authorization: `Bearer ${this.apiKey}`,
'Content-Type': 'application/json',
},
});
return response.data;
}
}
Environment Configuration
// config.js
module.exports = {
carapis: {
apiKey: process.env.CARAPIS_API_KEY,
baseURL: 'https://api.carapis.com/v1/parsers/cargurus',
rateLimit: process.env.CARAPIS_RATE_LIMIT || 100,
timeout: process.env.CARAPIS_TIMEOUT || 30000,
retries: process.env.CARAPIS_RETRIES || 3,
},
};
📈 Step 9: Next Steps
Ready for Production?
- API Reference - Complete endpoint documentation
- Market Analysis - Multi-market insights
- Features - Advanced capabilities
- FAQ - Common questions and troubleshooting
Congratulations!
You've successfully set up the CarGurus parser and made your first API call. You can now:
- Extract vehicle data from US, Canada, and UK markets
- Analyze deal ratings for pricing insights
- Monitor market trends across multiple regions
- Build automotive applications with real-time data
Pro Tips
For Optimal Performance
- Implement proper rate limiting to avoid hitting limits
- Use market-specific filters for accurate results
- Cache frequently requested data to reduce API calls
- Monitor your usage in the Carapis dashboard
- Set up error handling for production reliability
Common Use Cases
- Dealership competitive analysis across multiple markets
- Import/export vehicle sourcing from different regions
- Market research with comprehensive automotive data
- Investment analysis in the automotive sector
- Regulatory compliance monitoring across markets
Ready to extract multi-market automotive data? Start building your application with the CarGurus parser today.