AutoTrader Parser Quick Start
Get started with AutoTrader parser in 5 minutes and extract comprehensive UK automotive data from the UK's largest marketplace.
- Get your API key and set up authentication
- Make your first API call to search UK vehicles
- Handle responses and extract vehicle data
- Implement error handling for production use
- Scale your integration for business applications
🚀 Prerequisites
Before you begin, ensure you have:
Requirement | Description | How to Get |
---|---|---|
API Key | AutoTrader parser access | Sign up at Carapis Dashboard |
Programming Language | JavaScript, Python, or any HTTP client | Your preferred language |
Basic HTTP Knowledge | Understanding of REST APIs | Not required but helpful |
UK Market Focus | Understanding of UK automotive market | Optional for business context |
📋 Step 1: Get Your API Key
Sign Up for Carapis
- Visit Carapis Dashboard
- Create a new account or sign in
- Navigate to the API Keys section
- Generate a new API key for AutoTrader parser
Your API key will look like this: autotrader_parser_sk_1234567890abcdef1234567890abcdef
- Prefix:
autotrader_parser_sk_
- Length: 64 characters
- Format: Hexadecimal string
- Scope: AutoTrader parser access only
Verify Your API Key
curl -X GET "https://api.carapis.com/v1/parsers/autotrader/status" \
-H "Authorization: Bearer YOUR_API_KEY"
Expected response:
{
"success": true,
"data": {
"status": "active",
"parser": "autotrader",
"plan": "free"
}
}
🔧 Step 2: Your First API Call
Basic Vehicle Search
Start with a simple search to find vehicles in the UK market:
const axios = require('axios');
const API_KEY = 'autotrader_parser_sk_1234567890abcdef1234567890abcdef';
const BASE_URL = 'https://api.carapis.com/v1/parsers/autotrader';
async function searchVehicles() {
try {
const response = await axios.post(
`${BASE_URL}/search`,
{
query: 'BMW 3 Series 2020',
max_price: 35000,
fuel_type: 'diesel',
location: 'London',
},
{
headers: {
Authorization: `Bearer ${API_KEY}`,
'Content-Type': 'application/json',
},
},
);
console.log(`Found ${response.data.data.listings.length} vehicles`);
return response.data;
} catch (error) {
console.error('Error:', error.response?.data || error.message);
throw error;
}
}
// Usage
searchVehicles().then((data) => {
console.log('First vehicle:', data.data.listings[0]);
});
import requests
API_KEY = 'autotrader_parser_sk_1234567890abcdef1234567890abcdef'
BASE_URL = 'https://api.carapis.com/v1/parsers/autotrader'
def search_vehicles():
headers = {
'Authorization': f'Bearer {API_KEY}',
'Content-Type': 'application/json'
}
data = {
'query': 'BMW 3 Series 2020',
'max_price': 35000,
'fuel_type': 'diesel',
'location': 'London'
}
try:
response = requests.post(f'{BASE_URL}/search', json=data, headers=headers)
response.raise_for_status()
result = response.json()
print(f"Found {len(result['data']['listings'])} vehicles")
return result
except requests.exceptions.RequestException as e:
print(f'Error: {e}')
return None
# Usage
result = search_vehicles()
if result:
print('First vehicle:', result['data']['listings'][0])
curl -X POST "https://api.carapis.com/v1/parsers/autotrader/search" \
-H "Authorization: Bearer autotrader_parser_sk_1234567890abcdef1234567890abcdef" \
-H "Content-Type: application/json" \
-d '{
"query": "BMW 3 Series 2020",
"max_price": 35000,
"fuel_type": "diesel",
"location": "London"
}'
📊 Step 3: Understanding the Response
Response Structure
Your API call returns comprehensive vehicle data:
{
"success": true,
"data": {
"listings": [
{
"id": "123456789",
"title": "BMW 320d M Sport",
"price": {
"amount": 32000,
"currency": "GBP",
"formatted": "£32,000"
},
"specifications": {
"year": 2020,
"mileage": 45000,
"fuel_type": "Diesel",
"transmission": "Automatic",
"engine_size": "2.0L",
"power": "190 hp"
},
"location": {
"city": "London",
"region": "Greater London",
"country": "United Kingdom"
},
"seller": {
"name": "BMW Approved Used",
"type": "dealer",
"rating": 4.9
},
"features": ["Navigation", "Leather Seats", "M Sport Package"],
"url": "https://www.autotrader.co.uk/...",
"extracted_at": "2024-01-15T10:30:00Z"
}
],
"total_count": 650,
"search_metadata": {
"query": "BMW 3 Series 2020",
"filters_applied": {
"max_price": 35000,
"fuel_type": "diesel"
}
}
}
}
Key Data Fields
Field | Description | Example | Use Case |
---|---|---|---|
id | Unique vehicle identifier | "123456789" | Database storage |
title | Vehicle title/name | "BMW 320d M Sport" | Display purposes |
price.amount | Numeric price value | 32000 | Price calculations |
price.formatted | Formatted price string | "£32,000" | User display |
specifications | Technical details | Engine, transmission, etc. | Vehicle analysis |
location | Geographic information | City, region, country | Geographic analysis |
seller | Dealer information | Name, rating, type | Dealer analysis |
features | Vehicle features | Array of features | Feature analysis |
url | Original listing URL | AutoTrader URL | Direct access |
extracted_at | Data extraction timestamp | ISO timestamp | Data freshness |
🔍 Step 4: Advanced Search Options
Comprehensive Search Parameters
Expand your search with advanced filtering options:
// Advanced search with multiple filters
const advancedSearch = {
query: 'BMW X5',
year_from: 2018,
year_to: 2023,
price_min: 25000,
price_max: 60000,
fuel_type: 'diesel',
transmission: 'automatic',
body_type: 'suv',
location: 'Manchester',
mileage_max: 50000,
limit: 50,
};
const response = await axios.post(`${BASE_URL}/search`, advancedSearch, {
headers: { Authorization: `Bearer ${API_KEY}` },
});
# Advanced search with multiple filters
advanced_search = {
'query': 'BMW X5',
'year_from': 2018,
'year_to': 2023,
'price_min': 25000,
'price_max': 60000,
'fuel_type': 'diesel',
'transmission': 'automatic',
'body_type': 'suv',
'location': 'Manchester',
'mileage_max': 50000,
'limit': 50
}
response = requests.post(f'{BASE_URL}/search', json=advanced_search, headers=headers)
Search Parameters Reference
Parameter | Type | Description | Example |
---|---|---|---|
query | string | Search query (make, model, keywords) | "BMW X5", "Mercedes C-Class" |
year_from | number | Minimum year | 2018 |
year_to | number | Maximum year | 2023 |
price_min | number | Minimum price (GBP) | 25000 |
price_max | number | Maximum price (GBP) | 60000 |
fuel_type | string | Fuel type | "diesel", "petrol", "hybrid", "electric" |
transmission | string | Transmission type | "automatic", "manual" |
body_type | string | Body type | "suv", "saloon", "hatchback", "estate" |
location | string | City or region | "London", "Manchester", "Birmingham" |
mileage_max | number | Maximum mileage (miles) | 50000 |
limit | number | Results per page (1-100) | 50 |
page | number | Page number | 1 |
⚡ Step 5: Production-Ready Implementation
Error Handling
Implement robust error handling for production use:
async function safeSearch(searchParams) {
try {
const response = await axios.post(`${BASE_URL}/search`, searchParams, {
headers: { Authorization: `Bearer ${API_KEY}` },
});
return { success: true, data: response.data };
} catch (error) {
if (error.response?.status === 429) {
// Rate limit exceeded - wait and retry
await new Promise((resolve) => setTimeout(resolve, 60000));
return safeSearch(searchParams);
}
return {
success: false,
error: error.response?.data || error.message,
};
}
}
import time
def safe_search(search_params):
try:
response = requests.post(f'{BASE_URL}/search', json=search_params, headers=headers)
response.raise_for_status()
return {'success': True, 'data': response.json()}
except requests.exceptions.HTTPError as e:
if e.response.status_code == 429:
# Rate limit exceeded - wait and retry
time.sleep(60)
return safe_search(search_params)
return {
'success': False,
'error': e.response.json() if e.response.content else str(e)
}
except Exception as e:
return {
'success': False,
'error': str(e)
}
Batch Processing
Process multiple searches efficiently:
// Process multiple searches efficiently
async function batchSearch(queries) {
const promises = queries.map((query) =>
axios.post(`${BASE_URL}/search`, query, {
headers: { Authorization: `Bearer ${API_KEY}` },
}),
);
const results = await Promise.all(promises);
return results.map((r) => r.data);
}
// Usage
const queries = [
{ query: 'BMW X5', country: 'GB' },
{ query: 'Audi Q7', country: 'GB' },
{ query: 'Mercedes GLE', country: 'GB' },
];
const results = await batchSearch(queries);
import asyncio
import aiohttp
async def batch_search(queries):
async with aiohttp.ClientSession() as session:
tasks = []
for query in queries:
task = session.post(
f'{BASE_URL}/search',
json=query,
headers=headers
)
tasks.append(task)
responses = await asyncio.gather(*tasks)
return [await r.json() for r in responses]
# Usage
queries = [
{'query': 'BMW X5', 'country': 'GB'},
{'query': 'Audi Q7', 'country': 'GB'},
{'query': 'Mercedes GLE', 'country': 'GB'}
]
results = await batch_search(queries)
Configuration Management
Set up proper configuration for different environments:
// Configuration for different environments
const config = {
development: {
baseUrl: 'https://api.carapis.com/v1/parsers/autotrader',
timeout: 30000,
retries: 3,
},
production: {
baseUrl: 'https://api.carapis.com/v1/parsers/autotrader',
timeout: 60000,
retries: 5,
},
};
const currentConfig = config[process.env.NODE_ENV || 'development'];
import os
# Configuration for different environments
config = {
'development': {
'base_url': 'https://api.carapis.com/v1/parsers/autotrader',
'timeout': 30,
'retries': 3
},
'production': {
'base_url': 'https://api.carapis.com/v1/parsers/autotrader',
'timeout': 60,
'retries': 5
}
}
current_config = config[os.getenv('ENVIRONMENT', 'development')]
📈 Step 6: Performance Optimization
Rate Limiting
Respect API rate limits for optimal performance:
Plan | Requests per Minute | Requests per Hour | Best Practices |
---|---|---|---|
Free | 10 | 100 | Testing and evaluation |
Basic | 60 | 1,000 | Small applications |
Pro | 300 | 10,000 | Production applications |
Enterprise | Custom | Custom | High-volume applications |
Caching Strategy
Implement intelligent caching for better performance:
// Simple caching implementation
const cache = new Map();
const CACHE_DURATION = 15 * 60 * 1000; // 15 minutes
async function cachedSearch(searchParams) {
const cacheKey = JSON.stringify(searchParams);
const cached = cache.get(cacheKey);
if (cached && Date.now() - cached.timestamp < CACHE_DURATION) {
return cached.data;
}
const result = await safeSearch(searchParams);
cache.set(cacheKey, {
data: result,
timestamp: Date.now(),
});
return result;
}
import time
from functools import lru_cache
# Simple caching implementation
cache = {}
CACHE_DURATION = 15 * 60 # 15 minutes
def cached_search(search_params):
cache_key = str(search_params)
cached = cache.get(cache_key)
if cached and time.time() - cached['timestamp'] < CACHE_DURATION:
return cached['data']
result = safe_search(search_params)
cache[cache_key] = {
'data': result,
'timestamp': time.time()
}
return result
🔧 Step 7: Monitoring & Logging
Performance Monitoring
Track API performance and usage:
// Performance monitoring
async function monitoredSearch(searchParams) {
const startTime = Date.now();
try {
const result = await safeSearch(searchParams);
const duration = Date.now() - startTime;
console.log('Search completed', {
duration,
resultCount: result.data?.data?.listings?.length || 0,
query: searchParams.query,
});
return result;
} catch (error) {
const duration = Date.now() - startTime;
console.error('Search failed', {
duration,
error: error.message,
query: searchParams.query,
});
throw error;
}
}
import time
import logging
# Performance monitoring
def monitored_search(search_params):
start_time = time.time()
try:
result = safe_search(search_params)
duration = time.time() - start_time
logging.info('Search completed', {
'duration': duration,
'result_count': len(result.get('data', {}).get('listings', [])),
'query': search_params.get('query')
})
return result
except Exception as e:
duration = time.time() - start_time
logging.error('Search failed', {
'duration': duration,
'error': str(e),
'query': search_params.get('query')
})
raise
🚀 Next Steps
- API Reference - Complete endpoint documentation
- Market Analysis - UK market insights
- FAQ - Common questions and solutions
- Features - Advanced capabilities
- Start with simple searches and gradually add complexity
- Implement proper error handling for production reliability
- Use caching to optimize performance and reduce costs
- Monitor your usage to stay within rate limits
- Test with different UK regions for comprehensive coverage
- Documentation - Complete setup guide
- Support - Technical assistance
- Community - Connect with other users
- UK Market Specialists - Local expertise
You're now ready to extract comprehensive UK automotive data with AutoTrader parser. Start building your automotive data applications today!