API Reference

AutoElite API Documentation

Overview

The AutoElite API provides access to vehicle inventory, dealer information, and other resources. This documentation covers authentication, endpoints, and best practices for integrating with the AutoElite platform.

Base URL

Use the following base URL for all API requests:

https://api.autoelite.io

Note: This is the official API endpoint for all external integrations with the AutoElite platform.

Authentication

API Keys

All requests to the AutoElite API must include an API key. API keys can be obtained from the AutoElite Admin Portal.

API keys can be associated with:

  • A specific dealer (access limited to that dealer's data)
  • A specific user (access limited to that user's permissions)
  • No association (super admin access to all data)

Include your API key in all requests using the X-API-Key header:

X-API-Key: autoelite-web-app-12345

Code Examples

We provide code examples for integrating with the AutoElite API in various programming languages:

Visit our Code Examples page for detailed implementation samples.

For desktop applications, also include the application type:

X-App-Type: desktop

API Key Types

  1. Web Application Keys: For browser-based applications
  2. Desktop Application Keys: For desktop software
  3. Mobile Application Keys: For mobile applications

Each type has different default permissions and security requirements.

Permissions

API keys have resource-based permissions:

  • read: Allows retrieving data
  • write: Allows creating and updating data
  • delete: Allows deleting data

Permissions are granted per resource (e.g., vehicles, dealers, users).

Dealer-Specific Access

When an API key is associated with a specific dealer:

  1. Vehicle endpoints automatically filter results to only show vehicles belonging to that dealer
  2. Attempts to access vehicles from other dealers will be rejected
  3. New vehicles will automatically be assigned to the dealer associated with the API key
  4. Updates to vehicles will be restricted to those belonging to the associated dealer

Endpoints

Vehicles

Get All Vehicles

GET /api/vehicles

Query Parameters:

  • dealer_id (optional): Filter by dealer ID
  • status (optional): Filter by status (available, sold, pending)
  • featured (optional): Filter by featured status (true, false)
  • limit (optional): Maximum number of results to return
  • offset (optional): Number of results to skip (for pagination)

Response:

{
  "meta": {
    "total": 1,
    "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,
      "mileage": null,
      "exterior_color": null,
      "interior_color": null,
      "vin": null,
      "stock_number": null,
      "description": null,
      "features": null,
      "status": "available",
      "featured": 0,
      "created_at": "2025-11-28 05:30:15",
      "updated_at": "2025-11-28 05:30:15",
      "title": null
    }
  ]
}

Get a Specific Vehicle

GET /api/vehicles/:id

Response:

{
  "id": 1,
  "title": "2023 Toyota Camry",
  "make": "Toyota",
  "model": "Camry",
  "year": 2023,
  "price": 25000,
  "dealer_id": 123,
  "mileage": 15000,
  "exterior_color": "Blue",
  "interior_color": "Black",
  "vin": "1HGBH41JXMN109186",
  "stock_number": "T12345",
  "description": "Well-maintained sedan with low mileage",
  "features": "Bluetooth, Backup Camera, Leather Seats",
  "status": "available",
  "featured": true,
  "fuel_type": "Gasoline",
  "transmission": "Automatic",
  "engine": "2.5L 4-Cylinder",
  "drivetrain": "FWD",
  "body_style": "Sedan",
  "condition": "Used",
  "seats": 5,
  "created_at": "2023-11-15T14:30:00Z",
  "updated_at": "2023-11-15T14:30:00Z"
}

Create a Vehicle

POST /api/vehicles

Request Body:

{
  "title": "2023 Toyota Camry",
  "make": "Toyota",
  "model": "Camry",
  "year": 2023,
  "price": 25000,
  "dealer_id": 123,
  "mileage": 15000,
  "exterior_color": "Blue",
  "interior_color": "Black",
  "vin": "1HGBH41JXMN109186",
  "stock_number": "T12345",
  "description": "Well-maintained sedan with low mileage",
  "features": "Bluetooth, Backup Camera, Leather Seats",
  "status": "available",
  "featured": true,
  "fuel_type": "Gasoline",
  "transmission": "Automatic",
  "engine": "2.5L 4-Cylinder",
  "drivetrain": "FWD",
  "body_style": "Sedan",
  "condition": "Used",
  "seats": 5
}

Required fields: dealer_id, make, model, year, price

Note: If using a dealer-specific API key, the dealer_id will be automatically set to the dealer associated with the API key.

Response:

{
  "id": 1,
  "title": "2023 Toyota Camry",
  "make": "Toyota",
  "model": "Camry",
  "year": 2023,
  "price": 25000,
  "dealer_id": 123,
  "status": "available",
  "featured": true,
  "created_at": "2023-11-15T14:30:00Z",
  "updated_at": "2023-11-15T14:30:00Z"
}

Update a Vehicle

PUT /api/vehicles/:id

Request Body:

{
  "price": 24500,
  "status": "pending",
  "description": "Updated description"
}

Response:

{
  "id": 1,
  "title": "2023 Toyota Camry",
  "make": "Toyota",
  "model": "Camry",
  "year": 2023,
  "price": 24500,
  "dealer_id": 123,
  "status": "pending",
  "description": "Updated description",
  "featured": true,
  "created_at": "2023-11-15T14:30:00Z",
  "updated_at": "2023-11-15T15:45:00Z"
}

Delete a Vehicle

DELETE /api/vehicles/:id

Response:

{
  "success": true,
  "message": "Vehicle deleted successfully"
}

Vehicle Images

Get Vehicle Images

GET /api/vehicles/:id/images

Response:

[
  {
    "id": 1,
    "vehicle_id": 1,
    "image_url": "https://storage.autoelite.io/vehicles/1/image1.jpg",
    "is_primary": true,
    "display_order": 0,
    "created_at": "2023-11-15T14:30:00Z"
  },
  {
    "id": 2,
    "vehicle_id": 1,
    "image_url": "https://storage.autoelite.io/vehicles/1/image2.jpg",
    "is_primary": false,
    "display_order": 1,
    "created_at": "2023-11-15T14:30:00Z"
  }
]

Add Vehicle Image

POST /api/vehicles/:id/images

Request Body:

{
  "image_url": "https://storage.autoelite.io/vehicles/1/image3.jpg",
  "is_primary": false,
  "display_order": 2
}

Response:

{
  "id": 3,
  "vehicle_id": 1,
  "image_url": "https://storage.autoelite.io/vehicles/1/image3.jpg",
  "is_primary": false,
  "display_order": 2,
  "created_at": "2023-11-15T16:00:00Z"
}

Dealers

Get All Dealers

GET /api/dealers

Response:

[
  {
    "id": 123,
    "name": "AutoElite Downtown",
    "address": "123 Main St",
    "city": "Metropolis",
    "state": "NY",
    "zip": "10001",
    "phone": "555-123-4567",
    "email": "downtown@autoelite.com",
    "website": "https://downtown.autoelite.com",
    "created_at": "2023-01-01T00:00:00Z",
    "updated_at": "2023-01-01T00:00:00Z"
  }
]

Get a Specific Dealer

GET /api/dealers/:id

Response:

{
  "id": 123,
  "name": "AutoElite Downtown",
  "address": "123 Main St",
  "city": "Metropolis",
  "state": "NY",
  "zip": "10001",
  "phone": "555-123-4567",
  "email": "downtown@autoelite.com",
  "website": "https://downtown.autoelite.com",
  "created_at": "2023-01-01T00:00:00Z",
  "updated_at": "2023-01-01T00:00:00Z"
}

API Keys

Get All API Keys

GET /api-keys

Query Parameters:

  • dealer_id (optional): Filter by dealer ID
  • app_type (optional): Filter by application type (web, desktop, mobile)
  • active (optional): Filter by active status (true, false)

Response:

[
  {
    "id": 4,
    "name": "AutoPret 123 Facebook Integration",
    "description": "API key for Facebook Marketplace integration",
    "api_key": "autopret123-fb-key-test-2025",
    "app_id": "fb-1161979592774488",
    "app_type": "server",
    "active": 1,
    "created_at": "2025-11-28 04:11:27",
    "last_used": "2025-11-28 05:04:30",
    "expires_at": null,
    "dealer_id": 1
  }
]

Get API Key by ID

GET /api-keys/:id

Response:

{
  "id": 4,
  "name": "AutoPret 123 Facebook Integration",
  "description": "API key for Facebook Marketplace integration",
  "api_key": "autopret123-fb-key-test-2025",
  "app_id": "fb-1161979592774488",
  "app_type": "server",
  "active": 1,
  "created_at": "2025-11-28 04:11:27",
  "last_used": "2025-11-28 05:04:30",
  "expires_at": null,
  "dealer_id": 1,
  "permissions": [
    { "resource": "vehicles", "action": "read" },
    { "resource": "facebook-integration", "action": "read" },
    { "resource": "facebook-integration", "action": "write" },
    { "resource": "xml-feed", "action": "read" }
  ]
}

Create an API Key

POST /api-keys

Request Body:

{
  "name": "Downtown Desktop App",
  "description": "API key for downtown dealer desktop application",
  "app_type": "desktop",
  "app_id": "downtown-desktop",
  "dealer_id": 123,
  "expires_at": "2024-12-31T23:59:59Z"
}

Response:

{
  "id": 2,
  "name": "Downtown Desktop App",
  "description": "API key for downtown dealer desktop application",
  "api_key": "autoelite-desktop-downtown-desktop-a1b2c3d4",
  "app_id": "downtown-desktop",
  "app_type": "desktop",
  "active": true,
  "created_at": "2023-11-15T16:30:00Z",
  "expires_at": "2024-12-31T23:59:59Z"
}

Update an API Key

PUT /api-keys/:id

Request Body:

{
  "name": "Updated Name",
  "description": "Updated description",
  "active": false
}

Response:

{
  "id": 2,
  "name": "Updated Name",
  "description": "Updated description",
  "api_key": "autoelite-desktop-downtown-desktop-a1b2c3d4",
  "app_id": "downtown-desktop",
  "app_type": "desktop",
  "active": false,
  "created_at": "2023-11-15T16:30:00Z",
  "expires_at": "2024-12-31T23:59:59Z"
}

Revoke an API Key

DELETE /api-keys/:id

Response:

{
  "success": true,
  "message": "API key revoked successfully"
}

Error Handling

The API uses standard HTTP status codes:

  • 200 OK: Request succeeded
  • 201 Created: Resource created successfully
  • 400 Bad Request: Invalid request parameters
  • 401 Unauthorized: Missing or invalid API key
  • 403 Forbidden: Insufficient permissions or attempting to access another dealer's data
  • 404 Not Found: Resource not found
  • 500 Internal Server Error: Server error

Error responses include a JSON body with an error message:

{
  "error": "Detailed error message"
}

Rate Limiting

API requests are subject to rate limiting:

  • Web applications: 100 requests per minute
  • Desktop applications: 300 requests per minute
  • Mobile applications: 200 requests per minute

When rate limited, the API will return a 429 Too Many Requests status code.

Best Practices

  1. Store API Keys Securely: Never expose API keys in client-side code or public repositories.

  2. Handle Errors Gracefully: Always check for and handle error responses.

  3. Implement Pagination: When retrieving large collections, use the limit and offset parameters.

  4. Minimize Request Frequency: Cache responses when appropriate to reduce API calls.

  5. Use HTTPS: Always use HTTPS for all API requests.

  6. Validate Input: Validate all user input before sending it to the API.

  7. Handle Rate Limiting: Implement exponential backoff when encountering rate limits.

  8. Use Bulk Operations: For creating, updating, or deleting multiple resources, implement client-side batching as described in our Bulk Operations Guide.