DocumentationAPI Reference
    Developers

    API Documentation

    Integrate AutoHub4u with your applications using our RESTful API. Build custom integrations, mobile apps, or automate workflows programmatically.

    30 minutes
    For Developers

    API Access

    API access is available on Professional ($2,999/mo) and Enterprise plans. Upgrade your plan to get API keys and start building integrations.

    01

    Get Your API Key

    Generate API credentials from your dashboard.

    • Available on Professional and Enterprise plans only
    • Go to Settings → Developers → API Keys
    • Click 'Generate New API Key'
    • Name your key (e.g., 'Mobile App', 'Website Integration')
    • Copy and save the API key securely - shown only once
    • Keep API keys secret - never commit to GitHub or share publicly
    02

    Authentication

    Include your API key in every request header.

    • Add header: Authorization: Bearer YOUR_API_KEY
    • All requests must be made over HTTPS
    • API keys are tied to your account and inherit permissions
    • Rate limit: 1000 requests/hour (Professional), 10000/hour (Enterprise)
    • Exceeding rate limit returns 429 Too Many Requests
    • Contact support for higher rate limits
    03

    Make Your First Request

    Test the API with a simple GET request.

    • Base URL: https://api.autohub4u.com/v1
    • Test endpoint: GET /vehicles to list your inventory
    • Use tools like Postman, Insomnia, or curl
    • Check response status code: 200 = Success
    • Review response data structure and fields
    • Handle errors appropriately (4xx, 5xx codes)
    04

    Implement in Your App

    Integrate AutoHub4u API into your application.

    • Use appropriate HTTP library (axios, fetch, requests)
    • Store API key securely (environment variables, secrets manager)
    • Implement error handling and retry logic
    • Add request logging for debugging
    • Cache responses when appropriate to reduce API calls
    • Test thoroughly in development before production
    05

    Monitor & Optimize

    Track API usage and optimize performance.

    • View usage statistics in Settings → API Dashboard
    • Monitor rate limit consumption
    • Review error rates and failed requests
    • Optimize by reducing unnecessary API calls
    • Use webhooks for real-time updates instead of polling
    • Contact support if you need custom endpoints

    Available API Endpoints

    GET/vehicles

    List all vehicles in your inventory

    Params: page, limit, status, categoryReturns: Array of vehicle objects with full details
    GET/vehicles/:id

    Get single vehicle details by ID

    Params: id (required)Returns: Single vehicle object with all fields
    POST/vehicles

    Create a new vehicle listing

    Params: make, model, year, price, etc. (see docs)Returns: Created vehicle object with ID
    PUT/vehicles/:id

    Update existing vehicle

    Params: id + any fields to updateReturns: Updated vehicle object
    DELETE/vehicles/:id

    Delete a vehicle listing

    Params: id (required)Returns: Success confirmation message
    GET/leads

    List all customer leads

    Params: page, limit, status, sourceReturns: Array of lead objects
    POST/leads

    Create new lead (from external form)

    Params: name, email, phone, vehicle_idReturns: Created lead object
    GET/transactions

    List all sales transactions

    Params: page, limit, date_from, date_toReturns: Array of transaction objects
    POST/transactions

    Record a new sale

    Params: vehicle_id, customer_id, amount, payment_methodReturns: Created transaction with invoice
    GET/analytics

    Get business analytics and metrics

    Params: date_from, date_to, metricsReturns: Analytics data object

    Code Examples

    JavaScript (Node.js)

    // Node.js with axios
    const axios = require('axios');
    
    const api = axios.create({
      baseURL: 'https://api.autohub4u.com/v1',
      headers: {
        'Authorization': 'Bearer YOUR_API_KEY',
        'Content-Type': 'application/json'
      }
    });
    
    // Get all vehicles
    async function getVehicles() {
      try {
        const response = await api.get('/vehicles?limit=10');
        console.log(response.data);
      } catch (error) {
        console.error('Error:', error.response.data);
      }
    }

    Python

    # Python with requests
    import requests
    
    API_KEY = "YOUR_API_KEY"
    BASE_URL = "https://api.autohub4u.com/v1"
    
    headers = {
        "Authorization": f"Bearer {API_KEY}",
        "Content-Type": "application/json"
    }
    
    # Get all vehicles
    response = requests.get(
        f"{BASE_URL}/vehicles",
        headers=headers,
        params={"limit": 10}
    )
    
    if response.status_code == 200:
        vehicles = response.json()
        print(vehicles)
    else:
        print(f"Error: {response.status_code}")

    cURL

    # cURL example
    curl -X GET \
      'https://api.autohub4u.com/v1/vehicles?limit=10' \
      -H 'Authorization: Bearer YOUR_API_KEY' \
      -H 'Content-Type: application/json'

    Webhooks (Real-time Events)

    Subscribe to events and get notified instantly when things happen:

    vehicle.created

    Triggered when new vehicle is added

    vehicle.updated

    Triggered when vehicle is modified

    vehicle.sold

    Triggered when vehicle is marked as sold

    lead.created

    Triggered when new lead arrives

    transaction.completed

    Triggered when sale is finalized

    payment.received

    Triggered when payment is confirmed

    Configure webhook URLs in Settings → Developers → Webhooks

    Rate Limits & Best Practices

    Rate Limits

    • Professional: 1,000 requests/hour
    • Enterprise: 10,000 requests/hour
    • Custom limits available

    Best Practices

    • Cache responses when possible
    • Use webhooks instead of polling
    • Implement exponential backoff
    • Handle 429 errors gracefully

    Security Best Practices

    • Never commit API keys to version control (use .env files)
    • Rotate API keys regularly (every 90 days recommended)
    • Use separate keys for dev, staging, and production
    • Implement IP whitelisting when possible (Enterprise)
    • Monitor API usage for suspicious activity
    • Revoke compromised keys immediately
    • Use HTTPS only - never send keys over HTTP
    • Store keys in secure secrets manager (AWS Secrets, Vault)

    Related Documentation

    Need API Support?

    Our developer support team can help with API integration, troubleshooting, and custom endpoint requests.

    Contact Developer Support