Skip to main content

Dashboard Overview

Returns summary KPIs, disposition breakdown, quality metrics, and tool usage for a given date range. All data comes from the pre-aggregated call_stats_daily table, making queries fast even over large date ranges.

Endpoint

PropertyValue
Function Namedashboard-overview
HTTP MethodGET
AuthenticationSupabase JWT (Bearer token)

Request

Headers

Authorization: Bearer <supabase_jwt_token>
Content-Type: application/json

Query Parameters

ParameterTypeRequiredDefaultDescription
periodstringNo7dtoday, 7d, 30d, 90d, or custom
start_datestring (ISO date)If period=custom--Start date YYYY-MM-DD
end_datestring (ISO date)If period=custom--End date YYYY-MM-DD
campaign_idstring (UUID)No--Filter to a specific campaign
client_idstring (UUID)No--Filter to a specific client

Response

Success (200)

{
"period": {
"start_date": "2026-02-10",
"end_date": "2026-02-16",
"label": "7d"
},
"summary": {
"total_calls": 150,
"completed_calls": 120,
"failed_calls": 5,
"connected_calls": 110,
"contact_rate": 73.3, // % (connected / total)
"conversations_had": 85,
"meetings_booked": 12,
"qualified_leads": 25,
"avg_duration_seconds": 180,
"total_duration_seconds": 21600,
"positive_sentiment_pct": 60.5, // %
"neutral_sentiment_pct": 30.2, // %
"negative_sentiment_pct": 9.3, // %
"overall_conversion_rate": 8.0 // % (meetings / total)
},
"disposition_breakdown": {
"voicemail": 15,
"callback_requested": 8,
"not_interested": 20,
"wrong_number": 3,
"dnc_requested": 1,
"gatekeeper_blocked": 7,
"no_answer": 25,
"conversation": 85,
"appointment_booked": 12
},
"quality": {
"avg_talk_ratio": 0.5500, // 0-1 decimal
"avg_listen_ratio": 0.4500,
"avg_script_adherence": 0.7200, // 0-1 decimal
"total_interruptions": 45,
"avg_interruptions_per_call": 0.38,
"total_objections_encountered": 30,
"total_objections_handled": 18,
"objection_handling_rate": 60.0, // %
"total_buying_signals": 40
},
"tool_usage": {
"emails_sent": 15,
"sms_sent": 5
}
}

Error Responses

StatusCondition
401Missing or invalid authorization header
403User exists but has no agency_id
405HTTP method is not GET
500Failed to query call_stats_daily

Behavior

  • Authenticates the user via Supabase JWT and resolves their agency_id from the users table.
  • Resolves the date range from the period parameter (e.g., 7d = last 7 days including today).
  • Queries call_stats_daily for all rows matching the agency, date range, and optional campaign/client filters.
  • Aggregates all matching rows into a single summary using sums for count fields and weighted averages (weighted by completed_calls) for ratio fields (avg_talk_ratio, avg_listen_ratio, avg_script_adherence).
  • Computes derived rates: contact_rate (connected/total), overall_conversion_rate (meetings/total), sentiment percentages, avg_interruptions_per_call, and objection_handling_rate.

Database Tables

TableOperationDescription
usersReadFetches user profile to determine agency_id
call_stats_dailyReadPre-aggregated daily stats, filtered by agency/date/campaign/client

External APIs

None.