API Reference10 min read

Leads & Sales API Endpoints

Access lead and sales data with filtering, aggregation, and statistics endpoints for CRM and advertising attribution.

leadssalesapicrm

Leads & Sales API Endpoints

The Leads and Sales APIs provide access to customer lead data (from advertising platforms, CRMs, and web forms) and sales transaction records.

List Leads

bash
GET /api/v1/leads

Query Parameters:

ParameterTypeDefaultDescription
dealershipIduuid—Filter by dealership
startDateISO date—Start of date range
endDateISO date—End of date range
statusstring—new, contacted, qualified, converted, lost
typestring—internet, phone, walk_in, chat
sourcestring—Canonical source name (e.g., "Paid Search")
limitnumber50Records per page (max 200)
offsetnumber0Pagination offset

Response:

json
{
  "leads": [
    {
      "id": "uuid",
      "dealership_id": "uuid",
      "customer_name": "John Doe",
      "customer_email": "[email protected]",
      "customer_phone": "+15551234567",
      "type": "internet",
      "status": "new",
      "source": "Paid Search",
      "source_raw": "google_ads_campaign_spring2026",
      "vehicle_interest": "2025 Toyota Camry",
      "notes": "Interested in financing options",
      "created_at": "2026-02-05T10:15:00Z",
      "updated_at": "2026-02-05T10:15:00Z"
    }
  ],
  "pagination": { "total": 156, "limit": 50, "offset": 0 }
}

Lead Statistics

bash
GET /api/v1/leads/stats

Query Parameters: Same filters as list endpoint.

Response:

json
{
  "stats": {
    "total_leads": 156,
    "by_status": {
      "new": 42, "contacted": 58, "qualified": 31, "converted": 18, "lost": 7
    },
    "by_type": {
      "internet": 89, "phone": 45, "walk_in": 15, "chat": 7
    },
    "by_source": [
      { "source": "Paid Search", "count": 67, "cost": "4500.00", "cost_per_lead": "67.16" },
      { "source": "Organic", "count": 45, "cost": "0.00", "cost_per_lead": "0.00" },
      { "source": "Direct", "count": 22, "cost": "0.00", "cost_per_lead": "0.00" }
    ],
    "conversion_rate": "11.5"
  }
}

List Sales

bash
GET /api/v1/sales

Query Parameters:

ParameterTypeDefaultDescription
dealershipIduuid—Filter by dealership
startDateISO date—Start of date range
endDateISO date—End of date range
salesPersonstring—Filter by sales person name
contractTypestring—finance, lease, cash
limitnumber50Records per page
offsetnumber0Pagination offset

Response:

json
{
  "sales": [
    {
      "id": "uuid",
      "dealership_id": "uuid",
      "vin": "1HGCM82633A004352",
      "customer_name": "Jane Smith",
      "sales_person": "Mike Johnson",
      "contract_type": "finance",
      "sale_price": "32500.00",
      "gross_profit": "2150.00",
      "trade_in_vin": "5YJSA1E21MF123456",
      "trade_in_value": "18000.00",
      "lead_id": "uuid",
      "source": "Paid Search",
      "sold_at": "2026-02-04T16:00:00Z"
    }
  ],
  "pagination": { "total": 23, "limit": 50, "offset": 0 }
}

Sales Statistics

bash
GET /api/v1/sales/stats

Query Parameters: Same filters as list endpoint.

Response:

json
{
  "stats": {
    "total_sales": 23,
    "total_revenue": "748500.00",
    "total_gross_profit": "49450.00",
    "avg_gross_profit": "2150.00",
    "by_contract_type": {
      "finance": 14, "lease": 6, "cash": 3
    },
    "by_sales_person": [
      { "name": "Mike Johnson", "count": 8, "gross": "18200.00" },
      { "name": "Sarah Lee", "count": 7, "gross": "15400.00" }
    ],
    "avg_days_to_sale": "18.5"
  }
}
Last updated: February 9, 2026