http://localhost:8000/apiAuthenticate user and receive access token for subsequent API requests.
{
"email": "admin@hospital.com",
"password": "SecurePass123!@"
}
{
"success": true,
"token": "1|abcdefghijklmnopqrstuvwxyz123456",
"user": {
"id": 1,
"name": "Admin User",
"email": "admin@hospital.com",
"role": "admin",
"phone": "+1234567890"
}
}
curl -X POST http://localhost:8000/api/auth/login \
-H "Content-Type: application/json" \
-d '{"email":"admin@hospital.com","password":"SecurePass123!@"}'
Authorization: Bearer YOUR_TOKEN_HERE
Retrieve a list of all users in the system.
curl http://localhost:8000/api/users \ -H "Authorization: Bearer YOUR_TOKEN_HERE"
Create an invitation for a new user to join the system.
{
"email": "newdoctor@hospital.com",
"role": "doctor"
}
admin, doctor, receptionist, cashier,
nurse, lab_technician, pharmacist
curl -X POST http://localhost:8000/api/invitations \
-H "Authorization: Bearer YOUR_TOKEN_HERE" \
-H "Content-Type: application/json" \
-d '{"email":"newdoctor@hospital.com","role":"doctor"}'
Accept an invitation and complete user registration.
{
"password": "SecurePass123!@",
"name": "Dr. John Doe",
"phone": "+1234567890"
}
curl -X POST http://localhost:8000/api/invitations/abc123xyz789/accept \
-H "Content-Type: application/json" \
-d '{"password":"SecurePass123!@","name":"Dr. John Doe","phone":"+1234567890"}'
Retrieve a paginated list of patients with optional search and filtering.
?search=John - Search by name, email, or phone?per_page=20 - Results per page (default: 15)?page=2 - Page number
curl "http://localhost:8000/api/patients?search=John&per_page=15" \ -H "Authorization: Bearer YOUR_TOKEN_HERE"
Register a new patient in the system.
{
"first_name": "John",
"last_name": "Doe",
"date_of_birth": "1990-01-15",
"gender": "male",
"phone": "+1234567890",
"email": "john@example.com",
"blood_group": "O+",
"allergies": ["Penicillin", "Peanuts"],
"medical_history": "Diabetes Type 2, Hypertension"
}
curl -X POST http://localhost:8000/api/patients \
-H "Authorization: Bearer YOUR_TOKEN_HERE" \
-H "Content-Type: application/json" \
-d '{"first_name":"John","last_name":"Doe","date_of_birth":"1990-01-15","gender":"male","phone":"+1234567890"}'
Retrieve all visit records for a specific patient.
curl http://localhost:8000/api/patients/1/visits \ -H "Authorization: Bearer YOUR_TOKEN_HERE"
Retrieve a paginated list of appointments with optional filtering.
?status=scheduled - Filter by status (scheduled, completed, cancelled)?doctor_id=2 - Filter by doctor?per_page=15 - Results per page
curl "http://localhost:8000/api/appointments?status=scheduled&doctor_id=2" \ -H "Authorization: Bearer YOUR_TOKEN_HERE"
Schedule a new appointment for a patient.
{
"patient_id": 1,
"doctor_id": 2,
"appointment_date": "2025-01-20",
"appointment_time": "14:30",
"reason": "Regular checkup",
"notes": "Patient prefers morning appointments"
}
curl -X POST http://localhost:8000/api/appointments \
-H "Authorization: Bearer YOUR_TOKEN_HERE" \
-H "Content-Type: application/json" \
-d '{"patient_id":1,"doctor_id":2,"appointment_date":"2025-01-20","appointment_time":"14:30","reason":"Regular checkup"}'
Cancel an existing appointment.
curl -X PATCH http://localhost:8000/api/appointments/1/cancel \ -H "Authorization: Bearer YOUR_TOKEN_HERE"
Retrieve a paginated list of visit records.
?patient_id=1 - Filter by patient?doctor_id=2 - Filter by doctor?per_page=15 - Results per page
curl "http://localhost:8000/api/visits?patient_id=1&doctor_id=2" \ -H "Authorization: Bearer YOUR_TOKEN_HERE"
Create a new visit record (Electronic Medical Record).
{
"patient_id": 1,
"doctor_id": 2,
"appointment_id": 1,
"visit_date": "2025-01-20",
"chief_complaint": "Chest pain",
"diagnosis": "Angina pectoris",
"medical_notes": "Patient reports intermittent chest pain...",
"vital_signs": {
"blood_pressure": "120/80",
"temperature": "98.6",
"pulse": "72",
"weight": "70"
},
"consultation_fee": 50.00
}
curl -X POST http://localhost:8000/api/visits \
-H "Authorization: Bearer YOUR_TOKEN_HERE" \
-H "Content-Type: application/json" \
-d '{"patient_id":1,"doctor_id":2,"visit_date":"2025-01-20","chief_complaint":"Chest pain","diagnosis":"Angina pectoris","consultation_fee":50.00}'
Create a new laboratory test order.
{
"patient_id": 1,
"doctor_id": 2,
"visit_id": 1,
"test_name": "Complete Blood Count",
"test_type": "Blood Test",
"priority": "normal",
"notes": "Fasting required",
"order_date": "2025-01-20",
"cost": 25.00
}
curl -X POST http://localhost:8000/api/labs/orders \
-H "Authorization: Bearer YOUR_TOKEN_HERE" \
-H "Content-Type: application/json" \
-d '{"patient_id":1,"doctor_id":2,"test_name":"Complete Blood Count","test_type":"Blood Test","priority":"normal","cost":25.00}'
Upload laboratory test results.
{
"lab_order_id": 1,
"results": "All values within normal range",
"result_file_url": "https://example.com/results/file.pdf",
"result_date": "2025-01-21",
"notes": "No abnormalities detected"
}
curl -X POST http://localhost:8000/api/labs/results \
-H "Authorization: Bearer YOUR_TOKEN_HERE" \
-H "Content-Type: application/json" \
-d '{"lab_order_id":1,"results":"All values within normal range","result_date":"2025-01-21"}'
Create a new prescription for a patient.
{
"patient_id": 1,
"doctor_id": 2,
"visit_id": 1,
"prescription_date": "2025-01-20",
"medications": [
{
"name": "Aspirin",
"dosage": "500mg",
"frequency": "Twice daily",
"duration": "7 days",
"instructions": "Take with food"
},
{
"name": "Metformin",
"dosage": "850mg",
"frequency": "Three times daily",
"duration": "30 days",
"instructions": "With meals"
}
],
"notes": "Follow up after 2 weeks"
}
curl -X POST http://localhost:8000/api/pharmacy/prescriptions \
-H "Authorization: Bearer YOUR_TOKEN_HERE" \
-H "Content-Type: application/json" \
-d '{"patient_id":1,"doctor_id":2,"prescription_date":"2025-01-20","medications":[{"name":"Aspirin","dosage":"500mg","frequency":"Twice daily","duration":"7 days"}]}'
Retrieve a paginated list of prescriptions with optional filtering.
?status=pending - Filter by status (pending, dispensed, cancelled)?patient_id=1 - Filter by patient?per_page=15 - Results per page
curl "http://localhost:8000/api/pharmacy/prescriptions?status=pending&per_page=15" \ -H "Authorization: Bearer YOUR_TOKEN_HERE"
Update prescription status (mark as dispensed, cancelled, etc).
{
"status": "dispensed",
"notes": "Dispensed on 2025-01-21"
}
curl -X PUT http://localhost:8000/api/pharmacy/prescriptions/1 \
-H "Authorization: Bearer YOUR_TOKEN_HERE" \
-H "Content-Type: application/json" \
-d '{"status":"dispensed","notes":"Dispensed on 2025-01-21"}'
Retrieve current pharmacy inventory with stock levels.
?low_stock=true - Show only low stock items?expired=true - Show expired items?per_page=15 - Results per page
curl "http://localhost:8000/api/pharmacy/inventory?low_stock=true" \ -H "Authorization: Bearer YOUR_TOKEN_HERE"
Create a new invoice for a patient visit or services.
{
"patient_id": 1,
"visit_id": 1,
"invoice_date": "2025-01-20",
"items": [
{
"description": "Doctor Consultation",
"quantity": 1,
"unit_price": 50.00,
"amount": 50.00
},
{
"description": "Blood Test (CBC)",
"quantity": 1,
"unit_price": 25.00,
"amount": 25.00
},
{
"description": "Medications",
"quantity": 1,
"unit_price": 35.00,
"amount": 35.00
}
],
"subtotal": 110.00,
"tax": 11.00,
"discount": 0.00,
"total": 121.00
}
curl -X POST http://localhost:8000/api/invoices \
-H "Authorization: Bearer YOUR_TOKEN_HERE" \
-H "Content-Type: application/json" \
-d '{"patient_id":1,"visit_id":1,"invoice_date":"2025-01-20","subtotal":110.00,"tax":11.00,"total":121.00}'
Retrieve a paginated list of invoices with optional filtering.
?status=pending - Filter by status (pending, paid, cancelled)?patient_id=1 - Filter by patient?per_page=15 - Results per page
curl "http://localhost:8000/api/invoices?status=pending&per_page=15" \ -H "Authorization: Bearer YOUR_TOKEN_HERE"
Mark an invoice as paid and record payment details.
{
"payment_method": "card",
"amount_paid": 121.00,
"payment_date": "2025-01-20"
}
cash | card | insurance | other
curl -X PATCH http://localhost:8000/api/invoices/1/pay \
-H "Authorization: Bearer YOUR_TOKEN_HERE" \
-H "Content-Type: application/json" \
-d '{"payment_method":"card","amount_paid":121.00,"payment_date":"2025-01-20"}'
{
"success": true,
"message": "Operation completed successfully",
"data": {
"id": 1,
"name": "John Doe",
"email": "john@example.com",
...
}
}
{
"success": true,
"data": [
{
"id": 1,
"name": "John Doe",
...
}
],
"meta": {
"total": 100,
"per_page": 15,
"current_page": 1,
"last_page": 7,
"from": 1,
"to": 15
},
"links": {
"first": "http://localhost:8000/api/patients?page=1",
"last": "http://localhost:8000/api/patients?page=7",
"next": "http://localhost:8000/api/patients?page=2"
}
}
{
"success": false,
"message": "Validation error",
"errors": {
"email": ["The email field is required"],
"password": ["The password must be at least 8 characters"]
}
}
| Code | Meaning | Description |
|---|---|---|
| 200 | OK | Request successful |
| 201 | Created | Resource created successfully |
| 400 | Bad Request | Invalid request parameters |
| 401 | Unauthorized | Missing or invalid authentication token |
| 403 | Forbidden | User lacks required permissions |
| 404 | Not Found | Resource does not exist |
| 422 | Unprocessable Entity | Validation failed |
| 500 | Server Error | Internal server error |
| Role | Description | Key Permissions |
|---|---|---|
| Admin | Full system access | All operations, user management, system configuration |
| Doctor | Medical professional | Create visits, prescriptions, lab orders, view patients |
| Receptionist | Front desk staff | Manage appointments, patient registration |
| Cashier | Billing staff | Create invoices, process payments, view billing |
| Nurse | Nursing staff | Record vital signs, assist doctors, view patient info |
| Lab Technician | Laboratory staff | Create lab orders, upload results, manage tests |
| Pharmacist | Pharmacy staff | Dispense prescriptions, manage inventory |
Include your authentication token in the Authorization header for all requests:
Authorization: Bearer YOUR_TOKEN_HERE
curl http://localhost:8000/api/patients \ -H "Authorization: Bearer 1|abcdefghijklmnopqrstuvwxyz123456" \ -H "Accept: application/json"
success field in JSON response| Field Type | Rules | Example |
|---|---|---|
| Valid email format | user@example.com | |
| Phone | 10-15 digits, optional + | +1234567890 |
| Date | YYYY-MM-DD format | 2025-01-20 |
| Time | HH:MM format (24hr) | 14:30 |
| Money | Decimal, 2 places max | 99.99 |
| Password | Min 8 chars, mixed case, special char | SecurePass123!@ |