Skip to main content
GET
/
v1
/
analytics
/
dashboard
Dashboard Overview
curl --request GET \
  --url https://api.leadmagic.io/v1/analytics/dashboard \
  --header 'X-API-Key: <api-key>'
{
  "user": {
    "id": "user_abc123",
    "email": "developer@leadmagic.io"
  },
  "credits": {
    "current": 15432.5,
    "formatted": "$154.33"
  },
  "rate_limit": {
    "minute": {
      "limit": 300,
      "used": 45,
      "remaining": 255,
      "utilization": 15
    },
    "daily": {
      "limit": 500000,
      "used": 12500,
      "remaining": 487500,
      "utilization": 2.5
    }
  },
  "concurrency": {
    "current": 0,
    "peak": 23,
    "active_reservations": 0
  },
  "stats": {
    "today": {
      "requests": 1250,
      "credits": 875.5,
      "chargeable_requests": 1100,
      "chargeable_rate": 88,
      "unique_products": 5
    },
    "this_week": {
      "requests": 8500,
      "credits": 5200.25,
      "chargeable_requests": 7200,
      "chargeable_rate": 84.7,
      "unique_products": 8
    },
    "this_month": {
      "requests": 45000,
      "credits": 28500,
      "chargeable_requests": 38000,
      "chargeable_rate": 84.4,
      "unique_products": 12
    }
  }
}

Documentation Index

Fetch the complete documentation index at: https://leadmagic.io/docs/llms.txt

Use this file to discover all available pages before exploring further.

Usage Analytics

Get detailed insights into your API usage, credit consumption, and performance metrics. All analytics endpoints are free and don’t consume credits.
100% Free: All analytics endpoints consume zero credits and have no rate limits. Use them to build dashboards, monitoring systems, and usage alerts.

Quick Reference

EndpointMethodDescriptionBest For
/v1/analytics/dashboardGETReal-time account statusLive dashboards, health checks
/v1/analytics/usageGETDaily usage summaryWeekly/monthly reports
/v1/analytics/productsGETPer-product breakdownCost optimization
/v1/analytics/creditsGETCredit consumption historySpend tracking
/v1/analytics/summaryGETAll-time statisticsAccount overview
/v1/analytics/dailyGETDaily performance metricsSLA monitoring
/v1/analytics/day/:dateGETSingle day breakdownDebugging, audits

Dashboard

Get a real-time snapshot of your account status including credits, rate limits, and usage statistics.
GET /v1/analytics/dashboard
curl 'https://api.leadmagic.io/v1/analytics/dashboard' \
  -H 'X-API-Key: YOUR_API_KEY'

Response

{
  "user": {
    "id": "user_abc123",
    "email": "developer@leadmagic.io"
  },
  "credits": {
    "current": 15432.50,
    "formatted": "$154.33"
  },
  "rate_limit": {
    "minute": {
      "limit": 300,
      "used": 45,
      "remaining": 255,
      "utilization": 15.0
    },
    "daily": {
      "limit": 500000,
      "used": 12500,
      "remaining": 487500,
      "utilization": 2.5
    }
  },
  "concurrency": {
    "current": 0,
    "peak": 23,
    "active_reservations": 0
  },
  "stats": {
    "today": {
      "requests": 1250,
      "credits": 875.50,
      "chargeable_requests": 1100,
      "chargeable_rate": 88.0,
      "unique_products": 5
    },
    "this_week": {
      "requests": 8500,
      "credits": 5200.25,
      "chargeable_requests": 7200,
      "chargeable_rate": 84.7,
      "unique_products": 8
    },
    "this_month": {
      "requests": 45000,
      "credits": 28500.00,
      "chargeable_requests": 38000,
      "chargeable_rate": 84.4,
      "unique_products": 12
    }
  }
}

Response Fields

user
object
required
Your account information
credits
object
required
Current credit balance
rate_limit
object
required
Real-time rate limit status
concurrency
object
required
Concurrent request tracking
stats
object
required
Usage statistics for today, this week, and this month

Usage Summary

Get aggregated usage metrics over a time period with daily breakdown.
GET /v1/analytics/usage?days=30
days
number
default:"30"
Number of days to include (1-90)

Response

