Skip to content

Reports API

Base route: /api/reports
Auth required: ✅ JWT Bearer

Generates downloadable Excel (.xlsx) files for core entities. Files are generated on-demand using ClosedXML.


GET /api/reports/vendors

Downloads an Excel file containing all active vendors.

Permission: Vendor:Read

Response

  • Content-Type: application/vnd.openxmlformats-officedocument.spreadsheetml.sheet
  • Filename: vendors_YYYYMMDD.xlsx

Columns

ColumnDescription
IDVendor ID
NameVendor name
TypeVendor type
AddressPhysical address
PhoneContact number
EmailContact email
Drug License 1Primary license
Drug License 2Secondary license
Outstanding BalanceUnpaid amount
Total Invoice ValueSum of all invoices
Total PaidSum of all payments
Created AtCreation timestamp

GET /api/reports/invoices

Downloads an Excel file containing all active invoices.

Permission: Invoice:Read

Response

  • Filename: invoices_YYYYMMDD.xlsx

Columns

ColumnDescription
IDInvoice ID
Invoice NumberInvoice reference
VendorVendor name
AmountTotal invoice amount
Paid AmountAmount paid so far
Pending AmountOutstanding balance
StatusComputed status
Invoice DateIssue date
Due DatePayment due date
DescriptionNotes

GET /api/reports/transactions

Downloads an Excel file containing all active transactions.

Permission: Transaction:Read

Response

  • Filename: transactions_YYYYMMDD.xlsx

Columns

ColumnDescription
IDTransaction ID
Invoice NumberRelated invoice
VendorRelated vendor name
AmountPayment amount
TypeCash / UPI / Net Banking
Transaction DatePayment date
DescriptionNotes

Usage in the Frontend

The frontend triggers downloads by navigating to the report URL:

typescript
window.open(`${baseUrl}/reports/vendors`, '_blank')

The browser handles the file download dialog automatically.

MedRegia — Pharmaceutical Vendor Management Platform