API Overview
RESTful API reference for Glide HIMS
Base URL & Versioning
# Production
https://your-domain.com/api/v1
# Development
http://localhost:3000/api/v1
# Demo Server
https://hmisdemo.itsolutionsuganda.com/api/v1
All API endpoints are prefixed with /api/v1. The API uses semantic versioning - breaking changes will increment the major version.
Authentication
Most endpoints require JWT authentication. Include the token in the Authorization header:
# Login to get a token
curl -X POST https://api.example.com/api/v1/auth/login \
-H "Content-Type: application/json" \
-d '{"email": "[email protected]", "password": "password123"}'
# Response
{
"accessToken": "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9...",
"refreshToken": "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9...",
"expiresIn": 3600,
"user": {
"id": "uuid",
"email": "[email protected]",
"role": "doctor"
}
}
# Use the token in subsequent requests
curl https://api.example.com/api/v1/patients \
-H "Authorization: Bearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9..."
Public Endpoints (No Auth Required)
POST /api/v1/auth/login- User loginPOST /api/v1/auth/register- User registration (if enabled)GET /api/v1/health- Health checkGET /api/v1/updates/check- Check for updatesPOST /api/v1/license/validate- Validate licensePOST /api/v1/phone-home- Phone home heartbeat
Response Format
All API responses follow a consistent format:
// Success Response
{
"statusCode": 200,
"data": { ... },
"timestamp": "2026-04-10T00:00:00.000Z"
}
// Error Response
{
"statusCode": 400,
"error": "Bad Request",
"message": "Validation failed: email is required",
"timestamp": "2026-04-10T00:00:00.000Z",
"path": "/api/v1/patients"
}
// Paginated Response
{
"statusCode": 200,
"data": [...],
"pagination": {
"page": 1,
"limit": 20,
"total": 150,
"totalPages": 8
},
"timestamp": "2026-04-10T00:00:00.000Z"
}
API Modules
Authentication
User authentication and session management
POST
/auth/login
- Authenticate user
POST
/auth/register
- Register new user
POST
/auth/refresh
- Refresh access token
POST
/auth/logout
- End session
GET
/auth/me
- Get current user profile
Patients
Patient registration and management
GET
/patients
- List all patients
POST
/patients
- Register new patient
GET
/patients/:id
- Get patient details
PUT
/patients/:id
- Update patient
GET
/patients/:id/encounters
- Get patient encounters
Billing & Finance
Invoicing, payments, and financial management
GET
/finance/invoices
- List invoices
POST
/finance/invoices
- Create invoice
POST
/finance/payments
- Record payment
GET
/finance/reports/daily
- Daily financial report
Pharmacy
Drug inventory and dispensing
GET
/pharmacy/drugs
- List drugs
POST
/pharmacy/prescriptions
- Create prescription
POST
/pharmacy/dispense
- Dispense medication
GET
/pharmacy/stock
- Check stock levels
Laboratory
Lab tests and results management
GET
/laboratory/tests
- List available tests
POST
/laboratory/orders
- Order lab test
PUT
/laboratory/results/:id
- Submit test results
Enterprise
Licensing, updates, and phone-home
POST
/license/validate
- Validate license key
Public
GET
/updates/check
- Check for updates
Public
GET
/updates/latest
- Get latest version
Public
POST
/phone-home
- Send heartbeat
Public
GET
/features/check/:feature
- Check feature availability
Rate Limiting
API requests are rate limited to prevent abuse:
| Endpoint Type | Limit | Window |
|---|---|---|
| Authentication endpoints | 10 requests | 1 minute |
| Standard API endpoints | 100 requests | 1 minute |
| Report generation | 10 requests | 1 minute |
| File uploads | 20 requests | 1 minute |
Rate limit headers are included in responses:
X-RateLimit-Limit: 100
X-RateLimit-Remaining: 95
X-RateLimit-Reset: 1617235200
Error Codes
| Code | Status | Description |
|---|---|---|
400 | Bad Request | Invalid request body or parameters |
401 | Unauthorized | Missing or invalid authentication |
403 | Forbidden | Insufficient permissions |
404 | Not Found | Resource not found |
409 | Conflict | Resource already exists |
422 | Unprocessable | Validation failed |
429 | Too Many Requests | Rate limit exceeded |
500 | Internal Error | Server error - contact support |