Dashboard Funnel
Returns conversion funnel data showing progression from total calls through to booked appointments. Includes both absolute counts at each stage and step-to-step conversion rates.
Endpoint
| Property | Value |
|---|---|
| Function Name | dashboard-funnel |
| HTTP Method | GET |
| Authentication | Supabase JWT (Bearer token) |
Request
Headers
Authorization: Bearer <supabase_jwt_token>
Content-Type: application/json
Query Parameters
| Parameter | Type | Required | Default | Description |
|---|---|---|---|---|
period | string | No | 7d | today, 7d, 30d, 90d, or custom |
start_date | string (ISO date) | If period=custom | -- | Start date YYYY-MM-DD |
end_date | string (ISO date) | If period=custom | -- | End date YYYY-MM-DD |
campaign_id | string (UUID) | No | -- | Filter to a specific campaign |
client_id | string (UUID) | No | -- | Filter to a specific client |
Response
Success (200)
{
"period": { "start_date": "2026-02-10", "end_date": "2026-02-16" },
"funnel": {
"total_calls": 150,
"connected": 110,
"conversation": 85,
"qualified": 25,
"appointment_booked": 12
},
"rates": {
"contact_rate": 73.3, // % total -> connected
"connected_to_conversation": 77.3, // % connected -> conversation
"conversation_to_qualified": 29.4, // % conversation -> qualified
"qualified_to_booked": 48.0, // % qualified -> booked
"overall_conversion": 8.0 // % total -> booked
}
}
Funnel Stages
Total Calls (150) -> Connected (110) -> Conversation (85) -> Qualified (25) -> Booked (12)
73.3% 77.3% 29.4% 48.0%
Error Responses
| Status | Condition |
|---|---|
| 401 | Missing or invalid authorization header |
| 403 | User exists but has no agency_id |
| 405 | HTTP method is not GET |
| 500 | Failed to query call_stats_daily |
Behavior
- Authenticates the user via Supabase JWT and resolves their
agency_id. - Queries
call_stats_dailyselecting only the funnel-relevant columns:total_calls,connected_calls,conversations_had,qualified_leads,meetings_booked. - Sums all matching rows to produce aggregate funnel counts.
- Computes step-to-step conversion rates. Division by zero returns
0.
Database Tables
| Table | Operation | Description |
|---|---|---|
users | Read | Fetches user profile to determine agency_id |
call_stats_daily | Read | Pre-aggregated daily stats, filtered by agency/date/campaign/client |
External APIs
None.
Related Functions
- Dashboard Overview -- Summary KPIs (call on same page load)
- Dashboard Timeseries -- Trend data (call on same page load)
- Dashboard Campaigns -- Per-campaign funnel comparison
- Frontend API Guide -- Page layout and endpoint mapping