API Reference
This document provides the API reference for iHospita HMS services.
Base URL
Production: https://api.ihospita.com
Staging: https://api-staging.ihospita.com
Development: http://localhost:8000
Authentication
All API requests require a valid JWT token in the Authorization header:
Authorization: Bearer <token>
Response Format
Success Response
{
"success": true,
"data": { ... },
"meta": {
"page": 1,
"limit": 20,
"total": 100
}
}
Error Response
{
"success": false,
"error": {
"code": "ERROR_CODE",
"message": "Human readable message",
"details": { ... }
}
}
HMS Service Endpoints
Patients
| Method | Endpoint | Description |
|---|---|---|
| GET | /api/hms/patients | List patients |
| POST | /api/hms/patients | Create patient |
| GET | /api/hms/patients/:id | Get patient |
| PUT | /api/hms/patients/:id | Update patient |
| DELETE | /api/hms/patients/:id | Delete patient |
Employees
| Method | Endpoint | Description |
|---|---|---|
| GET | /api/hms/employees | List employees |
| POST | /api/hms/employees | Create employee |
| GET | /api/hms/employees/:id | Get employee |
| PUT | /api/hms/employees/:id | Update employee |
CRM Service Endpoints
Families
| Method | Endpoint | Description |
|---|---|---|
| GET | /api/crm/families | List families |
| POST | /api/crm/families | Create family |
| GET | /api/crm/families/:id | Get family |
| POST | /api/crm/families/:id/members | Add member |
VIP
| Method | Endpoint | Description |
|---|---|---|
| GET | /api/crm/vip/tiers | List VIP tiers |
| GET | /api/crm/vip/families/:id | Get family VIP status |
Payment Service Endpoints
Invoices
| Method | Endpoint | Description |
|---|---|---|
| GET | /api/payment/invoices | List invoices |
| POST | /api/payment/invoices | Create invoice |
| GET | /api/payment/invoices/:id | Get invoice |
| POST | /api/payment/invoices/:id/pay | Process payment |
Payments
| Method | Endpoint | Description |
|---|---|---|
| GET | /api/payment/payments | List payments |
| GET | /api/payment/payments/:id | Get payment |
Queue Service Endpoints
Appointments
| Method | Endpoint | Description |
|---|---|---|
| GET | /api/queue/appointments | List appointments |
| POST | /api/queue/appointments | Create appointment |
| PUT | /api/queue/appointments/:id | Update appointment |
| DELETE | /api/queue/appointments/:id | Cancel appointment |
Queue
| Method | Endpoint | Description |
|---|---|---|
| GET | /api/queue/entries | List queue entries |
| POST | /api/queue/entries | Add to queue |
| PUT | /api/queue/entries/:id/call | Call patient |
| PUT | /api/queue/entries/:id/complete | Complete |
Report Service Endpoints
| Method | Endpoint | Description |
|---|---|---|
| GET | /api/report/financial/daily | Daily revenue report |
| GET | /api/report/financial/monthly | Monthly summary |
| GET | /api/report/clinical/visits | Visit statistics |
| GET | /api/report/operational/queue | Queue analytics |
HTTP Status Codes
| Code | Description |
|---|---|
| 200 | Success |
| 201 | Created |
| 400 | Bad Request |
| 401 | Unauthorized |
| 403 | Forbidden |
| 404 | Not Found |
| 422 | Validation Error |
| 429 | Rate Limited |
| 500 | Internal Error |