Overview
The Reports API provides statistical insights and analytics for church operations. It includes general dashboard stats, pastor-specific metrics, and system status monitoring.Authentication
All endpoints require authentication with thechurch.read permission:
Get Dashboard Stats
GET /api/reports
Retrieve comprehensive dashboard statistics for a church or globally
church.read
Query Parameters
Filter stats by church ID. Required for non-super admins.
Alternative parameter for church_id
Access Levels
- Church Members: Must provide church_id, see stats for their church only
- Super Admins: Can omit church_id to see global stats across all churches
Request (Church-Specific)
Response (Church-Specific)
Request (Global - Super Admin Only)
Response (Global Stats)
Database Status
Status of main database: “online” or “error”
Status of music database: “online” or “error”
Get Pastor Stats
GET /api/reports/pastor_stats
Retrieve leadership-focused statistics and insights
church.read
Use Case: Designed for pastors and church leaders to get high-level ministry insights.
Query Parameters
Church ID to get stats for. Required for non-super admins.
Alternative parameter for church_id
Request
Response
Key Metrics Explained
Percentage of active members vs. total members
Percentage of members actively involved in teams
Average number of members per team
Church Context Resolution
For non-super admins, church_id is resolved automatically:- Query parameter:
church_idorchurchId - User’s church: From authenticated member data
- Required: Returns 400 error if church cannot be determined
Database Status Monitoring
All report responses include database health status:Status Values
| Status | Description |
|---|---|
online | Database is connected and responsive |
error | Database connection failed or timeout |
Example Status Check
Report Types Comparison
| Report | Audience | Focus | Church-Specific |
|---|---|---|---|
| Dashboard Stats | All roles | General metrics | Yes |
| Pastor Stats | Leadership | Ministry insights | Yes |
| Global Stats | Super Admin | Platform-wide | No |
Use Cases
Monthly Ministry Review
Use pastor stats to review:- Member growth trends
- Team engagement rates
- Upcoming events planning
- Pending approvals
Platform Health Check (Admin)
Use global stats to monitor:- All churches status
- System-wide metrics
- Database health
- Storage usage
Dashboard Widget
Use dashboard stats for quick overview:- Active member count
- Upcoming meetings
- Recent activity
Error Responses
Missing Church Context (400)Error Codes
| Code | Description |
|---|---|
| 400 | Bad Request - Missing church_id for non-super admins |
| 401 | Unauthorized - Invalid or missing token |
| 403 | Forbidden - Insufficient permissions or missing church context |
| 500 | Internal Server Error |
Performance Notes
- Reports are calculated in real-time
- Large churches (500+ members) may see 1-2 second response times
- Consider caching results for 5-15 minutes on the client side
- Global stats are more expensive to compute
Related APIs
Churches
Manage church organizations
People
View detailed member data
Teams
Analyze team engagement
Calendar
Review upcoming events