Reports Endpoints
API reference for report export operations — CSV downloads for circulation and fines data.
Reports Endpoints
Export library operational data as CSV files. These endpoints generate downloadable reports for administrative analysis.
Base Path: /api/v1/reports
All endpoints require authentication and ROLE_ADMIN or ROLE_LIBRARIAN authorization.
Export Circulation Report
GET /api/v1/reports/circulationGenerates a CSV file containing the latest 1,000 circulation transactions. The response is a downloadable file with Content-Type: text/csv.
Authorization: ROLE_ADMIN, ROLE_LIBRARIAN
CSV Columns
| Column | Description |
|---|---|
| Transaction ID | MongoDB ObjectId |
| User Name | Borrower's full name |
| User Email | Borrower's email address |
| Book Title | Title of the borrowed book |
| Barcode | Physical copy barcode |
| Issued At | ISO 8601 timestamp of checkout |
| Due Date | ISO 8601 timestamp of due date |
| Returned At | ISO 8601 timestamp or NOT RETURNED |
Response
HTTP/1.1 200 OK
Content-Type: text/csv
Content-Disposition: attachment; filename="circulation_report.csv"
Transaction ID,User Name,User Email,Book Title,Barcode,Issued At,Due Date,Returned At
...Export Fines Report
GET /api/v1/reports/finesGenerates a CSV file containing the latest 1,000 fine records. The response is a downloadable file with Content-Type: text/csv.
Authorization: ROLE_ADMIN, ROLE_LIBRARIAN
CSV Columns
| Column | Description |
|---|---|
| Fine ID | MongoDB ObjectId |
| User Name | User's full name |
| Amount ($) | Fine amount in dollars |
| Status | UNPAID, PAID, or WAIVED |
| Reason | Description of the fine |
| Created At | ISO 8601 timestamp |
| Updated At | ISO 8601 timestamp |
Response
HTTP/1.1 200 OK
Content-Type: text/csv
Content-Disposition: attachment; filename="fines_report.csv"
Fine ID,User Name,Amount ($),Status,Reason,Created At,Updated At
...Route Summary
| Method | Path | Auth | Description |
|---|---|---|---|
GET | /reports/circulation | Admin, Librarian | Download circulation CSV |
GET | /reports/fines | Admin, Librarian | Download fines CSV |