API Documentation

Developer Guide for MediLink API Integration

Authentication

API Key Setup

Authorization: Bearer YOUR_API_KEY
Content-Type: application/json

OAuth 2.0 Flow

  1. Register your application
  2. Redirect user for authorization
  3. Exchange code for access token
  4. Use token for API requests

Patient Records API

Get Patient Records

GET /api/v1/patients/{patient_id}/records
Authorization: Bearer {access_token}

Upload Medical Document

POST /api/v1/patients/{patient_id}/documents
Content-Type: multipart/form-data
{
  "file": "medical_report.pdf",
  "category": "lab_results",
  "date": "2025-01-15"
}

Provider Integration

Healthcare Provider Endpoints

  • GET /api/v1/providers - List authorized providers
  • POST /api/v1/providers/access - Grant provider access
  • DELETE /api/v1/providers/{id}/access - Revoke access

Access Control

POST /api/v1/providers/access
{
  "provider_id": "12345",
  "access_level": "read_write",
  "expiry_date": "2025-12-31"
}

Device Data API

Sync Device Data

POST /api/v1/devices/sync
{
  "device_type": "fitness_tracker",
  "data": [
    {
      "timestamp": "2025-01-15T10:30:00Z",
      "heart_rate": 72,
      "steps": 8500
    }
  ]
}

Supported Data Types

  • Heart rate, blood pressure, glucose levels
  • Activity data (steps, calories, sleep)
  • Medication adherence
  • Vital signs monitoring

Response Formats

Success Response

{
  "status": "success",
  "data": {...},
  "timestamp": "2025-01-15T10:30:00Z"
}

Error Response

{
  "status": "error",
  "error_code": "INVALID_TOKEN",
  "message": "Authentication token is invalid"
}