API Reference Overview
Welcome to the Kulcare API documentation. This guide provides comprehensive information about all available API endpoints, authentication, and best practices.
Base URL
Production: https://api.kulcare.com
Staging: https://api-stg.kulcare.com
Development: http://localhost:3000API Version
Current version: v1
All API endpoints are prefixed with the version number when applicable.
Authentication
All API requests require authentication except for public endpoints (registration, login, etc.).
Headers
Authorization: Bearer YOUR_JWT_TOKEN
Content-Type: application/json
Accept: application/jsonProfile Context
For multi-profile users, specify the active profile:
X-User-Account-Id: 456Response Format
Success Response
{
"success": true,
"data": {
"id": 123,
"type": "resource_type",
"attributes": {
// Resource attributes
},
"relationships": {
// Related resources
}
},
"meta": {
"timestamp": "2024-01-15T10:30:00Z",
"version": "1.0"
}
}Error Response
{
"success": false,
"error": {
"code": "VALIDATION_ERROR",
"message": "Validation failed",
"details": {
"phone_number": ["is invalid"],
"email": ["has already been taken"]
}
},
"meta": {
"timestamp": "2024-01-15T10:30:00Z"
}
}Paginated Response
{
"success": true,
"data": [...],
"meta": {
"pagination": {
"current_page": 1,
"total_pages": 10,
"total_count": 245,
"per_page": 25,
"next_page": 2,
"prev_page": null
}
}
}HTTP Status Codes
| Code | Meaning | Description |
|---|---|---|
| 200 | OK | Request successful |
| 201 | Created | Resource created successfully |
| 204 | No Content | Request successful, no content to return |
| 400 | Bad Request | Invalid request parameters |
| 401 | Unauthorized | Authentication required or failed |
| 403 | Forbidden | Authenticated but not authorized |
| 404 | Not Found | Resource not found |
| 422 | Unprocessable Entity | Validation errors |
| 429 | Too Many Requests | Rate limit exceeded |
| 500 | Internal Server Error | Server error |
| 503 | Service Unavailable | Service temporarily unavailable |
Rate Limiting
API requests are rate limited to ensure fair usage:
- Authenticated requests: 1000 requests per hour
- Unauthenticated requests: 60 requests per hour
Rate limit information is included in response headers:
X-RateLimit-Limit: 1000
X-RateLimit-Remaining: 950
X-RateLimit-Reset: 1642248000Pagination
List endpoints support pagination using query parameters:
GET /api/patients?page=2&per_page=50Default values:
page: 1per_page: 25 (max: 100)
Filtering
Many endpoints support filtering via query parameters:
GET /api/appointments?status=scheduled&date=2024-01-15
GET /api/patients?search=john&city=MumbaiSorting
Use the sort parameter to sort results:
GET /api/patients?sort=created_at:desc
GET /api/appointments?sort=appointment_date:asc,created_at:descField Selection
Limit returned fields using the fields parameter:
GET /api/patients?fields=id,name,phone_numberIncluding Related Resources
Use the include parameter to include related resources:
GET /api/appointments?include=patient,doctor,clinicAPI Sections
Core APIs
- Authentication - User registration, login, verification
- Users & Profiles - User management and multi-profile system
Healthcare APIs
- Clinics - Clinic management and settings
- Doctors - Doctor profiles and schedules
- Patients - Patient records and history
- Appointments - Appointment booking and management
- Medical Records - Prescriptions and medical documents
Business APIs
Integration APIs
Error Codes
Authentication Errors
| Code | Description |
|---|---|
| AUTH001 | Invalid credentials |
| AUTH002 | Token expired |
| AUTH003 | Token invalid |
| AUTH004 | Account not verified |
| AUTH005 | Account suspended |
Validation Errors
| Code | Description |
|---|---|
| VAL001 | Required field missing |
| VAL002 | Invalid format |
| VAL003 | Value out of range |
| VAL004 | Duplicate value |
| VAL005 | Invalid reference |
Business Logic Errors
| Code | Description |
|---|---|
| BIZ001 | Insufficient permissions |
| BIZ002 | Resource limit exceeded |
| BIZ003 | Invalid state transition |
| BIZ004 | Dependency not met |
| BIZ005 | Conflict with existing data |
Request Examples
cURL
curl -X GET https://api.kulcare.com/api/patients \
-H "Authorization: Bearer YOUR_TOKEN" \
-H "Content-Type: application/json"JavaScript (Fetch)
const response = await fetch('https://api.kulcare.com/api/patients', {
method: 'GET',
headers: {
'Authorization': 'Bearer YOUR_TOKEN',
'Content-Type': 'application/json'
}
});
const data = await response.json();Python (Requests)
import requests
headers = {
'Authorization': 'Bearer YOUR_TOKEN',
'Content-Type': 'application/json'
}
response = requests.get(
'https://api.kulcare.com/api/patients',
headers=headers
)
data = response.json()Webhooks
Kulcare can send webhooks for various events:
{
"event": "appointment.created",
"timestamp": "2024-01-15T10:30:00Z",
"data": {
"appointment_id": 123,
"clinic_id": 456,
"patient_id": 789
}
}See Webhooks Documentation for details.
SDK & Libraries
Official SDKs are available for:
- Ruby
- Python
- JavaScript/TypeScript
- PHP
Postman Collection
Import our Postman collection for easy API testing:
API Changelog
Version 1.2 (2024-01-15)
- Added multi-profile support
- Enhanced filtering capabilities
- Improved error responses
Version 1.1 (2023-12-01)
- Added ABDM integration endpoints
- New appointment status workflow
- Performance improvements
Version 1.0 (2023-10-01)
- Initial API release
Support
For API support:
- Email: api-support@kulcare.com
- Documentation: https://docs.kulcare.com
- Status Page: https://status.kulcare.com
Next Steps
- Start with Authentication to get your API token
- Review endpoint documentation for your use case
- Check our Postman Collection for examples