Skip to content

Lead Statistics API

Quick endpoint to check lead counts and distribution

Overview

The /api/admin/lead-stats endpoint provides a quick overview of your lead database - total counts, breakdowns by status, trade, and city, plus recent additions. This is useful for admins monitoring lead generation and coverage.

What It Returns

Total Counts

  • Total leads: All leads in your database across all statuses and locations
  • Leads with email: How many leads have contact email addresses
  • Enriched leads: Leads that have been through email enrichment
  • Pending enrichment: Leads waiting to be enriched with email data

By Status

Lead counts grouped by status (e.g., new, contacted, converted, archived).

By Trade

Lead counts grouped by trade type (HVAC, plumbing, electrical, etc.), ordered by most common trades.

Top Cities

The top 20 cities by lead count, showing geographic distribution of your leads.

Recent Leads

The 10 most recently added leads with their basic information.

Email Enrichment

BlueClerk automatically enriches leads with contact emails after scraping:

  • After Google Places scraping completes, any remaining cron time is used for enrichment
  • Visits homepage + /contact page of lead websites
  • Extracts emails from mailto: links and email patterns
  • Updates lead records with found contact information

This happens automatically during the scraping cron job, using leftover time after Google Places API calls complete.

Example Usage

GET /api/admin/lead-stats

Returns:

{
  "total": 5234,
  "withEmail": 3876,
  "enriched": 4102,
  "pendingEnrichment": 1132,
  "byStatus": {
    "new": 2341,
    "contacted": 1523,
    "converted": 892
  },
  "byTrade": {
    "hvac": 1245,
    "plumbing": 987,
    "electrical": 876
  },
  "topCities": [
    { "city": "Austin, TX", "count": 456 },
    { "city": "Dallas, TX", "count": 423 }
  ],
  "recent": [...]
}

Tips

  • Check this endpoint to monitor lead generation health
  • Compare withEmail to total to gauge enrichment effectiveness
  • Watch pendingEnrichment to see how much work remains
  • Use byTrade to identify which trades need more lead coverage

Was this article helpful?

Still need help?

Contact Support →