KPI Tracker API

Mortgage pipeline tracking with A/B testing and UTM campaign attribution

๐Ÿ” Authentication

All endpoints require an API key in the Authorization header:

Authorization: Bearer sk_live_your_api_key_here

POST/api/events

Create a new lead event with full tracking support

Required Fields

organization_idrequired

string

Your organization ID

contact_idrequired

string

Unique lead identifier

event_typerequired

enum

Pipeline stage

timestamprequired

ISO 8601

When event occurred

๐Ÿ“Š Campaign Tracking (A/B Testing)

campaignoptional

string

A/B test variant (e.g., 'Brand Hug', 'Control')

lead_sourceoptional

string

Lead origin (e.g., 'Google Ads')

lead_typeoptional

enum

'Purchase' or 'Refinance'

๐ŸŽฏ utm_content (A/B Testing)

Track different ad variations to see which performs better

utm_contentoptional

string

A/B test variant (e.g., 'ad_variant_a', 'headline_discount')

Example Request

{
  "organization_id": "rate-com",
  "contact_id": "lead-12345",
  "event_type": "lead_created",
  "timestamp": "2025-01-29T10:00:00Z",
  "agent_email": "loan.officer@rate.com",
  "value": 350000,
  "lead_type": "Purchase",
  "campaign": "Brand Hug",
  "utm_content": "ad_variant_a"
}

๐Ÿงช A/B Testing with utm_content

Test different ad variations to see which performs better:

Variant A:

{
  "utm_content": "headline_discount"
}

Variant B:

{
  "utm_content": "headline_speed"
}

GET/api/events

Query lead events with filters

Query Parameters:

organization_id
contact_id
event_type
agent_email
start_date
end_date
limit= 10
GET /api/events?organization_id=rate-com&event_type=lead_created&limit=50

GET/api/stats

Get aggregated KPI statistics

Required: organization_id

GET /api/stats?organization_id=rate-com

๐Ÿ“‹ Mortgage Pipeline Event Types

lead_created

Lead entered system

contact_attempt

Agent attempted contact

account_created

Online account created

application_completed

Digital mortgage app done

credit_pulled

Credit report pulled

pre_approval_generated

Pre-approval letter (Purchase)

loan_locked

Interest rate locked

loan_funded

Loan closed and funded

lost

Deal lost

๐Ÿ“Š Interactive Dashboard

View real-time KPIs, funnel analysis, and A/B test comparisons

Open Dashboard โ†’