Skip to main content
The Supervisor Reports endpoints allow supervisors and administrators to generate, retrieve, and manage detailed reports about team performance.

Generate Report

curl -X POST https://api.millenniumpotters.com/api/supervisor-reports/generate \
  -H "Authorization: Bearer YOUR_TOKEN" \
  -H "Content-Type: application/json" \
  -d '{
    "reportType": "MONTHLY",
    "periodStart": "2024-01-01T00:00:00Z",
    "periodEnd": "2024-01-31T23:59:59Z",
    "title": "January 2024 Performance Report"
  }'
Generate and save a report session with aggregated data for a specific period.

Request Body

reportType
string
required
Type of report to generate. Must be one of:
  • DAILY: Daily report
  • WEEKLY: Weekly report
  • MONTHLY: Monthly report
  • QUARTERLY: Quarterly report
  • CUSTOM: Custom date range report
periodStart
string
required
Start date and time for the report period (ISO 8601 format).
periodEnd
string
required
End date and time for the report period (ISO 8601 format).
title
string
Optional custom title for the report. If not provided, a default title will be generated.
supervisorId
string
ADMIN only: Supervisor ID to generate the report for. Regular supervisors cannot specify this field.

Response

id
string
Unique identifier for the report session.
supervisorId
string
ID of the supervisor who owns this report.
supervisor
object
Supervisor information.
reportType
string
Type of report (DAILY, WEEKLY, MONTHLY, QUARTERLY, CUSTOM).
title
string
Report title.
periodStart
string
Report period start date.
periodEnd
string
Report period end date.
totalOfficers
number
Total number of credit officers under this supervisor.
totalUnions
number
Total number of unions managed by the team.
totalMembers
number
Total number of union members.
totalLoans
number
Total number of loans in the period.
activeLoans
number
Number of currently active loans.
completedLoans
number
Number of completed loans.
defaultedLoans
number
Number of defaulted or written-off loans.
totalDisbursed
number
Total amount disbursed in the period.
totalRepaid
number
Total amount repaid in the period.
totalOutstanding
number
Total outstanding loan amount.
collectionRate
number
Collection rate as a percentage (0-100).
reportData
object
Complete dashboard data snapshot including officer performance, loan distribution, and monthly trends.
officerMetrics
array
Array of officer performance metrics.
generatedAt
string
Timestamp when the report was generated.

Required Permissions

  • SUPERVISOR: Can generate reports for their own team
  • ADMIN: Can generate reports for any supervisor by providing supervisorId

List Report Sessions

curl https://api.millenniumpotters.com/api/supervisor-reports/sessions?page=1&limit=10 \
  -H "Authorization: Bearer YOUR_TOKEN"
Retrieve all saved report sessions for a supervisor with pagination.

Query Parameters

page
number
default:"1"
Page number for pagination.
limit
number
default:"10"
Number of reports per page.
supervisorId
string
ADMIN only: Filter reports by supervisor ID.

Response

reports
array
Array of report session summaries.
pagination
object
Pagination metadata.

Get Report Session

curl https://api.millenniumpotters.com/api/supervisor-reports/sessions/clx123abc \
  -H "Authorization: Bearer YOUR_TOKEN"
Retrieve a specific report session by ID with complete data.

Path Parameters

id
string
required
The unique identifier of the report session.

Query Parameters

supervisorId
string
ADMIN only: Supervisor ID to verify ownership.

Response

Returns the complete report session object (same structure as the Generate Report response).

Delete Report Session

curl -X DELETE https://api.millenniumpotters.com/api/supervisor-reports/sessions/clx123abc \
  -H "Authorization: Bearer YOUR_TOKEN"
Delete a saved report session.

Path Parameters

id
string
required
The unique identifier of the report session to delete.

Response

success
boolean
Whether the deletion was successful.
message
string
Success message.

List Credit Officers

curl https://api.millenniumpotters.com/api/supervisor-reports/officers \
  -H "Authorization: Bearer YOUR_TOKEN"
Get all credit officers under a supervisor.

Query Parameters

supervisorId
string
ADMIN only: Get officers for a specific supervisor.

Response

Returns an array of credit officer objects.
id
string
Officer user ID.
firstName
string
Officer’s first name.
lastName
string
Officer’s last name.
name
string
Full name of the officer.
email
string
Officer’s email address.
isActive
boolean
Whether the officer account is active.
lastLoginAt
string
Timestamp of last login.
lastActivityAt
string
Timestamp of last activity.
loginCount
number
Total number of logins.
unionCount
number
Number of unions managed by this officer.

Build docs developers (and LLMs) love