Kulcare Docs
DeveloperBilling03 api reference

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:3000

API 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/json

Profile Context

For multi-profile users, specify the active profile:

X-User-Account-Id: 456

Response 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

CodeMeaningDescription
200OKRequest successful
201CreatedResource created successfully
204No ContentRequest successful, no content to return
400Bad RequestInvalid request parameters
401UnauthorizedAuthentication required or failed
403ForbiddenAuthenticated but not authorized
404Not FoundResource not found
422Unprocessable EntityValidation errors
429Too Many RequestsRate limit exceeded
500Internal Server ErrorServer error
503Service UnavailableService 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: 1642248000

Pagination

List endpoints support pagination using query parameters:

GET /api/patients?page=2&per_page=50

Default values:

  • page: 1
  • per_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=Mumbai

Sorting

Use the sort parameter to sort results:

GET /api/patients?sort=created_at:desc
GET /api/appointments?sort=appointment_date:asc,created_at:desc

Field Selection

Limit returned fields using the fields parameter:

GET /api/patients?fields=id,name,phone_number

Use the include parameter to include related resources:

GET /api/appointments?include=patient,doctor,clinic

API Sections

Core APIs

Healthcare APIs

Business APIs

  • Billing - Payments, invoices, and subscriptions
  • Reports - Analytics and reporting

Integration APIs

  • ABDM - Ayushman Bharat Digital Mission integration
  • Webhooks - Event notifications

Error Codes

Authentication Errors

CodeDescription
AUTH001Invalid credentials
AUTH002Token expired
AUTH003Token invalid
AUTH004Account not verified
AUTH005Account suspended

Validation Errors

CodeDescription
VAL001Required field missing
VAL002Invalid format
VAL003Value out of range
VAL004Duplicate value
VAL005Invalid reference

Business Logic Errors

CodeDescription
BIZ001Insufficient permissions
BIZ002Resource limit exceeded
BIZ003Invalid state transition
BIZ004Dependency not met
BIZ005Conflict 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:

Download Postman Collection

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:

Next Steps

On this page