-
Notifications
You must be signed in to change notification settings - Fork 134
Finance QB REST API
Dr M H B Ariyaratne edited this page May 22, 2026
·
1 revision
The HMIS QuickBooks REST API exposes financial data through HTTP endpoints that external accounting systems can call programmatically. QuickBooks Online, custom ERP integrations, and automated accounting pipelines use this API to pull revenue, payment, and stock data directly — without manual file export and import.
-
Base path:
/api/qb -
Authentication: Pass your API key in the
FinanceHTTP header.
GET /api/qb/dailyReturn?date=2026-05-15
Finance: your-api-key-here
API keys are issued and managed through the HMIS API Key Management console. Keys must be active, not expired, and not retired.
| Method | Endpoint | Description |
|---|---|---|
| GET | /api/qb/dailyReturn |
Daily OPD billing and payment summary |
| GET | /api/qb/inwardJournal |
Inpatient billing journal entries |
| GET | /api/qb/pharmacyGrn |
Pharmacy goods received (stock purchases) |
| GET | /api/qb/itemList |
Full item/service list with QB account mappings |
| GET | /api/qb/doctors |
Doctor/consultant list with payment details |
| GET | /api/qb/professionalFees |
Doctor professional fee payments |
| GET | /api/qb/creditCompany |
Credit company receivables |
| GET | /api/qb/cashierSummary |
Cashier collection summary |
| GET | /api/qb/paymentMethods |
Collections by payment method |
| GET | /api/qb/stockValuation |
Current pharmacy stock valuation |
| Parameter | Description | Example |
|---|---|---|
date |
Single date (for daily data) | 2026-05-15 |
from |
Start date for range queries | 2026-05-01 |
to |
End date for range queries | 2026-05-31 |
department |
Filter by department code |
OPD, PHARMACY
|
format |
Response format |
json (default), iif
|
Date format: yyyy-MM-dd
All endpoints return JSON:
{
"status": "success",
"code": 200,
"data": {
"date": "2026-05-15",
"entries": [
{
"account": "OPD Revenue",
"amount": 125000.00,
"paymentMethod": "Cash",
"docNum": "B-12345",
"qbClass": "OPD"
}
],
"total": 125000.00
}
}Error responses:
{
"status": "error",
"code": 401,
"message": "Invalid or expired API key"
}To retrieve IIF-formatted output (for systems that prefer the file format):
GET /api/qb/dailyReturn?date=2026-05-15&format=iif
Finance: your-api-key-here
The response body is the IIF file content (tab-delimited), suitable for direct import into QuickBooks Desktop.
To configure an external system to use the HMIS QB API:
- Obtain an API key from the HMIS administrator.
- Configure the external system with the HMIS base URL and API key.
- Set up a scheduled job (daily, nightly, or real-time) to call the relevant endpoints.
- Map the returned accounts and classes to the external system's chart of accounts.
- Call daily endpoints once per day after the business day closes (recommended: midnight or early morning).
- Do not call real-time endpoints more than once per minute.
- Cache the item list endpoint — it changes infrequently and does not need to be polled daily.
| Item | Detail |
|---|---|
| REST class |
@Path("qb") in the REST API layer |
| Authentication |
Finance header → ApiKeyController.findApiKey() — checks expiry, retired, activated |
| Date format |
yyyy-MM-dd HH:mm:ss in Gson serialisation |
| Registration | Must be listed in ApplicationConfig.addRestResourceClasses()
|
| Related | QB Integration Overview, REST API Development Guide |