Getting Started with the AutoElite API
Getting Started with the AutoElite API
This guide will help you get started with the AutoElite API. We'll walk through the basics of authentication, making your first API request, and handling responses.
Prerequisites
Before you begin, you'll need:
- An AutoElite account with API access
- An API key (see API Key Management Guide)
- Basic knowledge of HTTP requests and JSON
Step 1: Obtain an API Key
If you haven't already, create an API key:
- Log in to the AutoElite Admin Portal
- Navigate to "API Keys" in the sidebar
- Click "Create API Key"
- Fill in the required information
- Click "Create"
- Copy the generated API key
Remember to store your API key securely. It will only be shown once.
Step 2: Make Your First API Request
Let's make a simple request to get a list of vehicles:
Using cURL
curl -X GET "https://api.autoelite.io/api/vehicles" \
-H "X-API-Key: your-api-key-here" \
-H "Content-Type: application/json"
Using JavaScript/Fetch
fetch('https://api.autoelite.io/api/vehicles', {
method: 'GET',
headers: {
'X-API-Key': 'your-api-key-here',
'Content-Type': 'application/json'
}
})
.then(response => response.json())
.then(data => {
console.log('Total vehicles:', data.meta.total);
console.log('Vehicles:', data.vehicles);
})
.catch(error => console.error('Error:', error));
Using Python/Requests
import requests
url = "https://api.autoelite.io/api/vehicles"
headers = {
"X-API-Key": "your-api-key-here",
"Content-Type": "application/json"
}
response = requests.get(url, headers=headers)
data = response.json()
# Access the metadata and vehicles list
print(f"Found {data['meta']['total']} vehicles")
for vehicle in data['vehicles']:
print(f"{vehicle['year']} {vehicle['make']} {vehicle['model']} - ${vehicle['price']}")
Step 3: Understanding the Response
The API returns data in JSON format. For example, a request to /api/vehicles might return:
// Response from api.autoelite.io
{
"meta": {
"total": 4,
"filter_applied": true,
"dealer_id": 1,
"timestamp": "2025-12-03T19:52:19.148Z",
"sql": "SELECT * FROM vehicles WHERE 1=1 AND dealer_id = ? ORDER BY created_at DESC"
},
"vehicles": [
{
"id": 32,
"dealer_id": 1,
"make": "Tesla",
"model": "Model Y",
"year": 2025,
"trim": null,
"price": 45000,
"status": "available",
"created_at": "2025-11-28 05:30:15",
"updated_at": "2025-11-28 05:30:15"
},
{
"id": 31,
"dealer_id": 1,
"make": "Test Make",
"model": "Test Model",
"year": 2023,
"price": 10000,
"status": "available",
"created_at": "2025-11-27 23:29:30",
"updated_at": "2025-11-27 23:29:30",
"title": "Test Vehicle via API"
}
]
}
Step 4: Creating a Resource
Let's create a new vehicle:
Using cURL
curl -X POST "https://api.autoelite.io/api/vehicles" \
-H "X-API-Key: your-api-key-here" \
-H "Content-Type: application/json" \
-d '{
"make": "Toyota",
"model": "Camry",
"year": 2023,
"price": 25000,
"dealer_id": 1,
"status": "available"
}'
Using JavaScript/Fetch
const vehicleData = {
make: "Toyota",
model: "Camry",
year: 2023,
price: 25000,
dealer_id: 1,
status: "available"
};
fetch('https://api.autoelite.io/api/vehicles', {
method: 'POST',
headers: {
'X-API-Key': 'your-api-key-here',
'Content-Type': 'application/json'
},
body: JSON.stringify(vehicleData)
})
.then(response => response.json())
.then(data => console.log(data))
.catch(error => console.error('Error:', error));
Step 5: Handling Errors
The API uses standard HTTP status codes to indicate the success or failure of a request:
200 OK: Request succeeded201 Created: Resource created successfully400 Bad Request: Invalid request parameters401 Unauthorized: Missing or invalid API key403 Forbidden: Insufficient permissions404 Not Found: Resource not found429 Too Many Requests: Rate limit exceeded500 Internal Server Error: Server error
Error responses include a JSON body with an error message:
{
"error": "Detailed error message"
}
Always check for and handle error responses in your code:
fetch('https://api.autoelite.io/api/vehicles', {
method: 'GET',
headers: {
'X-API-Key': 'your-api-key-here',
'Content-Type': 'application/json'
}
})
.then(response => {
if (!response.ok) {
return response.json().then(errorData => {
throw new Error(errorData.error || `HTTP error! status: ${response.status}`);
});
}
return response.json();
})
.then(data => console.log(data))
.catch(error => console.error('Error:', error));
Next Steps
Now that you've made your first API request, you can explore the rest of the API:
- Read the API Reference for detailed information about all endpoints
- Learn about Dealer-Specific Access Control if you're building a dealer-specific application
- Check out our Code Examples for more detailed implementation examples
If you have any questions, don't hesitate to contact our support team.