LendWorksLendWorksDocs

Analytics

Access KPIs, pipeline metrics, and team leaderboards for your organization.

The analytics API provides real-time reporting on your organization's lending performance, pipeline health, and team rankings.

KPIs

GET /v1/analytics/kpis

Returns key performance indicators for the current month with period-over-period comparison.

Example Request

curl -H "Authorization: Bearer lw_live_xxxx" \
     https://api.lend.works/v1/analytics/kpis

Example Response

{
  "data": {
    "type": "kpis",
    "attributes": {
      "leadsCreated": {
        "current": 142,
        "previous": 128,
        "delta": 14,
        "deltaPercent": 10.9
      },
      "opportunitiesSubmitted": {
        "current": 48,
        "previous": 52,
        "delta": -4,
        "deltaPercent": -7.7
      },
      "dealsFunded": {
        "current": 18,
        "previous": 15,
        "delta": 3,
        "deltaPercent": 20.0
      },
      "fundedAmount": {
        "current": 4500000,
        "previous": 3750000,
        "delta": 750000,
        "deltaPercent": 20.0
      },
      "commissionEarned": {
        "current": 142500,
        "previous": 118750,
        "delta": 23750,
        "deltaPercent": 20.0
      },
      "pipelineConversion": {
        "current": 12.7,
        "previous": 11.7,
        "delta": 1.0,
        "deltaPercent": 8.5
      }
    }
  },
  "meta": {
    "requestId": "d43e53f6-a7b8-4c90-1234-567890123def"
  }
}

Each metric includes:

FieldTypeDescription
currentnumberValue for the current period
previousnumberValue for the previous period
deltanumberAbsolute change
deltaPercentnumberPercentage change

Pipeline Metrics

GET /v1/analytics/pipeline

Returns pipeline stage metrics showing deal flow, conversion rates, and bottlenecks.

Example Request

curl -H "Authorization: Bearer lw_live_xxxx" \
     https://api.lend.works/v1/analytics/pipeline

Example Response

{
  "data": {
    "type": "pipeline",
    "attributes": {
      "stages": [
        {
          "stageId": "a1b2c3d4-...",
          "stageLabel": "New Lead",
          "count": 42,
          "totalAmount": 10500000,
          "avgDaysInStage": 1.2,
          "conversionRateToNext": 72.0
        },
        {
          "stageId": "b2c3d4e5-...",
          "stageLabel": "Qualified",
          "count": 28,
          "totalAmount": 7000000,
          "avgDaysInStage": 3.5,
          "conversionRateToNext": 64.0
        },
        {
          "stageId": "c3d4e5f6-...",
          "stageLabel": "Submitted",
          "count": 18,
          "totalAmount": 4500000,
          "avgDaysInStage": 5.1,
          "conversionRateToNext": 55.0
        },
        {
          "stageId": "d4e5f6g7-...",
          "stageLabel": "Approved",
          "count": 8,
          "totalAmount": 2000000,
          "avgDaysInStage": 2.0,
          "conversionRateToNext": 87.5
        },
        {
          "stageId": "e5f6g7h8-...",
          "stageLabel": "Funded",
          "count": 7,
          "totalAmount": 1750000,
          "avgDaysInStage": 0,
          "conversionRateToNext": 0
        }
      ]
    }
  },
  "meta": {
    "requestId": "e54f64a7-b8c9-4d01-2345-678901234ef0"
  }
}

Leaderboard

GET /v1/analytics/leaderboard

Returns a ranked list of advisors by a chosen performance metric.

Query Parameters

ParameterTypeDefaultOptionsDescription
metricenumdeals_fundedcommission_earned, deals_funded, leads_converted, funded_amountRanking metric
periodenumthis_monththis_week, this_month, this_quarter, ytdTime period
limitinteger101-50Number of entries

Example Request

curl -H "Authorization: Bearer lw_live_xxxx" \
     "https://api.lend.works/v1/analytics/leaderboard?metric=commission_earned&period=this_month&limit=5"

Example Response

{
  "data": {
    "type": "leaderboard",
    "attributes": {
      "entries": [
        {
          "rank": 1,
          "advisorId": "e5f6g7h8-...",
          "advisorName": "Mike Johnson",
          "value": 42000,
          "trend": 15.3
        },
        {
          "rank": 2,
          "advisorId": "a9b8c7d6-...",
          "advisorName": "Sarah Williams",
          "value": 38500,
          "trend": 8.2
        },
        {
          "rank": 3,
          "advisorId": "f1e2d3c4-...",
          "advisorName": "David Park",
          "value": 31000,
          "trend": -2.1
        }
      ]
    }
  },
  "meta": {
    "requestId": "f65a75b8-c9d0-4e12-3456-789012345f01"
  }
}
FieldTypeDescription
rankintegerPosition on the leaderboard
advisorIdUUIDAdvisor's user ID
advisorNamestringAdvisor's display name
valuenumberMetric value
trendnumberPercentage change from previous period

Errors

StatusCodeDescription
403FORBIDDENAPI key lacks read permission