{
  "period": {
    "start": "2026-10-02",
    "end": "2026-11-01",
    "days": 30
  },
  "summary": {
    "total_requests": 45000,
    "chargeable_requests": 38000,
    "total_credits": 28500.00,
    "avg_credits_per_request": 0.63,
    "chargeable_rate": 84.4,
    "unique_products": 12
  },
  "daily": [
    {
      "date": "2026-11-01",
      "total_requests": 1250,
      "chargeable_requests": 1100,
      "total_credits": 875.50,
      "unique_products_used": 5
    }
  ]
}
Chargeable Rate shows what percentage of your requests consumed credits. A lower rate means more free results (unknown validations, not-found responses, etc.).

Products Breakdown

Get per-product usage with requests, credits, and success rates. Essential for cost optimization.
GET /v1/analytics/products?days=30
days
number
default:"30"
Number of days to include (1-90)

Response

{
  "period": {
    "start": "2026-10-02",
    "end": "2026-11-01",
    "days": 30
  },
  "products": {
    "email_validation": {
      "total_requests": 20000,
      "total_credits": 5000.00,
      "successful_requests": 19500,
      "failed_requests": 500,
      "success_rate": 97.5,
      "avg_credits_per_request": 0.25
    },
    "email_finder": {
      "total_requests": 10000,
      "total_credits": 8500.00,
      "successful_requests": 8500,
      "failed_requests": 1500,
      "success_rate": 85.0,
      "avg_credits_per_request": 0.85
    }
  },
  "daily": [...]
}
Success rate means we found data. For email finder, 85% success means 85% of lookups returned an email. You only pay for successful results.

Credit History

Get credit consumption history with daily breakdown. Perfect for spend tracking and budgeting.
GET /v1/analytics/credits?days=30
days
number
default:"30"
Number of days to include (1-90)

Response

{
  "period": {
    "start": "2026-10-02",
    "end": "2026-11-01",
    "days": 30
  },
  "summary": {
    "total_credits": 28500.00,
    "total_requests": 45000,
    "chargeable_requests": 38000,
    "avg_credits_per_request": 0.63,
    "chargeable_rate": 84.4
  },
  "daily": [
    {
      "date": "2026-11-01",
      "total_credits": 875.50,
      "total_requests": 1250,
      "chargeable_requests": 1100
    }
  ]
}

All-Time Summary

Get lifetime statistics for your account, or specify a custom date range.
GET /v1/analytics/summary
GET /v1/analytics/summary?start_date=2026-10-01&end_date=2026-11-01
start_date
string
Start date (YYYY-MM-DD format). Optional.
end_date
string
End date (YYYY-MM-DD format). Optional.

Response

{
  "total_api_requests": 1250000,
  "total_credits_consumed": 425000.50,
  "unique_products_used": 15,
  "successful_requests": 1150000,
  "failed_requests": 100000,
  "success_rate": 92.0,
  "avg_response_time_ms": 245,
  "first_request": "2023-06-15T10:30:00.000Z",
  "last_request": "2026-11-01T14:22:00.000Z"
}

Daily Metrics

Get detailed daily metrics including latency percentiles and error rates. Essential for SLA monitoring.
GET /v1/analytics/daily?days=30
days
number
default:"30"
Number of days to include (1-90)

Response

{
  "period": {
    "start": "2026-10-02",
    "end": "2026-11-01",
    "days": 30
  },
  "data": [
    {
      "date": "2026-11-01",
      "total_requests": 1250,
      "successful_requests": 1175,
      "failed_requests": 75,
      "total_credits": 875.50,
      "p50_latency_ms": 180,
      "p95_latency_ms": 450,
      "p99_latency_ms": 890,
      "error_rate": 6.0
    }
  ]
}

Latency Percentiles

MetricDescription
p50_latency_msMedian response time (50th percentile)
p95_latency_ms95% of requests faster than this
p99_latency_ms99% of requests faster than this

Day Breakdown

Get per-product breakdown for a specific day. Perfect for debugging and audits.
GET /v1/analytics/day/2026-11-01

Response

{
  "date": "2026-11-01",
  "summary": {
    "total_credits": 875.50,
    "total_requests": 1250,
    "products_count": 8
  },
  "products": [
    {
      "product_id": "email_validation",
      "requests": 500,
      "credits": 125.00,
      "credits_percentage": 14.29,
      "avg_credits_per_request": 0.25,
      "max_credits": 0.25
    },
    {
      "product_id": "email_finder",
      "requests": 350,
      "credits": 297.50,
      "credits_percentage": 34.00,
      "avg_credits_per_request": 0.85,
      "max_credits": 1.00
    }
  ]
}

