Skip to content

Analytics API

import { Badge } from ‘@astrojs/starlight/components’;

Get appointment statistics for the clinic dashboard.

Auth: Required

Query params:

Param Description Default
start Start date (YYYY-MM-DD) 30 days ago
end End date (YYYY-MM-DD) Today

Response 200:

{
"summary": {
"total": 87,
"completed": 74,
"cancelled": 8,
"noShows": 3,
"pending": 2,
"noShowRate": "3.4",
"cancellationRate": "9.2"
},
"bookingsByDay": [
{ "date": "2026-05-01", "count": 4 },
{ "date": "2026-05-02", "count": 6 }
],
"bookingsByHour": [
{ "hour": "08:00", "count": 3 },
{ "hour": "09:00", "count": 12 },
{ "hour": "10:00", "count": 15 }
],
"doctorUtilization": [
{ "name": "Dr. García", "count": 42 },
{ "name": "Dra. López", "count": 45 }
]
}

Rates are percentage strings ("3.4" = 3.4%).

bookingsByHour shows which hours of day are busiest — useful for staffing decisions.

doctorUtilization counts total appointments per doctor in the date range.

Errors:

Status Code
403 PLAN_UPGRADE_REQUIRED