Analytics & Reports
Generate detailed insights and reports with our analytics and data visualization APIs. Track performance trends, compare cohorts, and export data in multiple formats.
Generating a Report
javascript
// Generate a comprehensive school report
const report = await client.analytics.report({
school_id: 'sch_abc123',
type: 'comprehensive',
period: 'term',
compare_to: 'previous_term',
sections: [
'enrollment',
'performance',
'attendance',
'engagement',
'subject_breakdown'
],
format: 'json'
});
console.log(report.highlights);
// [
// "Overall performance improved by 4.3%",
// "Attendance rate at 94% (target: 95%)",
// "Mathematics saw the highest improvement (+8.2%)"
// ]Endpoints
GET
/v1/analytics/overviewHigh-level dashboard metrics for a school — enrollment, performance averages, attendance rates, and engagement scores.
Query Parameters
school_idstring requiredperiodstring - Time period (week,month,term,year)
GET
/v1/analytics/performanceDetailed performance analytics with breakdowns by subject, grade, class, or teacher.
Query Parameters
school_idstring requiredgroup_bystring - Grouping dimension (subject,grade,class,teacher)sort_bystring - Sort metric (score,improvement,students)periodstring - Time period
response
{
"school_id": "sch_abc123",
"period": "term",
"group_by": "subject",
"data": [
{
"subject": "mathematics",
"avg_score": 82.1,
"median_score": 84,
"pass_rate": 0.91,
"total_students": 320,
"improvement": "+8.2%",
"score_distribution": {
"A": 45, "B": 112, "C": 98, "D": 42, "F": 23
}
},
{
"subject": "english",
"avg_score": 77.8,
"median_score": 79,
"pass_rate": 0.87,
"total_students": 318,
"improvement": "+2.1%",
"score_distribution": {
"A": 32, "B": 95, "C": 118, "D": 51, "F": 22
}
}
]
}POST
/v1/analytics/reportGenerate a custom report with selected sections and export format.
Request Body
school_idstring requiredtypestring - Report type (performance,attendance,engagement,comprehensive)periodstring - Time periodcompare_tostring - Comparison periodsectionsstring[] - Sections to includeformatstring - Output format (json,csv,pdf)
GET
/v1/analytics/trendsTime-series data for charting performance, attendance, or engagement trends over time.
Query Parameters
school_idstring requiredmetricstring - Metric to track (avg_score,attendance,engagement,enrollment)granularitystring - Data point frequency (daily,weekly,monthly)date_fromstring - Start date (ISO 8601)date_tostring - End date (ISO 8601)
GET
/v1/analytics/cohortCompare performance across student cohorts — by grade, enrollment year, or custom groups.
Export Formats
json Structured data for programmatic consumption and dashboardscsv Spreadsheet-compatible format for Excel, Google Sheets, etc.pdf Formatted report with charts and tables, ready to print or share