Practical Examples

Build a Real-Time Dashboard

Fetch all metrics in parallel for a comprehensive dashboard:
const headers = { 'X-API-Key': process.env.LEADMAGIC_API_KEY };

async function getDashboardMetrics() {
  const [dashboard, usage, products, daily] = await Promise.all([
    fetch('https://api.leadmagic.io/v1/analytics/dashboard', { headers }),
    fetch('https://api.leadmagic.io/v1/analytics/usage?days=7', { headers }),
    fetch('https://api.leadmagic.io/v1/analytics/products?days=7', { headers }),
    fetch('https://api.leadmagic.io/v1/analytics/daily?days=7', { headers })
  ]).then(responses => Promise.all(responses.map(r => r.json())));
  
  return {
    // Account health
    credits: dashboard.data.credits.current,
    creditsFormatted: dashboard.data.credits.formatted,
    
    // Rate limits
    minuteUtilization: dashboard.data.rate_limit.minute.utilization,
    dailyUtilization: dashboard.data.rate_limit.daily.utilization,
    
    // Weekly stats
    weeklyRequests: usage.data.summary.total_requests,
    weeklyCredits: usage.data.summary.total_credits,
    chargeableRate: usage.data.summary.chargeable_rate,
    
    // Top products by spend
    topProducts: Object.entries(products.data.products)
      .sort((a, b) => b[1].total_credits - a[1].total_credits)
      .slice(0, 5),
    
    // Performance
    avgLatency: daily.data.data.reduce((sum, d) => sum + d.p50_latency_ms, 0) / daily.data.data.length,
    avgErrorRate: daily.data.data.reduce((sum, d) => sum + d.error_rate, 0) / daily.data.data.length
  };
}

Best Practices

Analytics endpoints are free, but caching improves your dashboard performance:
let cache = { data: null, timestamp: 0 };
const CACHE_TTL = 60 * 1000; // 1 minute

async function getCachedDashboard() {
  if (cache.data && Date.now() - cache.timestamp < CACHE_TTL) {
    return cache.data;
  }
  
  const response = await fetch('https://api.leadmagic.io/v1/analytics/dashboard', {
    headers: { 'X-API-Key': process.env.LEADMAGIC_API_KEY }
  });
  
  cache = { data: await response.json(), timestamp: Date.now() };
  return cache.data;
}
Every API response includes X-Credits-Remaining — use this instead of polling the dashboard:
const response = await fetch('https://api.leadmagic.io/v1/people/email-validation', {
  method: 'POST',
  headers: { 'X-API-Key': apiKey, 'Content-Type': 'application/json' },
  body: JSON.stringify({ email: 'test@example.com' })
});

const creditsRemaining = response.headers.get('X-Credits-Remaining');
const requestId = response.headers.get('X-Request-Id');

console.log(`Credits after request: ${creditsRemaining}`);
Fetch multiple analytics endpoints in parallel:
const [dashboard, products, daily] = await Promise.all([
  fetch('/v1/analytics/dashboard', { headers }),
  fetch('/v1/analytics/products?days=30', { headers }),
  fetch('/v1/analytics/daily?days=30', { headers })
]).then(responses => Promise.all(responses.map(r => r.json())));
Schedule weekly reports using cron or serverless functions:
// Weekly summary report
async function generateWeeklyReport() {
  const [usage, products] = await Promise.all([
    fetch('/v1/analytics/usage?days=7', { headers }).then(r => r.json()),
    fetch('/v1/analytics/products?days=7', { headers }).then(r => r.json())
  ]);
  
  return {
    period: usage.data.period,
    totalRequests: usage.data.summary.total_requests,
    totalCredits: usage.data.summary.total_credits,
    topProducts: Object.entries(products.data.products)
      .sort((a, b) => b[1].total_credits - a[1].total_credits)
      .slice(0, 5)
      .map(([id, stats]) => ({ id, ...stats }))
  };
}

Check Credits

Simple endpoint to check your current balance.

Rate Limits

Learn about rate limiting and how to stay within limits.

Authorizations

X-API-Key
string
header
required

Your LeadMagic API key. Header name is case-insensitive (X-API-Key, X-API-KEY, x-api-key all work).

Response

Dashboard data retrieved successfully

user
object
credits
object
rate_limit
object
concurrency
object
stats
object