API Documentation

    Integrate vehicle checks directly into your applications with our REST API

    API Access Requirements

    All 4 requirements must be met before you can use the API

    1. Minimum £100 Balance

    Your account must maintain at least £100 credit to use the API

    2. Saved Payment Card

    A payment method must be saved on your account for automatic billing

    3. Auto Top-Up Enabled

    Auto top-up must be configured to ensure uninterrupted service

    4. API Key Generated

    Generate an API key from your Settings page

    Why these requirements? API access is designed for high-volume integrations. The saved card and auto top-up ensure your service runs continuously without manual intervention. Every API check appears in your reports, billing transactions, and audit trail.

    Quick Start

    Get up and running with the CheckVehicles API in minutes

    1

    Top up balance

    Ensure you have at least £100 credit

    2

    Get your API key

    Generate a key from Settings

    3

    Make a request

    Use the examples below

    4

    Handle response

    Process the JSON report

    Base URL

    https://yctsicokfslyvibcoyza.supabase.co/functions/v1/api

    All API endpoints are relative to this base URL.

    Authentication

    All API requests require authentication using a Bearer token. Include your API key in theAuthorizationheader.

    Authorization: Bearer cv_live_xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
    Keep your API key secure. Never expose it in client-side code or public repositories.

    Sandbox Mode

    Test your integration without consuming credits

    How it works:

    • Enable sandbox mode above or in Settings
    • Use your API key for both sandbox and live requests
    • Sandbox requests return cached data from 10 real vehicles
    • No credits are consumed for sandbox requests
    • Responses include _sandbox: true

    Get Sandbox Vehicles

    GET /v1/sandbox/vehicles

    Returns a list of available sandbox test registrations and VINs. Use these with sandbox mode enabled for free testing.

    Check Types & Pricing

    API pricing is based on your spend tier - prices shown are from the best tier (Diamond)

    maxi

    150+ data points including valuation and MOT history

    ...
    maxi-plus

    Complete check including finance, stolen, write-off

    ...

    Data Points Reference

    Complete breakdown of all data returned by each check type

    Everything in Maxi plus comprehensive security checks, finance records, ownership history, and enhanced specifications.

    Code Examples

    Copy and paste these examples to get started

    curl -X POST "https://yctsicokfslyvibcoyza.supabase.co/functions/v1/api/v1/check" \
      -H "Authorization: Bearer cv_live_YOUR_API_KEY" \
      -H "Content-Type: application/json" \
      -d '{"registration": "AB12 CDE", "type": "maxi-plus"}'

    Endpoints

    POST
    /v1/check

    Run a vehicle check and deduct credits from your balance

    Parameters

    registration
    required
    stringUK vehicle registration number (e.g., "AB12 CDE")
    type
    required
    stringCheck type: "maxi" or "maxi-plus" (legacy: "valuation", "lite", "full" still work)

    Response Example

    {
      "success": true,
      "report_id": "550e8400-e29b-41d4-a716-446655440000",
      "registration": "AB12CDE",
      "check_type": "maxi-plus",
      "data": {
        "make": "BMW",
        "model": "3 Series",
        "year": 2019,
        "colour": "Black",
        "fuelType": "Diesel",
        "vin": "WBAXXXXXXXX",
        "valuation": {
          "dealerForecourt": 18500,
          "tradeRetail": 16200,
          "privateClean": 17000
        },
        "stolenCheck": { "isStolen": false },
        "financeRecords": [],
        "writeOffRecords": []
      },
      "balance": {
        "before": 100.00,
        "after": 97.25,
        "currency": "GBP",
        "low_balance_warning": false
      }
    }
    GET
    /v1/reports

    List all your vehicle reports with pagination

    Parameters

    limit
    numberNumber of results (default: 20, max: 100)
    offset
    numberPagination offset (default: 0)
    source
    stringFilter by source: "web" or "api"

    Response Example

    {
      "reports": [
        {
          "id": "550e8400-e29b-41d4-a716-446655440000",
          "registration": "AB12CDE",
          "make": "BMW",
          "model": "3 Series",
          "year": 2019,
          "check_type": "full",
          "source": "api",
          "created_at": "2024-01-15T10:30:00Z"
        }
      ],
      "total": 42,
      "limit": 20,
      "offset": 0
    }
    GET
    /v1/reports/:id

    Get a specific report by ID with full data

    Parameters

    id
    required
    stringReport UUID

    Response Example

    {
      "id": "550e8400-e29b-41d4-a716-446655440000",
      "registration": "AB12CDE",
      "make": "BMW",
      "model": "3 Series",
      "year": 2019,
      "check_type": "full",
      "status": "completed",
      "source": "api",
      "data": { ... },
      "created_at": "2024-01-15T10:30:00Z"
    }
    GET
    /v1/balance

    Get your current credit balance (simple endpoint)

    Response Example

    {
      "balance": 97.25,
      "currency": "GBP"
    }
    GET
    /v1/billing

    Get comprehensive billing information including balance, auto top-up settings, and payment status

    Response Example

    {
      "balance": 97.25,
      "currency": "GBP",
      "auto_topup": {
        "enabled": true,
        "threshold": 25,
        "amount": 100
      },
      "payment_method": {
        "has_card": true,
        "last4": "4242",
        "brand": "visa",
        "exp_month": 12,
        "exp_year": 2027
      },
      "requirements": {
        "min_balance": 100,
        "topup_threshold": 20
      },
      "status": {
        "api_enabled": true,
        "failure_count": 0,
        "last_failure_at": null,
        "disabled_reason": null
      },
      "spend_tier": "standard"
    }
    PUT
    /v1/billing/auto-topup

    Enable or configure auto top-up settings via API

    Parameters

    enabled
    booleanEnable or disable auto top-up
    threshold
    numberBalance threshold to trigger top-up (minimum £20 for API)
    amount
    numberAmount to top up when triggered (must be >= threshold)

    Response Example

    {
      "success": true,
      "auto_topup": {
        "enabled": true,
        "threshold": 25,
        "amount": 100
      },
      "message": "Auto top-up settings updated"
    }
    POST
    /v1/billing/topup

    Trigger a manual top-up using your saved payment method

    Parameters

    amount
    required
    numberAmount to top up in GBP (must be positive)

    Response Example

    {
      "success": true,
      "amount": 50,
      "balance": {
        "before": 25.00,
        "after": 75.00
      },
      "payment_id": "pi_abc123...",
      "currency": "GBP"
    }

    Error Codes

    Common error responses and their meanings

    MISSING_API_KEY
    401
    No API key provided in Authorization header
    INVALID_API_KEY
    401
    API key is invalid or unknown
    KEY_REVOKED
    401
    API key has been revoked
    API_ACCESS_DISABLED
    403
    API access has been disabled for this account
    PAYMENT_METHOD_REQUIRED
    402
    A saved payment card is required for API access
    AUTO_TOPUP_REQUIRED
    402
    Auto top-up must be enabled and configured for API access
    INSUFFICIENT_BALANCE
    402
    Balance below minimum £100 requirement for API access
    INSUFFICIENT_CREDITS
    402
    Not enough credits for this check
    RATE_LIMITED
    429
    Rate limit exceeded (default: 100 requests/minute)
    VEHICLE_NOT_FOUND
    404
    Vehicle not found for the given registration
    NOT_FOUND
    404
    Endpoint or resource not found
    TOPUP_FAILED
    402
    Payment failed during top-up attempt
    INVALID_TOPUP_AMOUNT
    400
    Top-up amount must be positive or >= threshold
    THRESHOLD_TOO_LOW
    400
    Auto top-up threshold must be at least £20 for API users
    WALLET_NOT_FOUND
    404
    Credit wallet not found for user
    UPDATE_FAILED
    500
    Failed to update billing settings

    Response Schema

    Complete type definitions for API responses - copy into your project for type-safe integration

    // ===== API Response Types =====
    
    /** Main check response wrapper */
    interface VehicleCheckResponse {
      success: boolean;
      report_id: string;
      registration: string;
      check_type: 'maxi' | 'maxi-plus';
      data: VehicleData;
      balance: BalanceInfo;
    }
    
    /** Balance information returned with each check */
    interface BalanceInfo {
      before: number;
      after: number;
      currency: 'GBP';
      low_balance_warning: boolean;
    }
    
    /** Complete vehicle data structure */
    interface VehicleData {
      // Identity
      make: string;
      model: string;
      year: number;
      colour: string;
      vin?: string; // Partial VIN for Maxi, full for Maxi-Plus
      
      // Registration & Tax
      registrationDate: string; // ISO date
      taxStatus: 'Taxed' | 'SORN' | 'Untaxed';
      taxDueDate?: string;
      motExpiryDate?: string;
      
      // Technical
      fuelType: string;
      engineSize?: number; // cc
      transmission?: string;
      bodyType?: string;
      doors?: number;
      co2Emissions?: number;
      euroStatus?: string;
      
      // Valuations (9-band)
      valuation?: ValuationData;
      
      // MOT History
      motHistory?: MOTRecord[];
      
      // EV Data (if applicable)
      evData?: EVData;
      
      // Maxi-Plus Only Fields
      stolenCheck?: StolenCheckResult;
      financeRecords?: FinanceRecord[];
      writeOffRecords?: WriteOffRecord[];
      keeperHistory?: KeeperRecord[];
      plateChanges?: PlateChange[];
      ncapRating?: NCAPRating;
      performanceData?: PerformanceData;
      dimensions?: DimensionsData;
    }
    
    /** 9-band valuation data */
    interface ValuationData {
      dealerForecourt: number;
      tradeRetail: number;
      tradeAverage: number;
      privateClean: number;
      privateAverage: number;
      auction: number;
      partExchange: number;
      futureValue3Months?: number;
      futureValue6Months?: number;
      futureValue12Months?: number;
      valuationDate: string;
    }
    
    /** Individual MOT test record */
    interface MOTRecord {
      testDate: string;
      expiryDate?: string;
      result: 'PASS' | 'FAIL';
      odometerValue: number;
      odometerUnit: 'mi' | 'km';
      testNumber: string;
      defects?: MOTDefect[];
      advisories?: MOTDefect[];
    }
    
    interface MOTDefect {
      text: string;
      type: 'DANGEROUS' | 'MAJOR' | 'MINOR' | 'ADVISORY';
      dangerous?: boolean;
    }
    
    /** EV-specific data */
    interface EVData {
      batteryCapacity?: number; // kWh
      wltpRange?: number; // miles
      realWorldRange?: number; // miles
      chargingSpeedAC?: number; // kW
      chargingSpeedDC?: number; // kW
      connectorTypes?: string[];
      chargeTime0to100AC?: number; // hours
      chargeTime10to80DC?: number; // minutes
    }
    
    /** Stolen vehicle check result (Maxi-Plus) */
    interface StolenCheckResult {
      isStolen: boolean;
      stolenDate?: string;
      policeReference?: string;
      policeForce?: string;
    }
    
    /** Outstanding finance record (Maxi-Plus) */
    interface FinanceRecord {
      agreementType: 'HP' | 'PCP' | 'Lease' | 'Other';
      agreementId: string;
      financerName: string;
      financerContact?: string;
      startDate?: string;
      endDate?: string;
    }
    
    /** Insurance write-off record (Maxi-Plus) */
    interface WriteOffRecord {
      category: 'A' | 'B' | 'S' | 'N';
      recordedDate: string;
      insurer?: string;
      lossType?: string;
    }
    
    /** Keeper/owner history (Maxi-Plus) */
    interface KeeperRecord {
      dateFrom: string;
      dateTo?: string;
      keeperNumber: number;
      isCurrentKeeper: boolean;
    }
    
    /** Registration plate change (Maxi-Plus) */
    interface PlateChange {
      previousPlate: string;
      newPlate: string;
      changeDate: string;
    }
    
    /** NCAP safety rating (Maxi-Plus) */
    interface NCAPRating {
      overallRating: number; // 0-5 stars
      adultOccupant: number; // percentage
      childOccupant: number;
      pedestrian: number;
      safetyAssist: number;
      testYear?: number;
    }
    
    /** Performance specifications (Maxi-Plus) */
    interface PerformanceData {
      powerBHP?: number;
      torqueNm?: number;
      torqueLbFt?: number;
      acceleration0to60?: number; // seconds
      topSpeed?: number; // mph
      fuelConsumptionCombined?: number; // mpg
    }
    
    /** Vehicle dimensions (Maxi-Plus) */
    interface DimensionsData {
      lengthMm?: number;
      widthMm?: number;
      heightMm?: number;
      wheelbaseMm?: number;
      bootCapacityLitres?: number;
      fuelTankLitres?: number;
      kerbWeightKg?: number;
      grossWeightKg?: number;
      towingCapacityBrakedKg?: number;
      towingCapacityUnbrakedKg?: number;
    }
    
    // ===== Error Response =====
    interface APIErrorResponse {
      success: false;
      error: string;
      code: ErrorCode;
      details?: Record<string, unknown>;
    }
    
    type ErrorCode = 
      | 'MISSING_API_KEY'
      | 'INVALID_API_KEY'
      | 'KEY_REVOKED'
      | 'API_ACCESS_DISABLED'
      | 'INSUFFICIENT_BALANCE'
      | 'RATE_LIMITED'
      | 'VEHICLE_NOT_FOUND'
      | 'INVALID_REGISTRATION'
      | 'INTERNAL_ERROR';

    Copy these TypeScript interfaces into your project for full type safety when working with the API.

    Webhooks

    Receive real-time notifications when events occur

    Configure webhooks in your Settings page to receive HTTP POST callbacks when certain events occur.

    Available Events

    check.completed
    Triggered when a vehicle check is completed successfully

    Webhook Payload Example

    {
      "event": "check.completed",
      "timestamp": "2024-01-15T10:30:00Z",
      "data": {
        "report_id": "550e8400-e29b-41d4-a716-446655440000",
        "registration": "AB12CDE",
        "check_type": "full",
        "make": "BMW",
        "model": "3 Series",
        "year": 2019
      }
    }

    Security

    Each webhook includes a signature header for verification. Always validate the signature before processing webhook payloads to ensure they came from CheckVehicles.

    Rate Limiting & Best Practices

    Handle rate limits gracefully with exponential backoff and proper retry strategies

    Standard Limit

    100 req/min

    Per API key

    Window Reset

    60 seconds

    Rolling window

    Exceeded Response

    429

    Too Many Requests

    Rate Limit Response Headers

    X-RateLimit-RemainingRequests remaining in current window. Monitor this to avoid hitting limits.
    Retry-AfterSeconds to wait before retrying (only on 429 responses). Always respect this value.

    Retry Implementation Examples

    // Exponential backoff with jitter for rate limit handling
    async function fetchWithRetry(url, options, maxRetries = 3) {
      for (let attempt = 0; attempt <= maxRetries; attempt++) {
        const response = await fetch(url, options);
        
        // Check rate limit headers
        const remaining = response.headers.get('X-RateLimit-Remaining');
        console.log(`Rate limit remaining: ${remaining}`);
        
        if (response.status === 429) {
          if (attempt === maxRetries) {
            throw new Error('Rate limit exceeded after max retries');
          }
          
          // Get retry delay from header or calculate exponential backoff
          const retryAfter = response.headers.get('Retry-After');
          const baseDelay = retryAfter 
            ? parseInt(retryAfter, 10) * 1000 
            : Math.pow(2, attempt) * 1000;
          
          // Add jitter (0-500ms) to prevent thundering herd
          const jitter = Math.random() * 500;
          const delay = baseDelay + jitter;
          
          console.log(`Rate limited. Retrying in ${delay}ms...`);
          await new Promise(resolve => setTimeout(resolve, delay));
          continue;
        }
        
        return response;
      }
    }
    
    // Usage with the CheckVehicles API
    async function checkVehicle(registration) {
      const response = await fetchWithRetry(
        `${API_URL}/v1/check`,
        {
          method: 'POST',
          headers: {
            'Authorization': `Bearer ${API_KEY}`,
            'Content-Type': 'application/json',
          },
          body: JSON.stringify({ registration, type: 'maxi-plus' }),
        }
      );
      
      return response.json();
    }

    Example 429 Response

    HTTP/1.1 429 Too Many Requests
    Content-Type: application/json
    X-RateLimit-Remaining: 0
    Retry-After: 45
    
    {
      "error": "Rate limit exceeded",
      "code": "RATE_LIMITED",
      "retryAfter": 45,
      "message": "You have exceeded the rate limit of 100 requests per minute"
    }
    Enterprise

    Need Higher Limits?

    Enterprise customers can request custom rate limits, dedicated infrastructure, and priority support. Contact us to discuss your requirements.

    Testing & Validation

    Validate your integration before going live with production checks

    Free Validation Endpoints

    Use these endpoints to verify your authentication and billing setup without consuming credits:

    GET
    /v1/balanceReturns current balance - validates API key authentication
    Free
    GET
    /v1/billingReturns billing status - checks all API requirements
    Free
    GET
    /v1/reportsLists your reports - validates read permissions
    Free

    Integration Validation Script

    Run this script to verify your API setup is correct before making paid checks:

    // Validate your API integration without consuming credits
    async function validateApiSetup() {
      try {
        // Step 1: Check authentication
        const balanceResponse = await fetch(`${API_URL}/v1/balance`, {
          headers: { 'Authorization': `Bearer ${API_KEY}` }
        });
        
        if (balanceResponse.status === 401) {
          console.error('❌ Authentication failed - check your API key');
          return false;
        }
        
        const balance = await balanceResponse.json();
        console.log('✅ Authentication successful');
        console.log(`   Balance: £${balance.balance}`);
        
        // Step 2: Check billing status
        const billingResponse = await fetch(`${API_URL}/v1/billing`, {
          headers: { 'Authorization': `Bearer ${API_KEY}` }
        });
        
        const billing = await billingResponse.json();
        console.log('✅ Billing endpoint accessible');
        console.log(`   Auto top-up: ${billing.auto_topup?.enabled ? 'Enabled' : 'Disabled'}`);
        console.log(`   Card saved: ${billing.payment_method?.has_card ? 'Yes' : 'No'}`);
        
        // Step 3: Verify minimum requirements
        if (balance.balance < 100) {
          console.warn('⚠️  Balance below £100 minimum for API access');
        }
        
        if (!billing.auto_topup?.enabled) {
          console.warn('⚠️  Auto top-up must be enabled for API access');
        }
        
        console.log('\n✅ API validation complete - ready for live checks');
        return true;
        
      } catch (error) {
        console.error('❌ Validation failed:', error.message);
        return false;
      }
    }
    
    // Run validation
    validateApiSetup();

    Testing with Real Vehicles

    For a low-cost way to test the full check flow, use a Maxi check (from £0.50) on any real UK registration. This validates your complete integration including:

    • Request/response parsing
    • Credit deduction flow
    • Report data structure
    • Error handling

    Pre-Production Checklist

    1
    API key stored securely (not in client-side code)
    Critical
    2
    Authentication errors handled gracefully
    Critical
    3
    Rate limit handling with exponential backoff
    Critical
    4
    402 errors trigger balance top-up flow
    5
    Response data parsed and validated
    6
    Low balance warnings monitored
    7
    Error responses logged for debugging
    8
    Report IDs stored for future reference

    API Explorer

    Test API endpoints directly from your browser

    Webhooks

    Receive real-time notifications when events occur

    Configure webhooks in your Settings page to receive HTTP POST callbacks when certain events occur.

    Available Events

    check.completed
    Triggered when a vehicle check is completed successfully

    Webhook Payload Example

    {
      "event": "check.completed",
      "timestamp": "2024-01-15T10:30:00Z",
      "data": {
        "report_id": "550e8400-e29b-41d4-a716-446655440000",
        "registration": "AB12CDE",
        "check_type": "full",
        "make": "BMW",
        "model": "3 Series",
        "year": 2019
      }
    }

    Security

    Each webhook includes a signature header for verification. Always validate the signature before processing webhook payloads to ensure they came from CheckVehicles.