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_idrequiredstring
Your organization ID
contact_idrequiredstring
Unique lead identifier
event_typerequiredenum
Pipeline stage
timestamprequiredISO 8601
When event occurred
๐ Campaign Tracking (A/B Testing)
campaignoptionalstring
A/B test variant (e.g., 'Brand Hug', 'Control')
lead_sourceoptionalstring
Lead origin (e.g., 'Google Ads')
lead_typeoptionalenum
'Purchase' or 'Refinance'
๐ฏ utm_content (A/B Testing)
Track different ad variations to see which performs better
utm_contentoptionalstring
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_idcontact_idevent_typeagent_emailstart_dateend_datelimit= 10GET /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_createdLead entered system
contact_attemptAgent attempted contact
account_createdOnline account created
application_completedDigital mortgage app done
credit_pulledCredit report pulled
pre_approval_generatedPre-approval letter (Purchase)
loan_lockedInterest rate locked
loan_fundedLoan closed and funded
lostDeal lost
๐ Interactive Dashboard
View real-time KPIs, funnel analysis, and A/B test comparisons
Open Dashboard โ