Quickstart

Get up and running with the MediLoop API in just a few minutes. This guide walks you through authentication, making your first API call, and common integration patterns.

Prerequisites

  • A MediLoop developer account (Sign up here)
  • An API key from the Developer Portal
  • Basic familiarity with REST APIs

Step 1: Get Your API Key

After signing up, create an application in the Developer Portal to get your API keys. You'll receive two keys:

  • sk_test_... - For sandbox testing
  • sk_live_... - For production (after verification)

Step 2: Make Your First Request

Let's verify your API key works by listing patients:

Request
bash
curl https://sandbox.api.mediloop.co/api/v1/uhid/ \
  -H "Authorization: Bearer sk_test_your_api_key"
RESPONSE200
{
  "results": [],
  "count": 0,
  "page": 1,
  "page_size": 20,
  "source": "fhir"
}

Step 3: Register a Patient

Create your first patient record. In sandbox mode, use test data:

Request
bash
curl -X POST https://sandbox.api.mediloop.co/api/v1/uhid/register/ \
  -H "Authorization: Bearer sk_test_your_api_key" \
  -H "Content-Type: application/json" \
  -d '{
    "first_name": "Test",
    "last_name": "Patient",
    "date_of_birth": "1990-01-15",
    "gender": "M",
    "phone_number": "+256700000001",
    "district": "Kampala"
  }'
RESPONSE201
{
  "uhid": "UG987654321B",
  "first_name": "Test",
  "last_name": "Patient",
  "date_of_birth": "1990-01-15",
  "gender": "M",
  "phone_number": "+256700000001",
  "district": "Kampala",
  "fhir_patient_id": "fhir-test-123",
  "is_active": true,
  "created_at": "2024-01-15T10:00:00Z"
}

Step 4: Book an Appointment

Now let's book an appointment for the patient:

Request
bash
curl -X POST https://sandbox.api.mediloop.co/api/v1/appointments/ \
  -H "Authorization: Bearer sk_test_your_api_key" \
  -H "Content-Type: application/json" \
  -d '{
    "patient_uhid": "UG987654321B",
    "practitioner_id": "prov-test-001",
    "service_type_code": "consultation",
    "start_time": "2024-01-20T10:00:00Z",
    "duration_minutes": 30,
    "reason_text": "General checkup"
  }'
RESPONSE201
{
  "id": "apt-123-456",
  "appointment_number": "APT-2024-0001",
  "patient_uhid": "UG987654321B",
  "status": "booked",
  "start_time": "2024-01-20T10:00:00Z",
  "end_time": "2024-01-20T10:30:00Z",
  "created_at": "2024-01-15T10:05:00Z"
}

Step 5: Send an Appointment Reminder

Send an appointment reminder notification to the patient:

Request
bash
curl -X POST https://sandbox.api.mediloop.co/api/v1/triggers/appointment-reminder/ \
  -H "Authorization: Bearer sk_test_your_api_key" \
  -H "Content-Type: application/json" \
  -d '{
    "patient_uhid": "UG987654321B",
    "appointment_id": "apt-123-456",
    "provider_name": "Dr. Sarah Smith",
    "facility_name": "Mulago Hospital",
    "appointment_date": "2024-01-20T10:00:00Z",
    "appointment_type": "General Consultation"
  }'
RESPONSE200
{
  "success": true,
  "notification_id": "notif-789-012",
  "notification_number": "NOTIF-20240115-0001"
}

Environments

EnvironmentBase URLKey Prefix
Sandboxhttps://sandbox.api.mediloop.cosk_test_
Productionhttps://api.mediloop.cosk_live_

Next Steps